@social.dev/server-sdk 0.0.1-alpha.1 → 0.0.1-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.module.js +2 -11
- package/dist/app.module.js.map +1 -1
- package/dist/auth/auth.controller.d.ts +2 -0
- package/dist/auth/auth.controller.js +26 -0
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.module.js +2 -0
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/auth.service.d.ts +4 -8
- package/dist/auth/auth.service.js +6 -18
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/enums/auth-method.enum.d.ts +2 -2
- package/dist/auth/enums/auth-method.enum.js +2 -2
- package/dist/auth/enums/auth-method.enum.js.map +1 -1
- package/dist/auth/oidc/dto/requests.d.ts +6 -0
- package/dist/auth/oidc/dto/requests.js +47 -0
- package/dist/auth/oidc/dto/requests.js.map +1 -0
- package/dist/auth/oidc/oidc.controller.d.ts +4 -0
- package/dist/auth/oidc/oidc.controller.js +28 -1
- package/dist/auth/oidc/oidc.controller.js.map +1 -1
- package/dist/auth/oidc/oidc.module.js +2 -0
- package/dist/auth/oidc/oidc.module.js.map +1 -1
- package/dist/auth/oidc/oidc.service.d.ts +10 -4
- package/dist/auth/oidc/oidc.service.js +11 -13
- package/dist/auth/oidc/oidc.service.js.map +1 -1
- package/dist/bootstrap.d.ts +1 -1
- package/dist/bootstrap.js +3 -1
- package/dist/bootstrap.js.map +1 -1
- package/dist/chat/chat.module.js +2 -0
- package/dist/chat/chat.module.js.map +1 -1
- package/dist/common/injection-tokens.d.ts +2 -0
- package/dist/common/injection-tokens.js +6 -0
- package/dist/common/injection-tokens.js.map +1 -0
- package/dist/community/community.controller.d.ts +1 -2
- package/dist/community/community.controller.js +5 -5
- package/dist/community/community.controller.js.map +1 -1
- package/dist/community/community.service.d.ts +10 -3
- package/dist/community/community.service.js +30 -12
- package/dist/community/community.service.js.map +1 -1
- package/dist/configs/configs.module.js +3 -0
- package/dist/configs/configs.module.js.map +1 -1
- package/dist/configs/configs.service.d.ts +15 -0
- package/dist/configs/configs.service.js +14 -1
- package/dist/configs/configs.service.js.map +1 -1
- package/dist/core/context/context.store.d.ts +1 -0
- package/dist/core/plugin/plugin.module.js +4 -1
- package/dist/core/plugin/plugin.module.js.map +1 -1
- package/dist/db.d.ts +3 -0
- package/dist/db.js +22 -0
- package/dist/db.js.map +1 -0
- package/dist/migrations/1756201406330-Initial.d.ts +6 -0
- package/dist/migrations/1756201406330-Initial.js +85 -0
- package/dist/migrations/1756201406330-Initial.js.map +1 -0
- package/dist/network/entities/network.entity.js +4 -1
- package/dist/network/entities/network.entity.js.map +1 -1
- package/dist/network/network.middleware.js +5 -1
- package/dist/network/network.middleware.js.map +1 -1
- package/dist/network/network.service.js +1 -1
- package/dist/network/network.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/user/user.controller.d.ts +2 -1
- package/dist/user/user.controller.js +9 -4
- package/dist/user/user.controller.js.map +1 -1
- package/package.json +1 -1
- package/dist/auth/enums/auth-methods.enum.d.ts +0 -2
- package/dist/auth/enums/auth-methods.enum.js +0 -7
- package/dist/auth/enums/auth-methods.enum.js.map +0 -1
- package/dist/auth/session/auth.controller.d.ts +0 -10
- package/dist/auth/session/auth.controller.js +0 -92
- package/dist/auth/session/auth.controller.js.map +0 -1
- package/dist/auth/session/auth.service.d.ts +0 -12
- package/dist/auth/session/auth.service.js +0 -46
- package/dist/auth/session/auth.service.js.map +0 -1
- package/dist/common/entities/base.repository.d.ts +0 -7
- package/dist/common/entities/base.repository.js +0 -32
- package/dist/common/entities/base.repository.js.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { UserService } from './user.service';
|
|
2
|
+
import { UserResponseDto } from './dto/user-response.dto';
|
|
2
3
|
export declare class UserController {
|
|
3
4
|
private readonly userService;
|
|
4
5
|
constructor(userService: UserService);
|
|
5
6
|
findAll(): Promise<import("./entities/user.entity").User[]>;
|
|
6
|
-
findOne(id: string): Promise<
|
|
7
|
+
findOne(id: string): Promise<UserResponseDto>;
|
|
7
8
|
}
|
|
@@ -16,7 +16,9 @@ exports.UserController = void 0;
|
|
|
16
16
|
const openapi = require("@nestjs/swagger");
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
18
|
const user_service_1 = require("./user.service");
|
|
19
|
+
const class_transformer_1 = require("class-transformer");
|
|
19
20
|
const swagger_1 = require("@nestjs/swagger");
|
|
21
|
+
const user_response_dto_1 = require("./dto/user-response.dto");
|
|
20
22
|
let UserController = class UserController {
|
|
21
23
|
userService;
|
|
22
24
|
constructor(userService) {
|
|
@@ -25,8 +27,11 @@ let UserController = class UserController {
|
|
|
25
27
|
findAll() {
|
|
26
28
|
return this.userService.findAll();
|
|
27
29
|
}
|
|
28
|
-
findOne(id) {
|
|
29
|
-
|
|
30
|
+
async findOne(id) {
|
|
31
|
+
if (isNaN(id)) {
|
|
32
|
+
return (0, class_transformer_1.plainToInstance)(user_response_dto_1.UserResponseDto, await this.userService.findOneByUsername(id));
|
|
33
|
+
}
|
|
34
|
+
return (0, class_transformer_1.plainToInstance)(user_response_dto_1.UserResponseDto, this.userService.findOne(+id));
|
|
30
35
|
}
|
|
31
36
|
};
|
|
32
37
|
exports.UserController = UserController;
|
|
@@ -47,11 +52,11 @@ __decorate([
|
|
|
47
52
|
description: 'Returns a information about a user',
|
|
48
53
|
}),
|
|
49
54
|
(0, common_1.Get)('user.info'),
|
|
50
|
-
openapi.ApiResponse({ status: 200, type:
|
|
55
|
+
openapi.ApiResponse({ status: 200, type: require("./dto/user-response.dto").UserResponseDto }),
|
|
51
56
|
__param(0, (0, common_1.Query)('user')),
|
|
52
57
|
__metadata("design:type", Function),
|
|
53
58
|
__metadata("design:paramtypes", [String]),
|
|
54
|
-
__metadata("design:returntype",
|
|
59
|
+
__metadata("design:returntype", Promise)
|
|
55
60
|
], UserController.prototype, "findOne", null);
|
|
56
61
|
exports.UserController = UserController = __decorate([
|
|
57
62
|
(0, common_1.Controller)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/user/user.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,iDAA6C;
|
|
1
|
+
{"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/user/user.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,iDAA6C;AAI7C,yDAAoD;AAEpD,6CAA+C;AAC/C,+DAA0D;AAGnD,IAAM,cAAc,GAApB,MAAM,cAAc;IACI;IAA7B,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAYzD,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;IACpC,CAAC;IAOK,AAAN,KAAK,CAAC,OAAO,CAAgB,EAAU;QACrC,IAAI,KAAK,CAAC,EAAS,CAAC,EAAE,CAAC;YACrB,OAAO,IAAA,mCAAe,EACpB,mCAAe,EACf,MAAM,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAC7C,CAAC;QACJ,CAAC;QACD,OAAO,IAAA,mCAAe,EAAC,mCAAe,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzE,CAAC;CAWF,CAAA;AAzCY,wCAAc;AAazB;IALC,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,4BAA4B;QACrC,WAAW,EAAE,iCAAiC;KAC/C,CAAC;IACD,IAAA,YAAG,EAAC,WAAW,CAAC;;;;;6CAGhB;AAOK;IALL,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,iBAAiB;QAC1B,WAAW,EAAE,oCAAoC;KAClD,CAAC;IACD,IAAA,YAAG,EAAC,WAAW,CAAC;;IACF,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;;;;6CAQ3B;yBA9BU,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAE+B,0BAAW;GAD1C,cAAc,CAyC1B"}
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthMethodEnum = void 0;
|
|
4
|
-
var AuthMethodEnum;
|
|
5
|
-
(function (AuthMethodEnum) {
|
|
6
|
-
})(AuthMethodEnum || (exports.AuthMethodEnum = AuthMethodEnum = {}));
|
|
7
|
-
//# sourceMappingURL=auth-methods.enum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-methods.enum.js","sourceRoot":"","sources":["../../../src/auth/enums/auth-methods.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAAiB;AAA7B,WAAY,cAAc;AAAE,CAAC,EAAjB,cAAc,8BAAd,cAAc,QAAG"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Response as ExpressResponse } from 'express';
|
|
2
|
-
import { AuthService } from './auth.service';
|
|
3
|
-
import { LoginDto } from './dto/login.dto';
|
|
4
|
-
export declare class AuthController {
|
|
5
|
-
private authService;
|
|
6
|
-
constructor(authService: AuthService);
|
|
7
|
-
login(signInDto: LoginDto, res: ExpressResponse): Promise<void>;
|
|
8
|
-
logout(res: ExpressResponse): Promise<void>;
|
|
9
|
-
getProfile(req: any): any;
|
|
10
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var _a, _b;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.AuthController = void 0;
|
|
17
|
-
const openapi = require("@nestjs/swagger");
|
|
18
|
-
const common_1 = require("@nestjs/common");
|
|
19
|
-
const auth_service_1 = require("./auth.service");
|
|
20
|
-
const login_dto_1 = require("./dto/login.dto");
|
|
21
|
-
const auth_guard_1 = require("./auth.guard");
|
|
22
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
23
|
-
const login_success_dto_1 = require("./dto/login-success.dto");
|
|
24
|
-
const class_transformer_1 = require("class-transformer");
|
|
25
|
-
const user_response_dto_1 = require("../../user/dto/user-response.dto");
|
|
26
|
-
let AuthController = class AuthController {
|
|
27
|
-
authService;
|
|
28
|
-
constructor(authService) {
|
|
29
|
-
this.authService = authService;
|
|
30
|
-
}
|
|
31
|
-
async login(signInDto, res) {
|
|
32
|
-
const { accessToken, user } = await this.authService.login(signInDto.username, signInDto.password);
|
|
33
|
-
res.cookie('sess', accessToken, {
|
|
34
|
-
httpOnly: true,
|
|
35
|
-
secure: true,
|
|
36
|
-
sameSite: 'strict',
|
|
37
|
-
});
|
|
38
|
-
res.send({ accessToken, user: (0, class_transformer_1.plainToInstance)(user_response_dto_1.UserResponseDto, user) });
|
|
39
|
-
}
|
|
40
|
-
async logout(res) {
|
|
41
|
-
res.clearCookie('sess', {
|
|
42
|
-
httpOnly: true,
|
|
43
|
-
secure: true,
|
|
44
|
-
sameSite: 'strict',
|
|
45
|
-
});
|
|
46
|
-
res.send({ message: 'Logged out successfully' });
|
|
47
|
-
}
|
|
48
|
-
getProfile(req) {
|
|
49
|
-
return req.user;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
exports.AuthController = AuthController;
|
|
53
|
-
__decorate([
|
|
54
|
-
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
55
|
-
(0, common_1.Post)('auth.login'),
|
|
56
|
-
(0, swagger_1.ApiBody)({ type: login_dto_1.LoginDto }),
|
|
57
|
-
(0, swagger_1.ApiResponse)({
|
|
58
|
-
status: 200,
|
|
59
|
-
description: 'Login successful',
|
|
60
|
-
type: login_success_dto_1.LoginSuccessResponseDto,
|
|
61
|
-
}),
|
|
62
|
-
openapi.ApiResponse({ status: common_1.HttpStatus.OK }),
|
|
63
|
-
__param(0, (0, common_1.Body)()),
|
|
64
|
-
__param(1, (0, common_1.Response)({ passthrough: true })),
|
|
65
|
-
__metadata("design:type", Function),
|
|
66
|
-
__metadata("design:paramtypes", [typeof (_b = typeof login_dto_1.LoginDto !== "undefined" && login_dto_1.LoginDto) === "function" ? _b : Object, Object]),
|
|
67
|
-
__metadata("design:returntype", Promise)
|
|
68
|
-
], AuthController.prototype, "login", null);
|
|
69
|
-
__decorate([
|
|
70
|
-
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
71
|
-
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
|
72
|
-
(0, common_1.Post)('auth.logout'),
|
|
73
|
-
openapi.ApiResponse({ status: common_1.HttpStatus.OK }),
|
|
74
|
-
__param(0, (0, common_1.Response)({ passthrough: true })),
|
|
75
|
-
__metadata("design:type", Function),
|
|
76
|
-
__metadata("design:paramtypes", [Object]),
|
|
77
|
-
__metadata("design:returntype", Promise)
|
|
78
|
-
], AuthController.prototype, "logout", null);
|
|
79
|
-
__decorate([
|
|
80
|
-
(0, common_1.UseGuards)(auth_guard_1.AuthGuard),
|
|
81
|
-
(0, common_1.Get)('auth.profile.info'),
|
|
82
|
-
openapi.ApiResponse({ status: 200, type: Object }),
|
|
83
|
-
__param(0, (0, common_1.Request)()),
|
|
84
|
-
__metadata("design:type", Function),
|
|
85
|
-
__metadata("design:paramtypes", [Object]),
|
|
86
|
-
__metadata("design:returntype", void 0)
|
|
87
|
-
], AuthController.prototype, "getProfile", null);
|
|
88
|
-
exports.AuthController = AuthController = __decorate([
|
|
89
|
-
(0, common_1.Controller)(),
|
|
90
|
-
__metadata("design:paramtypes", [typeof (_a = typeof auth_service_1.AuthService !== "undefined" && auth_service_1.AuthService) === "function" ? _a : Object])
|
|
91
|
-
], AuthController);
|
|
92
|
-
//# sourceMappingURL=auth.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../../src/auth/session/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAUwB;AAExB,iDAA6C;AAC7C,+CAA2C;AAC3C,6CAAyC;AACzC,6CAAuD;AACvD,+DAAkE;AAClE,yDAAoD;AACpD,wEAA+D;AAGxD,IAAM,cAAc,GAApB,MAAM,cAAc;IACL;IAApB,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAU1C,AAAN,KAAK,CAAC,KAAK,CACD,SAAmB,EACM,GAAoB;QAErD,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CACxD,SAAS,CAAC,QAAQ,EAClB,SAAS,CAAC,QAAQ,CACnB,CAAC;QAEF,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE;YAC9B,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;QAEH,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,IAAA,mCAAe,EAAC,mCAAe,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;IAKK,AAAN,KAAK,CAAC,MAAM,CAAkC,GAAoB;QAEhE,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE;YACtB,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;QAEH,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC;IACnD,CAAC;IAID,UAAU,CAAY,GAAG;QACvB,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;CACF,CAAA;AAhDY,wCAAc;AAWnB;IARL,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,aAAI,EAAC,YAAY,CAAC;IAClB,IAAA,iBAAO,EAAC,EAAE,IAAI,EAAE,oBAAQ,EAAE,CAAC;IAC3B,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,kBAAkB;QAC/B,IAAI,EAAE,2CAAuB;KAC9B,CAAC;kCAPQ,mBAAU,CAAC,EAAE;IASpB,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,iBAAQ,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;;yDADb,oBAAQ,oBAAR,oBAAQ;;2CAe5B;AAKK;IAHL,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,kBAAS,EAAC,sBAAS,CAAC;IACpB,IAAA,aAAI,EAAC,aAAa,CAAC;kCAFV,mBAAU,CAAC,EAAE;IAGT,WAAA,IAAA,iBAAQ,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;;;;4CAS5C;AAID;IAFC,IAAA,kBAAS,EAAC,sBAAS,CAAC;IACpB,IAAA,YAAG,EAAC,mBAAmB,CAAC;;IACb,WAAA,IAAA,gBAAO,GAAE,CAAA;;;;gDAEpB;yBA/CU,cAAc;IAD1B,IAAA,mBAAU,GAAE;yDAEsB,0BAAW,oBAAX,0BAAW;GADjC,cAAc,CAgD1B"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { UserService } from '../user/user.service';
|
|
2
|
-
import { JwtService } from '@nestjs/jwt';
|
|
3
|
-
import { User } from '~/user/entities/user.entity';
|
|
4
|
-
export declare class AuthService {
|
|
5
|
-
private userService;
|
|
6
|
-
private jwtService;
|
|
7
|
-
constructor(userService: UserService, jwtService: JwtService);
|
|
8
|
-
login(username: string, password: string): Promise<{
|
|
9
|
-
accessToken: string;
|
|
10
|
-
user: User;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var _a;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.AuthService = void 0;
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
|
-
const user_service_1 = require("../user/user.service");
|
|
16
|
-
const jwt_1 = require("@nestjs/jwt");
|
|
17
|
-
let AuthService = class AuthService {
|
|
18
|
-
userService;
|
|
19
|
-
jwtService;
|
|
20
|
-
constructor(userService, jwtService) {
|
|
21
|
-
this.userService = userService;
|
|
22
|
-
this.jwtService = jwtService;
|
|
23
|
-
}
|
|
24
|
-
async login(username, password) {
|
|
25
|
-
const user = await this.userService.findOneByUsername(username);
|
|
26
|
-
if (user?.password !== password) {
|
|
27
|
-
throw new common_1.UnauthorizedException();
|
|
28
|
-
}
|
|
29
|
-
const payload = {
|
|
30
|
-
jid: 1,
|
|
31
|
-
sub: user.id,
|
|
32
|
-
username: user.username,
|
|
33
|
-
};
|
|
34
|
-
const accessToken = await this.jwtService.signAsync(payload);
|
|
35
|
-
return {
|
|
36
|
-
accessToken,
|
|
37
|
-
user,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
exports.AuthService = AuthService;
|
|
42
|
-
exports.AuthService = AuthService = __decorate([
|
|
43
|
-
(0, common_1.Injectable)(),
|
|
44
|
-
__metadata("design:paramtypes", [typeof (_a = typeof user_service_1.UserService !== "undefined" && user_service_1.UserService) === "function" ? _a : Object, jwt_1.JwtService])
|
|
45
|
-
], AuthService);
|
|
46
|
-
//# sourceMappingURL=auth.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../../src/auth/session/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAmE;AACnE,uDAAmD;AACnD,qCAAyC;AAIlC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAEZ;IACA;IAFV,YACU,WAAwB,EACxB,UAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;IAC7B,CAAC;IAKJ,KAAK,CAAC,KAAK,CACT,QAAgB,EAChB,QAAgB;QAEhB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAChE,IAAI,IAAI,EAAE,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QAED,MAAM,OAAO,GAAG;YACd,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,IAAI,CAAC,EAAE;YACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;QACF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC7D,OAAO;YACL,WAAW;YACX,IAAI;SACL,CAAC;IACJ,CAAC;CACF,CAAA;AA7BY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;yDAGY,0BAAW,oBAAX,0BAAW,gCACZ,gBAAU;GAHrB,WAAW,CA6BvB"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var BaseRepository_1;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.BaseRepository = void 0;
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
|
-
const typeorm_1 = require("typeorm");
|
|
16
|
-
let BaseRepository = class BaseRepository {
|
|
17
|
-
static { BaseRepository_1 = this; }
|
|
18
|
-
dataSource;
|
|
19
|
-
static queryRunner;
|
|
20
|
-
constructor(dataSource) {
|
|
21
|
-
this.dataSource = dataSource;
|
|
22
|
-
}
|
|
23
|
-
getQueryRunner() {
|
|
24
|
-
return BaseRepository_1.queryRunner;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.BaseRepository = BaseRepository;
|
|
28
|
-
exports.BaseRepository = BaseRepository = BaseRepository_1 = __decorate([
|
|
29
|
-
(0, common_1.Injectable)(),
|
|
30
|
-
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
31
|
-
], BaseRepository);
|
|
32
|
-
//# sourceMappingURL=base.repository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.repository.js","sourceRoot":"","sources":["../../../src/common/entities/base.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qCAAkD;AAG3C,IAAe,cAAc,GAA7B,MAAe,cAAc;;IAGd;IAFpB,MAAM,CAAC,WAAW,CAAc;IAEhC,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAE9C,cAAc;QACZ,OAAO,gBAAc,CAAC,WAAW,CAAC;IACpC,CAAC;CACF,CAAA;AARqB,wCAAc;yBAAd,cAAc;IADnC,IAAA,mBAAU,GAAE;qCAIqB,oBAAU;GAHtB,cAAc,CAQnC"}
|