preiiter, eslint

main
Peace 2 weeks ago
parent 036a220276
commit ffba4bdf09
  1. 2
      backend/.prettierignore
  2. 8
      backend/.prettierrc
  3. 6
      backend/dist/app.module.js
  4. 2
      backend/dist/app.module.js.map
  5. 3
      backend/dist/auth/auth.controller.d.ts
  6. 5
      backend/dist/auth/auth.controller.js
  7. 2
      backend/dist/auth/auth.controller.js.map
  8. 6
      backend/dist/auth/auth.module.js
  9. 2
      backend/dist/auth/auth.module.js.map
  10. 42
      backend/dist/auth/auth.service.js
  11. 2
      backend/dist/auth/auth.service.js.map
  12. 2
      backend/dist/auth/dto/login-response.dto.d.ts
  13. 2
      backend/dist/auth/dto/login-response.dto.js.map
  14. 2
      backend/dist/auth/dto/login-user.dto.js.map
  15. 14
      backend/dist/auth/jwt.stratedy.d.ts
  16. 2
      backend/dist/auth/jwt.stratedy.js
  17. 2
      backend/dist/auth/jwt.stratedy.js.map
  18. 2
      backend/dist/common/dto/sucees-response.dto.js.map
  19. 2
      backend/dist/common/entities/timestamped.entity.js.map
  20. 3
      backend/dist/main.js
  21. 2
      backend/dist/main.js.map
  22. 2
      backend/dist/tsconfig.build.tsbuildinfo
  23. 2
      backend/dist/users/dto/change-password.dto.js.map
  24. 2
      backend/dist/users/dto/create-user.dto.js.map
  25. 2
      backend/dist/users/dto/user-info-response.dto.js.map
  26. 2
      backend/dist/users/user.entity.d.ts
  27. 2
      backend/dist/users/user.entity.js.map
  28. 3
      backend/dist/users/users.controller.d.ts
  29. 2
      backend/dist/users/users.controller.js.map
  30. 2
      backend/dist/users/users.module.js
  31. 43
      backend/dist/users/users.service.js
  32. 2
      backend/dist/users/users.service.js.map
  33. 10
      backend/eslint.config.mjs
  34. 53
      backend/package-lock.json
  35. 12
      backend/package.json
  36. 12
      backend/src/app.module.ts
  37. 38
      backend/src/auth/auth.controller.ts
  38. 6
      backend/src/auth/auth.module.ts
  39. 48
      backend/src/auth/auth.service.ts
  40. 8
      backend/src/auth/dto/login-response.dto.ts
  41. 14
      backend/src/auth/dto/login-user.dto.ts
  42. 6
      backend/src/auth/jwt-auth.guard.ts
  43. 7
      backend/src/auth/jwt.stratedy.ts
  44. 34
      backend/src/common/dto/sucees-response.dto.ts
  45. 12
      backend/src/common/entities/timestamped.entity.ts
  46. 6
      backend/src/common/interfaces/auth-request.interface.ts
  47. 4
      backend/src/common/interfaces/jwt-payload.interface.ts
  48. 4
      backend/src/main.ts
  49. 14
      backend/src/users/dto/change-password.dto.ts
  50. 20
      backend/src/users/dto/create-user.dto.ts
  51. 8
      backend/src/users/dto/user-info-response.dto.ts
  52. 22
      backend/src/users/user.entity.ts
  53. 18
      backend/src/users/users.controller.ts
  54. 2
      backend/src/users/users.module.ts
  55. 77
      backend/src/users/users.service.ts
  56. 10
      backend_old/.env
  57. 4
      backend_old/.prettierrc
  58. 22
      backend_old/.vscode/launch.json
  59. 98
      backend_old/README.md
  60. 6
      backend_old/dist/app.controller.d.ts
  61. 35
      backend_old/dist/app.controller.js
  62. 1
      backend_old/dist/app.controller.js.map
  63. 2
      backend_old/dist/app.module.d.ts
  64. 47
      backend_old/dist/app.module.js
  65. 1
      backend_old/dist/app.module.js.map
  66. 3
      backend_old/dist/app.service.d.ts
  67. 20
      backend_old/dist/app.service.js
  68. 1
      backend_old/dist/app.service.js.map
  69. 15
      backend_old/dist/auth/auth.controller.d.ts
  70. 70
      backend_old/dist/auth/auth.controller.js
  71. 1
      backend_old/dist/auth/auth.controller.js.map
  72. 2
      backend_old/dist/auth/auth.module.d.ts
  73. 42
      backend_old/dist/auth/auth.module.js
  74. 1
      backend_old/dist/auth/auth.module.js.map
  75. 12
      backend_old/dist/auth/auth.service.d.ts
  76. 49
      backend_old/dist/auth/auth.service.js
  77. 1
      backend_old/dist/auth/auth.service.js.map
  78. 5
      backend_old/dist/auth/dto/login-response.dto.d.ts
  79. 9
      backend_old/dist/auth/dto/login-response.dto.js
  80. 1
      backend_old/dist/auth/dto/login-response.dto.js.map
  81. 4
      backend_old/dist/auth/dto/login-user.dto.d.ts
  82. 28
      backend_old/dist/auth/dto/login-user.dto.js
  83. 1
      backend_old/dist/auth/dto/login-user.dto.js.map
  84. 4
      backend_old/dist/auth/jwt-auth.guard.d.ts
  85. 18
      backend_old/dist/auth/jwt-auth.guard.js
  86. 1
      backend_old/dist/auth/jwt-auth.guard.js.map
  87. 10
      backend_old/dist/auth/jwt.stratedy.d.ts
  88. 34
      backend_old/dist/auth/jwt.stratedy.js
  89. 1
      backend_old/dist/auth/jwt.stratedy.js.map
  90. 7
      backend_old/dist/common/dto/sucees-response.dto.d.ts
  91. 23
      backend_old/dist/common/dto/sucees-response.dto.js
  92. 1
      backend_old/dist/common/dto/sucees-response.dto.js.map
  93. 4
      backend_old/dist/common/entities/timestamped.entity.d.ts
  94. 27
      backend_old/dist/common/entities/timestamped.entity.js
  95. 1
      backend_old/dist/common/entities/timestamped.entity.js.map
  96. 1
      backend_old/dist/main.d.ts
  97. 17
      backend_old/dist/main.js
  98. 1
      backend_old/dist/main.js.map
  99. 1
      backend_old/dist/tsconfig.build.tsbuildinfo
  100. 4
      backend_old/dist/users/dto/change-password.dto.d.ts
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,2 @@
node_modules
dist

@ -1,4 +1,8 @@
{
"singleQuote": true,
"trailingComma": "all"
}
"semi": true,
"tabWidth": 2,
"trailingComma": "all",
"printWidth": 100,
"endOfLine": "auto"
}

@ -26,7 +26,7 @@ exports.AppModule = AppModule = __decorate([
typeorm_1.TypeOrmModule.forRootAsync({
imports: [config_1.ConfigModule],
inject: [config_1.ConfigService],
useFactory: async (config) => ({
useFactory: (config) => ({
type: 'mysql',
host: config.get('DB_HOST'),
port: parseInt(config.get('DB_PORT', '3306'), 10),
@ -38,7 +38,9 @@ exports.AppModule = AppModule = __decorate([
autoLoadEntities: true,
logging: true,
}),
}), auth_module_1.AuthModule, users_module_1.UsersModule
}),
auth_module_1.AuthModule,
users_module_1.UsersModule,
],
controllers: [app_controller_1.AppController],
providers: [app_service_1.AppService, jw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H,CAAC;YACF,wBAAU;YACV,0BAAW;SACZ;QACD,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,EAAE,gBAAU,CAAC;KACpC,CAAC;GACW,SAAS,CAAG"}

@ -5,11 +5,12 @@ import { SuccessResponseDto } from 'src/common/dto/sucees-response.dto';
import { LoginResponseDto } from './dto/login-response.dto';
import { UsersService } from 'src/users/users.service';
import { UserInfoResponseDto } from 'src/users/dto/user-info-response.dto';
import { AuthRequest } from 'src/common/interfaces/auth-request.interface';
export declare class AuthController {
private readonly authService;
private userService;
constructor(authService: AuthService, userService: UsersService);
signup(dto: CreateUserDto): Promise<SuccessResponseDto>;
login(dto: LoginUserDto): Promise<SuccessResponseDto<LoginResponseDto>>;
getMe(req: any): Promise<SuccessResponseDto<UserInfoResponseDto>>;
getMe(req: AuthRequest): Promise<SuccessResponseDto<UserInfoResponseDto>>;
}

@ -28,7 +28,7 @@ let AuthController = class AuthController {
this.userService = userService;
}
async signup(dto) {
const user = await this.authService.signup(dto);
await this.authService.signup(dto);
return sucees_response_dto_1.SuccessResponseDto.ok();
}
async login(dto) {
@ -65,6 +65,7 @@ __decorate([
], AuthController.prototype, "getMe", null);
exports.AuthController = AuthController = __decorate([
(0, common_1.Controller)('auth'),
__metadata("design:paramtypes", [auth_service_1.AuthService, users_service_1.UsersService])
__metadata("design:paramtypes", [auth_service_1.AuthService,
users_service_1.UsersService])
], AuthController);
//# sourceMappingURL=auth.controller.js.map

@ -1 +1 @@
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiF;AACjF,iDAA6C;AAC7C,kEAA8D;AAC9D,yDAA2D;AAC3D,2EAAwE;AAExE,0DAAuD;AACvD,qDAAgD;AAIzC,IAAM,cAAc,GAApB,MAAM,cAAc;IACM;IAAkC;IAA/D,YAA6B,WAAwB,EAAU,WAAyB;QAA3D,gBAAW,GA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,MAAM,CAAC;qCAGe,0BAAW;QACpB,4BAAY;GAHxB,cAAc,CAwB1B"}

@ -27,16 +27,16 @@ exports.AuthModule = AuthModule = __decorate([
jwt_1.JwtModule.registerAsync({
imports: [config_1.ConfigModule],
inject: [config_1.ConfigService],
useFactory: async (configService) => ({
useFactory: (configService) => ({
secret: configService.get('JWT_SECRET'),
signOptions: {
expiresIn: configService.get('JWT_EXPIRES_IN') || '1h',
},
}),
})
}),
],
providers: [auth_service_1.AuthService, jwt_stratedy_1.JwtStrategy],
controllers: [auth_controller_1.AuthController]
controllers: [auth_controller_1.AuthController],
})
], AuthModule);
//# sourceMappingURL=auth.module.js.map

@ -1 +1 @@
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iDAA6C;AAC7C,uDAAmD;AACnD,wDAAqD;AACrD,qCAAwC;AACxC,2CAA6D;AAC7D,+CAAkD;AAClD,iDAA6C;AAqBtC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAnBtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,0BAAW;YACX,yBAAc;YACd,qBAAY;YACZ,eAAS,CAAC,aAAa,CAAC;gBACtB,OAAO,EAAE,CAAC,qBAAY,CAAC;gBACvB,MAAM,EAAE,CAAC,sBAAa,CAAC;gBACvB,UAAU,EAAE,KAAK,EAAE,aAA4B,EAAE,EAAE,CAAC,CAAC;oBACnD,MAAM,EAAE,aAAa,CAAC,GAAG,CAAS,YAAY,CAAC;oBAC/C,WAAW,EAAE;wBACX,SAAS,EAAE,aAAa,CAAC,GAAG,CAAS,gBAAgB,CAAC,IAAI,IAAI;qBAC/D;iBACF,CAAC;aACH,CAAC;SACH;QACD,SAAS,EAAE,CAAC,0BAAW,EAAE,0BAAW,CAAC;QACrC,WAAW,EAAE,CAAC,gCAAc,CAAC;KAC9B,CAAC;GACW,UAAU,CAAG"}
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iDAA6C;AAC7C,uDAAmD;AACnD,wDAAqD;AACrD,qCAAwC;AACxC,2CAA6D;AAC7D,+CAAkD;AAClD,iDAA6C;AAqBtC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAnBtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,0BAAW;YACX,yBAAc;YACd,qBAAY;YACZ,eAAS,CAAC,aAAa,CAAC;gBACtB,OAAO,EAAE,CAAC,qBAAY,CAAC;gBACvB,MAAM,EAAE,CAAC,sBAAa,CAAC;gBACvB,UAAU,EAAE,CAAC,aAA4B,EAAE,EAAE,CAAC,CAAC;oBAC7C,MAAM,EAAE,aAAa,CAAC,GAAG,CAAS,YAAY,CAAC;oBAC/C,WAAW,EAAE;wBACX,SAAS,EAAE,aAAa,CAAC,GAAG,CAAS,gBAAgB,CAAC,IAAI,IAAI;qBAC/D;iBACF,CAAC;aACH,CAAC;SACH;QACD,SAAS,EAAE,CAAC,0BAAW,EAAE,0BAAW,CAAC;QACrC,WAAW,EAAE,CAAC,gCAAc,CAAC;KAC9B,CAAC;GACW,UAAU,CAAG"}

@ -1,10 +1,43 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
@ -13,7 +46,7 @@ exports.AuthService = void 0;
const common_1 = require("@nestjs/common");
const jwt_1 = require("@nestjs/jwt");
const users_service_1 = require("../users/users.service");
const bcrypt = require("bcrypt");
const bcrypt = __importStar(require("bcryptjs"));
let AuthService = class AuthService {
userService;
jwtService;
@ -27,7 +60,7 @@ let AuthService = class AuthService {
}
async login(dto) {
const user = await this.userService.findByName(dto.name);
if (!user || !await bcrypt.compare(dto.password, user.password))
if (!user || !(await bcrypt.compare(dto.password, user.password)))
throw new common_1.UnauthorizedException('Login failed');
const payload = { username: user.name, sub: user.id };
const token = this.jwtService.sign(payload);
@ -37,13 +70,14 @@ let AuthService = class AuthService {
id: user.id,
name: user.name,
email: user.email,
}
},
};
}
};
exports.AuthService = AuthService;
exports.AuthService = AuthService = __decorate([
(0, common_1.Injectable)(),
__metadata("design:paramtypes", [users_service_1.UsersService, jwt_1.JwtService])
__metadata("design:paramtypes", [users_service_1.UsersService,
jwt_1.JwtService])
], AuthService);
//# sourceMappingURL=auth.service.js.map

@ -1 +1 @@
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsH;AACtH,qCAAyC;AACzC,0DAAuD;AACvD,iCAAgC;AAMzB,IAAM,WAAW,GAAjB,MAAM,WAAW;IACA;IAAmC;IAAvD,YAAoB,WAAyB,EAAU,UAAsB;QAAzD,gBAAW,GAAX,WAAW,CAAc;QAAU,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEjF,KAAK,CAAC,MAAM,CAAC,GAAkB;QAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAiB;QACzB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,8BAAqB,CAAC,cAAc,CAAC,CAAC;QAEjH,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5C,OAAO;YACH,YAAY,EAAE,KAAK;YACnB,IAAI,EAAE;gBACF,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,I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QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5C,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,IAAI,EAAE;gBACJ,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA5BY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAGY,4BAAY;QACb,gBAAU;GAHrB,WAAW,CA4BvB"}

@ -1,4 +1,4 @@
import { UserInfoResponseDto } from "src/users/dto/user-info-response.dto";
import { UserInfoResponseDto } from 'src/users/dto/user-info-response.dto';
export declare class LoginResponseDto {
access_token: string;
user: UserInfoResponseDto;

@ -1 +1 @@
{"version":3,"file":"login-response.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/login-response.dto.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IACzB,YAAY,CAAS;IACrB,IAAI,CAAsB;CAC7B;AAHD,4CAGC"}
{"version":3,"file":"login-response.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/login-response.dto.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IAC3B,YAAY,CAAS;IACrB,IAAI,CAAsB;CAC3B;AAHD,4CAGC"}

@ -1 +1 @@
{"version":3,"file":"login-user.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/login-user.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAsD;AAEtD,MAAa,YAAY;IAEZ,IAAI,CAAS;IAIb,QAAQ,CAAS;CAC7B;AAPD,oCAOC;AALY;IADR,IAAA,0BAAQ,GAAE;;0CACW;AAIb;IAFR,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;8CACa"}
{"version":3,"file":"login-user.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/login-user.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAsD;AAEtD,MAAa,YAAY;IAEd,IAAI,CAAS;IAIb,QAAQ,CAAS;CAC3B;AAPD,oCAOC;AALU;IADR,IAAA,0BAAQ,GAAE;;0CACW;AAIb;IAFR,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;8CACa"}

@ -1,10 +1,14 @@
import { Strategy } from 'passport-jwt';
import { ConfigService } from '@nestjs/config';
declare const JwtStrategy_base: new (...args: any) => any;
import { JwtPayload } from 'src/common/interfaces/jwt-payload.interface';
declare const JwtStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithRequest] | [opt: import("passport-jwt").StrategyOptionsWithoutRequest]) => Strategy & {
validate(...args: any[]): unknown;
};
export declare class JwtStrategy extends JwtStrategy_base {
constructor(config: ConfigService);
validate(payload: any): Promise<{
userId: any;
username: any;
}>;
validate(payload: JwtPayload): {
userId: number;
username: string;
};
}
export {};

@ -22,7 +22,7 @@ let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(pas
secretOrKey: config.get('JWT_SECRET'),
});
}
async validate(payload) {
validate(payload) {
return { userId: payload.sub, username: payload.username };
}
};

@ -1 +1 @@
{"version":3,"file":"jwt.stratedy.js","sourceRoot":"","sources":["../../src/auth/jwt.stratedy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAAoD;AACpD,+CAAoD;AACpD,2CAA+C;AAGxC,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IACzD,YAAY,MAAqB;QAC/B,KAAK,CAAC;YACJ,cAAc,EAAE,yBAAU,CAAC,2BAA2B,EAAE;YACxD,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,MAAM,CAAC,GAAG,CAAS,YAAY,CAAC;SAC9C,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAY;QACzB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;CACF,CAAA;AAZY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAES,sBAAa;GADtB,WAAW,CAYvB"}
{"version":3,"file":"jwt.stratedy.js","sourceRoot":"","sources":["../../src/auth/jwt.stratedy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAAoD;AACpD,+CAAoD;AACpD,2CAA+C;AAIxC,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IACzD,YAAY,MAAqB;QAE/B,KAAK,CAAC;YAEJ,cAAc,EAAE,yBAAU,CAAC,2BAA2B,EAAE;YACxD,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,MAAM,CAAC,GAAG,CAAS,YAAY,CAAE;SAC/C,CAAC,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,OAAmB;QAC1B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;CACF,CAAA;AAdY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAES,sBAAa;GADtB,WAAW,CAcvB"}

@ -1 +1 @@
{"version":3,"file":"sucees-response.dto.js","sourceRoot":"","sources":["../../../src/common/dto/sucees-response.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;IAC3B,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,IAAI,CAAK;IAET,MAAM,CAAC,EAAE,CAAI,IAAO,EAAE,OAAgB;QAClC,OAAO;YACH,OAAO,EAAE,IAAI;YACb,IAAI;YACJ,OAAO;SACV,CAAC;IACN,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,OAAgB;QACtB,OAAO;YACH,OAAO,EAAE,IAAI;YACb,OAAO;SACV,CAAC;IACN,CAAC;CACJ;AAnBD,gDAmBC"}
{"version":3,"file":"sucees-response.dto.js","sourceRoot":"","sources":["../../../src/common/dto/sucees-response.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;IAC7B,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,IAAI,CAAK;IAET,MAAM,CAAC,EAAE,CAAI,IAAO,EAAE,OAAgB;QACpC,OAAO;YACL,OAAO,EAAE,IAAI;YACb,IAAI;YACJ,OAAO;SACR,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,OAAgB;QACxB,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO;SACR,CAAC;IACJ,CAAC;CACF;AAnBD,gDAmBC"}

@ -1 +1 @@
{"version":3,"file":"timestamped.entity.js","sourceRoot":"","sources":["../../../src/common/entities/timestamped.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA6D;AAE7D,MAAsB,iBAAiB;IAEnC,SAAS,CAAO;IAGhB,SAAS,CAAO;CACnB;AAND,8CAMC;AAJG;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BAC7B,IAAI;oDAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BAC7B,IAAI;oDAAC"}
{"version":3,"file":"timestamped.entity.js","sourceRoot":"","sources":["../../../src/common/entities/timestamped.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA6D;AAE7D,MAAsB,iBAAiB;IAErC,SAAS,CAAO;IAGhB,SAAS,CAAO;CACjB;AAND,8CAMC;AAJC;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BAC7B,IAAI;oDAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BAC7B,IAAI;oDAAC"}

@ -5,7 +5,8 @@ const app_module_1 = require("./app.module");
const common_1 = require("@nestjs/common");
async function bootstrap() {
const app = await core_1.NestFactory.create(app_module_1.AppModule);
app.enableCors();
if (process.env.NODE_ENV !== 'production')
app.enableCors();
app.useGlobalPipes(new common_1.ValidationPipe({
whitelist: true,
forbidNonWhitelisted: true,

@ -1 +1 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AACzC,2CAAgD;AAEhD,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,GAAG,CAAC,UAAU,EAAE,CAAC;IACjB,GAAG,CAAC,cAAc,CAChB,IAAI,uBAAc,CAAC;QACjB,SAAS,EAAE,IAAI;QACf,oBAAoB,EAAE,IAAI;QAC1B,SAAS,EAAE,IAAI;KAChB,CAAC,CACH,CAAC;IACF,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;AAC7C,CAAC;AACD,SAAS,EAAE,CAAC"}
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AACzC,2CAAgD;AAEhD,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;QAAE,GAAG,CAAC,UAAU,EAAE,CAAC;IAC5D,GAAG,CAAC,cAAc,CAChB,IAAI,uBAAc,CAAC;QACjB,SAAS,EAAE,IAAI;QACf,oBAAoB,EAAE,IAAI;QAC1B,SAAS,EAAE,IAAI;KAChB,CAAC,CACH,CAAC;IACF,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;AAC7C,CAAC;AACD,SAAS,EAAE,CAAC"}

File diff suppressed because one or more lines are too long

@ -1 +1 @@
{"version":3,"file":"change-password.dto.js","sourceRoot":"","sources":["../../../src/users/dto/change-password.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2E;AAE3E,MAAa,iBAAiB;IAEjB,eAAe,CAAS;IAIxB,WAAW,CAAS;CAChC;AAPD,8CAOC;AALY;IADR,IAAA,0BAAQ,GAAE;;0DACsB;AAIxB;IAFR,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;sDACgB"}
{"version":3,"file":"change-password.dto.js","sourceRoot":"","sources":["../../../src/users/dto/change-password.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAsD;AAEtD,MAAa,iBAAiB;IAEnB,eAAe,CAAS;IAIxB,WAAW,CAAS;CAC9B;AAPD,8CAOC;AALU;IADR,IAAA,0BAAQ,GAAE;;0DACsB;AAIxB;IAFR,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;sDACgB"}

@ -1 +1 @@
{"version":3,"file":"create-user.dto.js","sourceRoot":"","sources":["../../../src/users/dto/create-user.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2E;AAE3E,MAAa,aAAa;IAEb,IAAI,CAAS;IAIb,KAAK,CAAU;IAIf,QAAQ,CAAS;CAC7B;AAXD,sCAWC;AATY;IADR,IAAA,0BAAQ,GAAE;;2CACW;AAIb;IAFR,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;;4CACc;AAIf;IAFR,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;+CACa"}
{"version":3,"file":"create-user.dto.js","sourceRoot":"","sources":["../../../src/users/dto/create-user.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2E;AAE3E,MAAa,aAAa;IAEf,IAAI,CAAS;IAIb,KAAK,CAAU;IAIf,QAAQ,CAAS;CAC3B;AAXD,sCAWC;AATU;IADR,IAAA,0BAAQ,GAAE;;2CACW;AAIb;IAFR,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;;4CACc;AAIf;IAFR,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;+CACa"}

@ -1 +1 @@
{"version":3,"file":"user-info-response.dto.js","sourceRoot":"","sources":["../../../src/users/dto/user-info-response.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAmB;IAC5B,EAAE,CAAS;IACX,IAAI,CAAS;IACb,KAAK,CAAU;CAClB;AAJD,kDAIC"}
{"version":3,"file":"user-info-response.dto.js","sourceRoot":"","sources":["../../../src/users/dto/user-info-response.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAmB;IAC9B,EAAE,CAAS;IACX,IAAI,CAAS;IACb,KAAK,CAAU;CAChB;AAJD,kDAIC"}

@ -1,4 +1,4 @@
import { TimestampedEntity } from "src/common/entities/timestamped.entity";
import { TimestampedEntity } from 'src/common/entities/timestamped.entity';
export declare class User extends TimestampedEntity {
id: number;
name: string;

@ -1 +1 @@
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../src/users/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAA2E;AAC3E,qCAAiE;AAG1D,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,sCAAiB;IAEvC,EAAE,CAAS;IAGX,IAAI,CAAS;IAGb,KAAK,CAAU;IAGf,QAAQ,CAAS;CACpB,CAAA;AAZY,oBAAI;AAEb;IADC,IAAA,gCAAsB,GAAE;;gCACd;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;kCACZ;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mCAC1B;AAGf;IADC,IAAA,gBAAM,GAAE;;sCACQ;eAXR,IAAI;IADhB,IAAA,gBAAM,GAAE;GACI,IAAI,CAYhB"}
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../src/users/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8EAA2E;AAC3E,qCAAiE;AAG1D,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,sCAAiB;IAEzC,EAAE,CAAS;IAGX,IAAI,CAAS;IAGb,KAAK,CAAU;IAGf,QAAQ,CAAS;CAClB,CAAA;AAZY,oBAAI;AAEf;IADC,IAAA,gCAAsB,GAAE;;gCACd;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;kCACZ;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mCAC1B;AAGf;IADC,IAAA,gBAAM,GAAE;;sCACQ;eAXN,IAAI;IADhB,IAAA,gBAAM,GAAE;GACI,IAAI,CAYhB"}

@ -1,8 +1,9 @@
import { UsersService } from './users.service';
import { ChangePasswordDto } from './dto/change-password.dto';
import { SuccessResponseDto } from 'src/common/dto/sucees-response.dto';
import { AuthRequest } from 'src/common/interfaces/auth-request.interface';
export declare class UsersController {
private readonly userService;
constructor(userService: UsersService);
changePassword(req: any, dto: ChangePasswordDto): Promise<SuccessResponseDto>;
changePassword(req: AuthRequest, dto: ChangePasswordDto): Promise<SuccessResponseDto>;
}

@ -1 +1 @@
{"version":3,"file":"users.controller.js","sourceRoot":"","sources":["../../src/users/users.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA6E;AAC7E,mDAA+C;AAC/C,mEAA8D;AAC9D,2DAAuD;AACvD,2EAAwE;AAGjE,IAAM,eAAe,GAArB,MAAM,eAAe;IACK;IAA7B,YAA6B,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;IAAG,CAAC;IAI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,EAAC,OAAO,CAAC;qCAEwB,4BAAY;GAD3C,eAAe,CAY3B"}

@ -20,7 +20,7 @@ exports.UsersModule = UsersModule = __decorate([
imports: [typeorm_1.TypeOrmModule.forFeature([user_entity_1.User])],
providers: [users_service_1.UsersService],
controllers: [users_controller_1.UsersController],
exports: [users_service_1.UsersService]
exports: [users_service_1.UsersService],
})
], UsersModule);
//# sourceMappingURL=users.module.js.map

@ -1,10 +1,43 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
@ -17,7 +50,7 @@ const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const user_entity_1 = require("./user.entity");
const typeorm_2 = require("typeorm");
const bcrypt = require("bcrypt");
const bcrypt = __importStar(require("bcryptjs"));
let UsersService = class UsersService {
repo;
constructor(repo) {
@ -35,17 +68,17 @@ let UsersService = class UsersService {
async create(dto) {
const existing = await this.findByName(dto.name);
if (existing)
throw new common_1.BadRequestException("Already existed user");
throw new common_1.BadRequestException('Already existed user');
const user = this.repo.create(dto);
return this.repo.save(user);
}
async changePassword(userId, dto) {
const user = await this.repo.findOne({ where: { id: userId } });
if (!user)
throw new common_1.NotFoundException("User not found");
throw new common_1.NotFoundException('User not found');
const passwordValid = await bcrypt.compare(dto.currentPassword, user.password);
if (!passwordValid)
throw new common_1.UnauthorizedException("Not matched password");
throw new common_1.UnauthorizedException('Not matched password');
const hashed = await bcrypt.hash(dto.newPassword, 10);
user.password = hashed;
await this.repo.save(user);
@ -53,7 +86,7 @@ let UsersService = class UsersService {
async findUserInfoByIdOrFail(id) {
const user = await this.findById(id);
if (!user)
throw new common_1.NotFoundException("User not found");
throw new common_1.NotFoundException('User not found');
return {
id: user.id,
name: user.name,

@ -1 +1 @@
{"version":3,"file":"users.service.js","sourceRoot":"","sources":["../../src/users/users.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2G;AAC3G,6CAAmD;AACnD,+CAAqC;AACrC,qCAAqC;AAGrC,iCAAgC;AAIzB,IAAM,YAAY,GAAlB,MAAM,YAAY;IACuB;IAA5C,YAA4C,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAG,CAAC;IAEtE,KAAK,CAAC,QAAQ,CAAC,EAAU;QACrB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK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CAAC,EAAU;QACrC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,0BAAiB,CAAC,gBAAgB,CAAC,CAAC;QAEzD,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;CACF,CAAA;AA9CY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAEE,WAAA,IAAA,0BAAgB,EAAC,kBAAI,CAAC,CAAA;qCAAe,oBAAU;GADjD,YAAY,CA8CxB"}

@ -28,7 +28,13 @@ export default tseslint.config(
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn'
'@typescript-eslint/no-unsafe-argument': 'warn',
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
},
},
);
);

@ -18,6 +18,7 @@
"@nestjs/swagger": "^11.2.0",
"@nestjs/typeorm": "^11.0.0",
"bcrypt": "^6.0.0",
"bcryptjs": "^3.0.2",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.2",
"mysql2": "^3.14.2",
@ -39,13 +40,16 @@
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.7",
"@types/passport-jwt": "^4.0.1",
"@types/supertest": "^6.0.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-prettier": "^5.2.2",
"@typescript-eslint/eslint-plugin": "^8.37.0",
"@typescript-eslint/parser": "^8.37.0",
"eslint": "^9.31.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-prettier": "^5.5.1",
"globals": "^16.0.0",
"jest": "^29.7.0",
"prettier": "^3.4.2",
"prettier": "^3.6.2",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.2.5",
@ -3530,6 +3534,38 @@
"undici-types": "~6.21.0"
}
},
"node_modules/@types/passport": {
"version": "1.0.17",
"resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.17.tgz",
"integrity": "sha512-aciLyx+wDwT2t2/kJGJR2AEeBz0nJU4WuRX04Wu9Dqc5lSUtwu0WERPHYsLhF9PtseiAMPBGNUOtFjxZ56prsg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/express": "*"
}
},
"node_modules/@types/passport-jwt": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/passport-jwt/-/passport-jwt-4.0.1.tgz",
"integrity": "sha512-Y0Ykz6nWP4jpxgEUYq8NoVZeCQPo1ZndJLfapI249g1jHChvRfZRO/LS3tqu26YgAS/laI1qx98sYGz0IalRXQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/jsonwebtoken": "*",
"@types/passport-strategy": "*"
}
},
"node_modules/@types/passport-strategy": {
"version": "0.2.38",
"resolved": "https://registry.npmjs.org/@types/passport-strategy/-/passport-strategy-0.2.38.tgz",
"integrity": "sha512-GC6eMqqojOooq993Tmnmp7AUTbbQSgilyvpCYQjT+H6JfG/g6RGc7nXEniZlp0zyKJ0WUdOiZWLBZft9Yug1uA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/express": "*",
"@types/passport": "*"
}
},
"node_modules/@types/qs": {
"version": "6.14.0",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz",
@ -5117,6 +5153,15 @@
"node": ">= 18"
}
},
"node_modules/bcryptjs": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-3.0.2.tgz",
"integrity": "sha512-k38b3XOZKv60C4E2hVsXTolJWfkGRMbILBIe2IBITXciy5bOsTKot5kDrf3ZfufQtQOUN5mXceUEpU1rTl9Uog==",
"license": "BSD-3-Clause",
"bin": {
"bcrypt": "bin/bcrypt"
}
},
"node_modules/binary-version": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/binary-version/-/binary-version-7.1.0.tgz",

@ -29,6 +29,7 @@
"@nestjs/swagger": "^11.2.0",
"@nestjs/typeorm": "^11.0.0",
"bcrypt": "^6.0.0",
"bcryptjs": "^3.0.2",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.2",
"mysql2": "^3.14.2",
@ -50,13 +51,16 @@
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.7",
"@types/passport-jwt": "^4.0.1",
"@types/supertest": "^6.0.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-prettier": "^5.2.2",
"@typescript-eslint/eslint-plugin": "^8.37.0",
"@typescript-eslint/parser": "^8.37.0",
"eslint": "^9.31.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-prettier": "^5.5.1",
"globals": "^16.0.0",
"jest": "^29.7.0",
"prettier": "^3.4.2",
"prettier": "^3.6.2",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.2.5",

@ -10,11 +10,11 @@ import { JwtService } from '@nestjs/jwt';
@Module({
imports: [
ConfigModule.forRoot({ isGlobal: true }), // .env 불러오도록 설정
TypeOrmModule.forRootAsync({
ConfigModule.forRoot({ isGlobal: true }), // .env 불러오도록 설정
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (config: ConfigService) => ({
useFactory: (config: ConfigService) => ({
type: 'mysql',
host: config.get<string>('DB_HOST'),
port: parseInt(config.get<string>('DB_PORT', '3306'), 10),
@ -26,9 +26,11 @@ import { JwtService } from '@nestjs/jwt';
autoLoadEntities: true,
logging: true,
}),
}), AuthModule, UsersModule
}),
AuthModule,
UsersModule,
],
controllers: [AppController],
providers: [AppService, JwtService],
})
export class AppModule {}
export class AppModule {}

@ -7,27 +7,31 @@ import { LoginResponseDto } from './dto/login-response.dto';
import { UsersService } from 'src/users/users.service';
import { JwtAuthGuard } from './jwt-auth.guard';
import { UserInfoResponseDto } from 'src/users/dto/user-info-response.dto';
import { AuthRequest } from 'src/common/interfaces/auth-request.interface';
@Controller('auth')
export class AuthController {
constructor(private readonly authService: AuthService, private userService: UsersService) {}
constructor(
private readonly authService: AuthService,
private userService: UsersService,
) {}
@Post('signup')
async signup(@Body() dto: CreateUserDto): Promise<SuccessResponseDto> {
const user = await this.authService.signup(dto);
return SuccessResponseDto.ok();
}
@Post('signup')
async signup(@Body() dto: CreateUserDto): Promise<SuccessResponseDto> {
await this.authService.signup(dto);
return SuccessResponseDto.ok();
}
@Post('login')
async login(@Body() dto: LoginUserDto): Promise<SuccessResponseDto<LoginResponseDto>> {
const loginUser = await this.authService.login(dto);
return SuccessResponseDto.of(loginUser);
}
@Post('login')
async login(@Body() dto: LoginUserDto): Promise<SuccessResponseDto<LoginResponseDto>> {
const loginUser = await this.authService.login(dto);
return SuccessResponseDto.of(loginUser);
}
@Get('me')
@UseGuards(JwtAuthGuard)
async getMe(@Request() req): Promise<SuccessResponseDto<UserInfoResponseDto>> {
const userInfo = await this.userService.findUserInfoByIdOrFail(req.user.userId);
return SuccessResponseDto.of(userInfo);
}
@Get('me')
@UseGuards(JwtAuthGuard)
async getMe(@Request() req: AuthRequest): Promise<SuccessResponseDto<UserInfoResponseDto>> {
const userInfo = await this.userService.findUserInfoByIdOrFail(req.user.userId);
return SuccessResponseDto.of(userInfo);
}
}

@ -15,15 +15,15 @@ import { JwtStrategy } from './jwt.stratedy';
JwtModule.registerAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (configService: ConfigService) => ({
useFactory: (configService: ConfigService) => ({
secret: configService.get<string>('JWT_SECRET'),
signOptions: {
expiresIn: configService.get<string>('JWT_EXPIRES_IN') || '1h',
},
}),
})
}),
],
providers: [AuthService, JwtStrategy],
controllers: [AuthController]
controllers: [AuthController],
})
export class AuthModule {}

@ -1,34 +1,38 @@
import { BadRequestException, Injectable, InternalServerErrorException, UnauthorizedException } from '@nestjs/common';
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { UsersService } from 'src/users/users.service';
import * as bcrypt from 'bcrypt'
import * as bcrypt from 'bcryptjs';
import { LoginUserDto } from 'src/auth/dto/login-user.dto';
import { CreateUserDto } from 'src/users/dto/create-user.dto';
import { LoginResponseDto } from './dto/login-response.dto';
@Injectable()
export class AuthService {
constructor(private userService: UsersService, private jwtService: JwtService) {}
constructor(
private userService: UsersService,
private jwtService: JwtService,
) {}
async signup(dto: CreateUserDto) {
const hashed = await bcrypt.hash(dto.password, 10);
return this.userService.create({ ...dto, password: hashed });
}
async signup(dto: CreateUserDto) {
const hashed: string = await bcrypt.hash(dto.password, 10);
return this.userService.create({ ...dto, password: hashed });
}
async login(dto: LoginUserDto): Promise<LoginResponseDto> {
const user = await this.userService.findByName(dto.name);
if (!user || !await bcrypt.compare(dto.password, user.password)) throw new UnauthorizedException('Login failed');
async login(dto: LoginUserDto): Promise<LoginResponseDto> {
const user = await this.userService.findByName(dto.name);
if (!user || !(await bcrypt.compare(dto.password, user.password)))
throw new UnauthorizedException('Login failed');
const payload = { username: user.name, sub: user.id };
const token = this.jwtService.sign(payload);
return {
access_token: token,
user: {
id: user.id,
name: user.name,
email: user.email,
}
};
}
const payload = { username: user.name, sub: user.id };
const token = this.jwtService.sign(payload);
return {
access_token: token,
user: {
id: user.id,
name: user.name,
email: user.email,
},
};
}
}

@ -1,6 +1,6 @@
import { UserInfoResponseDto } from "src/users/dto/user-info-response.dto";
import { UserInfoResponseDto } from 'src/users/dto/user-info-response.dto';
export class LoginResponseDto {
access_token: string;
user: UserInfoResponseDto;
}
access_token: string;
user: UserInfoResponseDto;
}

@ -1,10 +1,10 @@
import { IsString, MinLength } from "class-validator";
import { IsString, MinLength } from 'class-validator';
export class LoginUserDto {
@IsString()
readonly name: string;
@IsString()
readonly name: string;
@IsString()
@MinLength(4)
readonly password: string;
}
@IsString()
@MinLength(4)
readonly password: string;
}

@ -1,5 +1,5 @@
import { Injectable } from "@nestjs/common";
import { AuthGuard } from "@nestjs/passport";
import { Injectable } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
@Injectable()
export class JwtAuthGuard extends AuthGuard('jwt') {}
export class JwtAuthGuard extends AuthGuard('jwt') {}

@ -2,18 +2,21 @@ import { Injectable } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { ExtractJwt, Strategy } from 'passport-jwt';
import { ConfigService } from '@nestjs/config';
import { JwtPayload } from 'src/common/interfaces/jwt-payload.interface';
@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor(config: ConfigService) {
// eslint-disable-next-line
super({
// eslint-disable-next-line
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), // Authorization: Bearer ...
ignoreExpiration: false,
secretOrKey: config.get<string>('JWT_SECRET'),
secretOrKey: config.get<string>('JWT_SECRET')!,
});
}
async validate(payload: any) {
validate(payload: JwtPayload) {
return { userId: payload.sub, username: payload.username };
}
}

@ -1,20 +1,20 @@
export class SuccessResponseDto<T = any> {
success: boolean;
message?: string;
data?: T;
success: boolean;
message?: string;
data?: T;
static of<T>(data: T, message?: string): SuccessResponseDto<T> {
return {
success: true,
data,
message,
};
}
static of<T>(data: T, message?: string): SuccessResponseDto<T> {
return {
success: true,
data,
message,
};
}
static ok(message?: string): SuccessResponseDto<null> {
return {
success: true,
message,
};
}
}
static ok(message?: string): SuccessResponseDto<null> {
return {
success: true,
message,
};
}
}

@ -1,9 +1,9 @@
import { CreateDateColumn, UpdateDateColumn } from "typeorm";
import { CreateDateColumn, UpdateDateColumn } from 'typeorm';
export abstract class TimestampedEntity {
@CreateDateColumn({ type: 'timestamp' })
createdAt: Date;
@CreateDateColumn({ type: 'timestamp' })
createdAt: Date;
@UpdateDateColumn({ type: 'timestamp' })
updatedAt: Date;
}
@UpdateDateColumn({ type: 'timestamp' })
updatedAt: Date;
}

@ -0,0 +1,6 @@
export interface AuthRequest extends Request {
user: {
userId: number;
username: string;
};
}

@ -0,0 +1,4 @@
export interface JwtPayload {
sub: number;
username: string;
}

@ -4,13 +4,13 @@ import { ValidationPipe } from '@nestjs/common';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.enableCors();
if (process.env.NODE_ENV !== 'production') app.enableCors();
app.useGlobalPipes(
new ValidationPipe({
whitelist: true, // DTO 정의된 속성만 허용
forbidNonWhitelisted: true, // DTO 없는 속성 들어오면 에러
transform: true, // 자동 타입 변환
})
}),
);
await app.listen(process.env.PORT ?? 3000);
}

@ -1,10 +1,10 @@
import { IsEmail, IsOptional, IsString, MinLength } from "class-validator";
import { IsString, MinLength } from 'class-validator';
export class ChangePasswordDto {
@IsString()
readonly currentPassword: string;
@IsString()
readonly currentPassword: string;
@IsString()
@MinLength(4)
readonly newPassword: string;
}
@IsString()
@MinLength(4)
readonly newPassword: string;
}

@ -1,14 +1,14 @@
import { IsEmail, IsOptional, IsString, MinLength } from "class-validator";
import { IsEmail, IsOptional, IsString, MinLength } from 'class-validator';
export class CreateUserDto {
@IsString()
readonly name: string;
@IsString()
readonly name: string;
@IsOptional()
@IsEmail()
readonly email?: string;
@IsOptional()
@IsEmail()
readonly email?: string;
@IsString()
@MinLength(4)
readonly password: string;
}
@IsString()
@MinLength(4)
readonly password: string;
}

@ -1,5 +1,5 @@
export class UserInfoResponseDto {
id: number;
name: string;
email?: string;
}
id: number;
name: string;
email?: string;
}

@ -1,17 +1,17 @@
import { TimestampedEntity } from "src/common/entities/timestamped.entity";
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
import { TimestampedEntity } from 'src/common/entities/timestamped.entity';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
@Entity()
export class User extends TimestampedEntity {
@PrimaryGeneratedColumn()
id: number;
@PrimaryGeneratedColumn()
id: number;
@Column({ unique: true })
name: string;
@Column({ unique: true })
name: string;
@Column({ unique: true, nullable: true })
email?: string;
@Column({ unique: true, nullable: true })
email?: string;
@Column()
password: string;
}
@Column()
password: string;
}

@ -3,15 +3,19 @@ import { UsersService } from './users.service';
import { ChangePasswordDto } from './dto/change-password.dto';
import { JwtAuthGuard } from 'src/auth/jwt-auth.guard';
import { SuccessResponseDto } from 'src/common/dto/sucees-response.dto';
import { AuthRequest } from 'src/common/interfaces/auth-request.interface';
@Controller('users')
export class UsersController {
constructor(private readonly userService: UsersService) {}
constructor(private readonly userService: UsersService) {}
@UseGuards(JwtAuthGuard)
@Patch('password')
async changePassword(@Request() req, @Body() dto: ChangePasswordDto): Promise<SuccessResponseDto> {
await this.userService.changePassword(req.user.userId, dto);
return SuccessResponseDto.ok();
}
@UseGuards(JwtAuthGuard)
@Patch('password')
async changePassword(
@Request() req: AuthRequest,
@Body() dto: ChangePasswordDto,
): Promise<SuccessResponseDto> {
await this.userService.changePassword(req.user.userId, dto);
return SuccessResponseDto.ok();
}
}

@ -8,6 +8,6 @@ import { UsersController } from './users.controller';
imports: [TypeOrmModule.forFeature([User])],
providers: [UsersService],
controllers: [UsersController],
exports: [UsersService]
exports: [UsersService],
})
export class UsersModule {}

@ -1,57 +1,62 @@
import { BadRequestException, Injectable, NotFoundException, UnauthorizedException } from '@nestjs/common';
import {
BadRequestException,
Injectable,
NotFoundException,
UnauthorizedException,
} from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { User } from './user.entity';
import { Repository } from 'typeorm';
import { CreateUserDto } from './dto/create-user.dto';
import { ChangePasswordDto } from './dto/change-password.dto';
import * as bcrypt from "bcrypt"
import * as bcrypt from 'bcryptjs';
import { UserInfoResponseDto } from './dto/user-info-response.dto';
@Injectable()
export class UsersService {
constructor(@InjectRepository(User) private repo: Repository<User>) {}
constructor(@InjectRepository(User) private repo: Repository<User>) {}
async findById(id: number): Promise<User | null> {
return await this.repo.findOne({ where: { id }});
}
async findById(id: number): Promise<User | null> {
return await this.repo.findOne({ where: { id } });
}
async findByName(name: string): Promise<User | null> {
return await this.repo.findOne({ where: { name }});
}
async findByName(name: string): Promise<User | null> {
return await this.repo.findOne({ where: { name } });
}
async findByEmail(email: string): Promise<User | null> {
return await this.repo.findOne({ where: { email }});
}
async findByEmail(email: string): Promise<User | null> {
return await this.repo.findOne({ where: { email } });
}
async create(dto: CreateUserDto): Promise<User> {
const existing = await this.findByName(dto.name);
if (existing) throw new BadRequestException("Already existed user");
async create(dto: CreateUserDto): Promise<User> {
const existing = await this.findByName(dto.name);
if (existing) throw new BadRequestException('Already existed user');
const user = this.repo.create(dto);
return this.repo.save(user);
}
const user = this.repo.create(dto);
return this.repo.save(user);
}
async changePassword(userId: number, dto: ChangePasswordDto): Promise<void> {
const user = await this.repo.findOne({ where: { id: userId } });
if (!user) throw new NotFoundException("User not found");
async changePassword(userId: number, dto: ChangePasswordDto): Promise<void> {
const user = await this.repo.findOne({ where: { id: userId } });
if (!user) throw new NotFoundException('User not found');
const passwordValid = await bcrypt.compare(dto.currentPassword, user.password);
if (!passwordValid) throw new UnauthorizedException("Not matched password");
const passwordValid = await bcrypt.compare(dto.currentPassword, user.password);
if (!passwordValid) throw new UnauthorizedException('Not matched password');
const hashed = await bcrypt.hash(dto.newPassword, 10);
user.password = hashed;
const hashed = await bcrypt.hash(dto.newPassword, 10);
user.password = hashed;
await this.repo.save(user);
}
await this.repo.save(user);
}
async findUserInfoByIdOrFail(id: number): Promise<UserInfoResponseDto> {
const user = await this.findById(id);
if (!user) throw new NotFoundException("User not found");
async findUserInfoByIdOrFail(id: number): Promise<UserInfoResponseDto> {
const user = await this.findById(id);
if (!user) throw new NotFoundException('User not found');
return {
id: user.id,
name: user.name,
email: user.email,
};
}
return {
id: user.id,
name: user.name,
email: user.email,
};
}
}

@ -1,10 +0,0 @@
NODE_ENV=development
DB_HOST=localhost
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=init00!!
DB_DATABASE=boilerplate_db
JWT_SECRET=jwt-secret
JWT_EXPIRES_IN=1h

@ -1,4 +0,0 @@
{
"singleQuote": true,
"trailingComma": "all"
}

@ -1,22 +0,0 @@
{
// IntelliSense .
// .
// https://go.microsoft.com/fwlink/?linkid=830387() .
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug NestJS", //
"runtimeExecutable": "npm", //
"runtimeArgs": [
// npm run start:debug
"run",
"start:debug",
],
"console": "integratedTerminal", //
"restart": true,
"autoAttachChildProcesses": true
}
]
}

@ -1,98 +0,0 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
</p>
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
## Description
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
## Project setup
```bash
$ npm install
```
## Compile and run the project
```bash
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
```
## Run tests
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
```
## Deployment
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
```bash
$ npm install -g @nestjs/mau
$ mau deploy
```
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
## Resources
Check out a few resources that may come in handy when working with NestJS:
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
## Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
## Stay in touch
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)
## License
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).

@ -1,6 +0,0 @@
import { AppService } from './app.service';
export declare class AppController {
private readonly appService;
constructor(appService: AppService);
getHello(): string;
}

@ -1,35 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppController = void 0;
const common_1 = require("@nestjs/common");
const app_service_1 = require("./app.service");
let AppController = class AppController {
appService;
constructor(appService) {
this.appService = appService;
}
getHello() {
return this.appService.getHello();
}
};
exports.AppController = AppController;
__decorate([
(0, common_1.Get)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", String)
], AppController.prototype, "getHello", null);
exports.AppController = AppController = __decorate([
(0, common_1.Controller)(),
__metadata("design:paramtypes", [app_service_1.AppService])
], AppController);
//# sourceMappingURL=app.controller.js.map

@ -1 +0,0 @@
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiD;AACjD,+CAA2C;AAGpC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACK;IAA7B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAGvD,QAAQ;QACN,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AAPY,sCAAa;AAIxB;IADC,IAAA,YAAG,GAAE;;;;6CAGL;wBANU,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAE8B,wBAAU;GADxC,aAAa,CAOzB"}

@ -1,2 +0,0 @@
export declare class AppModule {
}

@ -1,47 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppModule = void 0;
const common_1 = require("@nestjs/common");
const app_controller_1 = require("./app.controller");
const app_service_1 = require("./app.service");
const config_1 = require("@nestjs/config");
const typeorm_1 = require("@nestjs/typeorm");
const path_1 = require("path");
const auth_module_1 = require("./auth/auth.module");
const users_module_1 = require("./users/users.module");
const jwt_1 = require("@nestjs/jwt");
let AppModule = class AppModule {
};
exports.AppModule = AppModule;
exports.AppModule = AppModule = __decorate([
(0, common_1.Module)({
imports: [
config_1.ConfigModule.forRoot({ isGlobal: true }),
typeorm_1.TypeOrmModule.forRootAsync({
imports: [config_1.ConfigModule],
inject: [config_1.ConfigService],
useFactory: async (config) => ({
type: 'mysql',
host: config.get('DB_HOST'),
port: parseInt(config.get('DB_PORT', '3306'), 10),
username: config.get('DB_USERNAME'),
password: config.get('DB_PASSWORD'),
database: config.get('DB_DATABASE'),
entities: [(0, path_1.join)(__dirname, '**', '*.entity.{ts,js}')],
synchronize: config.get('NODE_ENV') !== 'production',
autoLoadEntities: true,
logging: true,
}),
}), auth_module_1.AuthModule, users_module_1.UsersModule
],
controllers: [app_controller_1.AppController],
providers: [app_service_1.AppService, jwt_1.JwtService],
})
], AppModule);
//# sourceMappingURL=app.module.js.map

@ -1 +0,0 @@
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,+CAA2C;AAC3C,2CAA6D;AAC7D,6CAAgD;AAChD,+BAA4B;AAC5B,oDAAgD;AAChD,uDAAmD;AACnD,qCAAyC;AAyBlC,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IAvBrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACL,qBAAY,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YACxC,uBAAa,CAAC,YAAY,CAAC;gBAC3B,OAAO,EAAE,CAAC,qBAAY,CAAC;gBACvB,MAAM,EAAE,CAAC,sBAAa,CAAC;gBACvB,UAAU,EAAE,KAAK,EAAE,MAAqB,EAAE,EAAE,CAAC,CAAC;oBAC5C,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,MAAM,CAAC,GAAG,CAAS,SAAS,CAAC;oBACnC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAS,SAAS,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;oBACzD,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAS,aAAa,CAAC;oBAC3C,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAS,aAAa,CAAC;oBAC3C,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAS,aAAa,CAAC;oBAC3C,QAAQ,EAAE,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;oBACrD,WAAW,EAAE,MAAM,CAAC,GAAG,CAAS,UAAU,CAAC,KAAK,YAAY;oBAC5D,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE,IAAI;iBACd,CAAC;aACH,CAAC,EAAE,wBAAU,EAAE,0BAAW;SAC5B;QACD,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,EAAE,gBAAU,CAAC;KACpC,CAAC;GACW,SAAS,CAAG"}

@ -1,3 +0,0 @@
export declare class AppService {
getHello(): string;
}

@ -1,20 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppService = void 0;
const common_1 = require("@nestjs/common");
let AppService = class AppService {
getHello() {
return 'Hello World!';
}
};
exports.AppService = AppService;
exports.AppService = AppService = __decorate([
(0, common_1.Injectable)()
], AppService);
//# sourceMappingURL=app.service.js.map

@ -1 +0,0 @@
{"version":3,"file":"app.service.js","sourceRoot":"","sources":["../src/app.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAGrC,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,QAAQ;QACN,OAAO,cAAc,CAAC;IACxB,CAAC;CACF,CAAA;AAJY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;GACA,UAAU,CAItB"}

@ -1,15 +0,0 @@
import { AuthService } from './auth.service';
import { CreateUserDto } from 'src/users/dto/create-user.dto';
import { LoginUserDto } from 'src/auth/dto/login-user.dto';
import { SuccessResponseDto } from 'src/common/dto/sucees-response.dto';
import { LoginResponseDto } from './dto/login-response.dto';
import { UsersService } from 'src/users/users.service';
import { UserInfoResponseDto } from 'src/users/dto/user-info-response.dto';
export declare class AuthController {
private readonly authService;
private userService;
constructor(authService: AuthService, userService: UsersService);
signup(dto: CreateUserDto): Promise<SuccessResponseDto>;
login(dto: LoginUserDto): Promise<SuccessResponseDto<LoginResponseDto>>;
getMe(req: any): Promise<SuccessResponseDto<UserInfoResponseDto>>;
}

@ -1,70 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthController = void 0;
const common_1 = require("@nestjs/common");
const auth_service_1 = require("./auth.service");
const create_user_dto_1 = require("../users/dto/create-user.dto");
const login_user_dto_1 = require("./dto/login-user.dto");
const sucees_response_dto_1 = require("../common/dto/sucees-response.dto");
const users_service_1 = require("../users/users.service");
const jwt_auth_guard_1 = require("./jwt-auth.guard");
let AuthController = class AuthController {
authService;
userService;
constructor(authService, userService) {
this.authService = authService;
this.userService = userService;
}
async signup(dto) {
const user = await this.authService.signup(dto);
return sucees_response_dto_1.SuccessResponseDto.ok();
}
async login(dto) {
const loginUser = await this.authService.login(dto);
return sucees_response_dto_1.SuccessResponseDto.of(loginUser);
}
async getMe(req) {
const userInfo = await this.userService.findUserInfoByIdOrFail(req.user.userId);
return sucees_response_dto_1.SuccessResponseDto.of(userInfo);
}
};
exports.AuthController = AuthController;
__decorate([
(0, common_1.Post)('signup'),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [create_user_dto_1.CreateUserDto]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "signup", null);
__decorate([
(0, common_1.Post)('login'),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [login_user_dto_1.LoginUserDto]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "login", null);
__decorate([
(0, common_1.Get)('me'),
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
__param(0, (0, common_1.Request)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], AuthController.prototype, "getMe", null);
exports.AuthController = AuthController = __decorate([
(0, common_1.Controller)('auth'),
__metadata("design:paramtypes", [auth_service_1.AuthService, users_service_1.UsersService])
], AuthController);
//# sourceMappingURL=auth.controller.js.map

@ -1 +0,0 @@
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiF;AACjF,iDAA6C;AAC7C,kEAA8D;AAC9D,yDAA2D;AAC3D,2EAAwE;AAExE,0DAAuD;AACvD,qDAAgD;AAIzC,IAAM,cAAc,GAApB,MAAM,cAAc;IACM;IAAkC;IAA/D,YAA6B,WAAwB,EAAU,WAAyB;QAA3D,gBAAW,GAAX,WAAW,CAAa;QAAU,gBAAW,GAAX,WAAW,CAAc;IAAG,CAAC;IAGtF,AAAN,KAAK,CAAC,MAAM,CAAS,GAAkB;QACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChD,OAAO,wCAAkB,CAAC,EAAE,EAAE,CAAC;IACnC,CAAC;IAGK,AAAN,KAAK,CAAC,KAAK,CAAS,GAAiB;QACjC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpD,OAAO,wCAAkB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IAIK,AAAN,KAAK,CAAC,KAAK,CAAY,GAAG;QACtB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChF,OAAO,wCAAkB,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;CACJ,CAAA;AArBY,wCAAc;AAIjB;IADL,IAAA,aAAI,EAAC,QAAQ,CAAC;IACD,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,+BAAa;;4CAGtC;AAGK;IADL,IAAA,aAAI,EAAC,OAAO,CAAC;IACD,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,6BAAY;;2CAGpC;AAIK;IAFL,IAAA,YAAG,EAAC,IAAI,CAAC;IACT,IAAA,kBAAS,EAAC,6BAAY,CAAC;IACX,WAAA,IAAA,gBAAO,GAAE,CAAA;;;;2CAGrB;yBApBQ,cAAc;IAD1B,IAAA,mBAAU,EAAC,MAAM,CAAC;qCAE2B,0BAAW,EAAuB,4BAAY;GAD/E,cAAc,CAqB1B"}

@ -1,2 +0,0 @@
export declare class AuthModule {
}

@ -1,42 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthModule = void 0;
const common_1 = require("@nestjs/common");
const auth_service_1 = require("./auth.service");
const auth_controller_1 = require("./auth.controller");
const users_module_1 = require("../users/users.module");
const jwt_1 = require("@nestjs/jwt");
const config_1 = require("@nestjs/config");
const passport_1 = require("@nestjs/passport");
const jwt_stratedy_1 = require("./jwt.stratedy");
let AuthModule = class AuthModule {
};
exports.AuthModule = AuthModule;
exports.AuthModule = AuthModule = __decorate([
(0, common_1.Module)({
imports: [
users_module_1.UsersModule,
passport_1.PassportModule,
config_1.ConfigModule,
jwt_1.JwtModule.registerAsync({
imports: [config_1.ConfigModule],
inject: [config_1.ConfigService],
useFactory: async (configService) => ({
secret: configService.get('JWT_SECRET'),
signOptions: {
expiresIn: configService.get('JWT_EXPIRES_IN') || '1h',
},
}),
})
],
providers: [auth_service_1.AuthService, jwt_stratedy_1.JwtStrategy],
controllers: [auth_controller_1.AuthController]
})
], AuthModule);
//# sourceMappingURL=auth.module.js.map

@ -1 +0,0 @@
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iDAA6C;AAC7C,uDAAmD;AACnD,wDAAqD;AACrD,qCAAwC;AACxC,2CAA6D;AAC7D,+CAAkD;AAClD,iDAA6C;AAqBtC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAnBtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,0BAAW;YACX,yBAAc;YACd,qBAAY;YACZ,eAAS,CAAC,aAAa,CAAC;gBACtB,OAAO,EAAE,CAAC,qBAAY,CAAC;gBACvB,MAAM,EAAE,CAAC,sBAAa,CAAC;gBACvB,UAAU,EAAE,KAAK,EAAE,aAA4B,EAAE,EAAE,CAAC,CAAC;oBACnD,MAAM,EAAE,aAAa,CAAC,GAAG,CAAS,YAAY,CAAC;oBAC/C,WAAW,EAAE;wBACX,SAAS,EAAE,aAAa,CAAC,GAAG,CAAS,gBAAgB,CAAC,IAAI,IAAI;qBAC/D;iBACF,CAAC;aACH,CAAC;SACH;QACD,SAAS,EAAE,CAAC,0BAAW,EAAE,0BAAW,CAAC;QACrC,WAAW,EAAE,CAAC,gCAAc,CAAC;KAC9B,CAAC;GACW,UAAU,CAAG"}

@ -1,12 +0,0 @@
import { JwtService } from '@nestjs/jwt';
import { UsersService } from 'src/users/users.service';
import { LoginUserDto } from 'src/auth/dto/login-user.dto';
import { CreateUserDto } from 'src/users/dto/create-user.dto';
import { LoginResponseDto } from './dto/login-response.dto';
export declare class AuthService {
private userService;
private jwtService;
constructor(userService: UsersService, jwtService: JwtService);
signup(dto: CreateUserDto): Promise<import("../users/user.entity").User>;
login(dto: LoginUserDto): Promise<LoginResponseDto>;
}

@ -1,49 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthService = void 0;
const common_1 = require("@nestjs/common");
const jwt_1 = require("@nestjs/jwt");
const users_service_1 = require("../users/users.service");
const bcrypt = require("bcrypt");
let AuthService = class AuthService {
userService;
jwtService;
constructor(userService, jwtService) {
this.userService = userService;
this.jwtService = jwtService;
}
async signup(dto) {
const hashed = await bcrypt.hash(dto.password, 10);
return this.userService.create({ ...dto, password: hashed });
}
async login(dto) {
const user = await this.userService.findByName(dto.name);
if (!user || !await bcrypt.compare(dto.password, user.password))
throw new common_1.UnauthorizedException('Login failed');
const payload = { username: user.name, sub: user.id };
const token = this.jwtService.sign(payload);
return {
access_token: token,
user: {
id: user.id,
name: user.name,
email: user.email,
}
};
}
};
exports.AuthService = AuthService;
exports.AuthService = AuthService = __decorate([
(0, common_1.Injectable)(),
__metadata("design:paramtypes", [users_service_1.UsersService, jwt_1.JwtService])
], AuthService);
//# sourceMappingURL=auth.service.js.map

@ -1 +0,0 @@
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsH;AACtH,qCAAyC;AACzC,0DAAuD;AACvD,iCAAgC;AAMzB,IAAM,WAAW,GAAjB,MAAM,WAAW;IACA;IAAmC;IAAvD,YAAoB,WAAyB,EAAU,UAAsB;QAAzD,gBAAW,GAAX,WAAW,CAAc;QAAU,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEjF,KAAK,CAAC,MAAM,CAAC,GAAkB;QAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAiB;QACzB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,8BAAqB,CAAC,cAAc,CAAC,CAAC;QAEjH,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5C,OAAO;YACH,YAAY,EAAE,KAAK;YACnB,IAAI,EAAE;gBACF,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,KAAK,EAAE,IAAI,CAAC,KAAK;aACpB;SACJ,CAAC;IACV,CAAC;CACJ,CAAA;AAxBY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAEwB,4BAAY,EAAsB,gBAAU;GADpE,WAAW,CAwBvB"}

@ -1,5 +0,0 @@
import { UserInfoResponseDto } from "src/users/dto/user-info-response.dto";
export declare class LoginResponseDto {
access_token: string;
user: UserInfoResponseDto;
}

@ -1,9 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoginResponseDto = void 0;
class LoginResponseDto {
access_token;
user;
}
exports.LoginResponseDto = LoginResponseDto;
//# sourceMappingURL=login-response.dto.js.map

@ -1 +0,0 @@
{"version":3,"file":"login-response.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/login-response.dto.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IACzB,YAAY,CAAS;IACrB,IAAI,CAAsB;CAC7B;AAHD,4CAGC"}

@ -1,4 +0,0 @@
export declare class LoginUserDto {
readonly name: string;
readonly password: string;
}

@ -1,28 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoginUserDto = void 0;
const class_validator_1 = require("class-validator");
class LoginUserDto {
name;
password;
}
exports.LoginUserDto = LoginUserDto;
__decorate([
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LoginUserDto.prototype, "name", void 0);
__decorate([
(0, class_validator_1.IsString)(),
(0, class_validator_1.MinLength)(4),
__metadata("design:type", String)
], LoginUserDto.prototype, "password", void 0);
//# sourceMappingURL=login-user.dto.js.map

@ -1 +0,0 @@
{"version":3,"file":"login-user.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/login-user.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAsD;AAEtD,MAAa,YAAY;IAEZ,IAAI,CAAS;IAIb,QAAQ,CAAS;CAC7B;AAPD,oCAOC;AALY;IADR,IAAA,0BAAQ,GAAE;;0CACW;AAIb;IAFR,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;;8CACa"}

@ -1,4 +0,0 @@
declare const JwtAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
export declare class JwtAuthGuard extends JwtAuthGuard_base {
}
export {};

@ -1,18 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JwtAuthGuard = void 0;
const common_1 = require("@nestjs/common");
const passport_1 = require("@nestjs/passport");
let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
};
exports.JwtAuthGuard = JwtAuthGuard;
exports.JwtAuthGuard = JwtAuthGuard = __decorate([
(0, common_1.Injectable)()
], JwtAuthGuard);
//# sourceMappingURL=jwt-auth.guard.js.map

@ -1 +0,0 @@
{"version":3,"file":"jwt-auth.guard.js","sourceRoot":"","sources":["../../src/auth/jwt-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAGtC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;CAAG,CAAA;AAAxC,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAA4B"}

@ -1,10 +0,0 @@
import { ConfigService } from '@nestjs/config';
declare const JwtStrategy_base: new (...args: any) => any;
export declare class JwtStrategy extends JwtStrategy_base {
constructor(config: ConfigService);
validate(payload: any): Promise<{
userId: any;
username: any;
}>;
}
export {};

@ -1,34 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JwtStrategy = void 0;
const common_1 = require("@nestjs/common");
const passport_1 = require("@nestjs/passport");
const passport_jwt_1 = require("passport-jwt");
const config_1 = require("@nestjs/config");
let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy) {
constructor(config) {
super({
jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration: false,
secretOrKey: config.get('JWT_SECRET'),
});
}
async validate(payload) {
return { userId: payload.sub, username: payload.username };
}
};
exports.JwtStrategy = JwtStrategy;
exports.JwtStrategy = JwtStrategy = __decorate([
(0, common_1.Injectable)(),
__metadata("design:paramtypes", [config_1.ConfigService])
], JwtStrategy);
//# sourceMappingURL=jwt.stratedy.js.map

@ -1 +0,0 @@
{"version":3,"file":"jwt.stratedy.js","sourceRoot":"","sources":["../../src/auth/jwt.stratedy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAAoD;AACpD,+CAAoD;AACpD,2CAA+C;AAGxC,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IACzD,YAAY,MAAqB;QAC/B,KAAK,CAAC;YACJ,cAAc,EAAE,yBAAU,CAAC,2BAA2B,EAAE;YACxD,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,MAAM,CAAC,GAAG,CAAS,YAAY,CAAC;SAC9C,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAY;QACzB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;CACF,CAAA;AAZY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAES,sBAAa;GADtB,WAAW,CAYvB"}

@ -1,7 +0,0 @@
export declare class SuccessResponseDto<T = any> {
success: boolean;
message?: string;
data?: T;
static of<T>(data: T, message?: string): SuccessResponseDto<T>;
static ok(message?: string): SuccessResponseDto<null>;
}

@ -1,23 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SuccessResponseDto = void 0;
class SuccessResponseDto {
success;
message;
data;
static of(data, message) {
return {
success: true,
data,
message,
};
}
static ok(message) {
return {
success: true,
message,
};
}
}
exports.SuccessResponseDto = SuccessResponseDto;
//# sourceMappingURL=sucees-response.dto.js.map

@ -1 +0,0 @@
{"version":3,"file":"sucees-response.dto.js","sourceRoot":"","sources":["../../../src/common/dto/sucees-response.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;IAC3B,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,IAAI,CAAK;IAET,MAAM,CAAC,EAAE,CAAI,IAAO,EAAE,OAAgB;QAClC,OAAO;YACH,OAAO,EAAE,IAAI;YACb,IAAI;YACJ,OAAO;SACV,CAAC;IACN,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,OAAgB;QACtB,OAAO;YACH,OAAO,EAAE,IAAI;YACb,OAAO;SACV,CAAC;IACN,CAAC;CACJ;AAnBD,gDAmBC"}

@ -1,4 +0,0 @@
export declare abstract class TimestampedEntity {
createdAt: Date;
updatedAt: Date;
}

@ -1,27 +0,0 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimestampedEntity = void 0;
const typeorm_1 = require("typeorm");
class TimestampedEntity {
createdAt;
updatedAt;
}
exports.TimestampedEntity = TimestampedEntity;
__decorate([
(0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
__metadata("design:type", Date)
], TimestampedEntity.prototype, "createdAt", void 0);
__decorate([
(0, typeorm_1.UpdateDateColumn)({ type: 'timestamp' }),
__metadata("design:type", Date)
], TimestampedEntity.prototype, "updatedAt", void 0);
//# sourceMappingURL=timestamped.entity.js.map

@ -1 +0,0 @@
{"version":3,"file":"timestamped.entity.js","sourceRoot":"","sources":["../../../src/common/entities/timestamped.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA6D;AAE7D,MAAsB,iBAAiB;IAEnC,SAAS,CAAO;IAGhB,SAAS,CAAO;CACnB;AAND,8CAMC;AAJG;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BAC7B,IAAI;oDAAC;AAGhB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BAC7B,IAAI;oDAAC"}

@ -1 +0,0 @@
export {};

@ -1,17 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@nestjs/core");
const app_module_1 = require("./app.module");
const common_1 = require("@nestjs/common");
async function bootstrap() {
const app = await core_1.NestFactory.create(app_module_1.AppModule);
app.enableCors();
app.useGlobalPipes(new common_1.ValidationPipe({
whitelist: true,
forbidNonWhitelisted: true,
transform: true,
}));
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();
//# sourceMappingURL=main.js.map

@ -1 +0,0 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AACzC,2CAAgD;AAEhD,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,GAAG,CAAC,UAAU,EAAE,CAAC;IACjB,GAAG,CAAC,cAAc,CAChB,IAAI,uBAAc,CAAC;QACjB,SAAS,EAAE,IAAI;QACf,oBAAoB,EAAE,IAAI;QAC1B,SAAS,EAAE,IAAI;KAChB,CAAC,CACH,CAAA;IACD,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;AAC7C,CAAC;AACD,SAAS,EAAE,CAAC"}

File diff suppressed because one or more lines are too long

@ -1,4 +0,0 @@
export declare class ChangePasswordDto {
readonly currentPassword: string;
readonly newPassword: string;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save