@spinajs/rbac-http 1.2.145 → 1.2.146
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/lib/{rbac-http/src/augumentation.d.ts → augumentation.d.ts} +0 -0
- package/lib/{rbac-http/src/augumentation.js → augumentation.js} +0 -0
- package/lib/augumentation.js.map +1 -0
- package/lib/config/rbac-http.js +1 -3
- package/lib/config/rbac-http.js.map +1 -1
- package/lib/dto/login-dto.d.ts +1 -0
- package/lib/dto/login-dto.js +8 -1
- package/lib/dto/login-dto.js.map +1 -1
- package/lib/dto/password-dto.d.ts +1 -0
- package/lib/dto/password-dto.js +8 -1
- package/lib/dto/password-dto.js.map +1 -1
- package/lib/dto/user-dto.d.ts +2 -1
- package/lib/dto/user-dto.js +8 -1
- package/lib/dto/user-dto.js.map +1 -1
- package/lib/middlewares.d.ts +9 -4
- package/lib/middlewares.js +50 -36
- package/lib/middlewares.js.map +1 -1
- package/lib/policies.d.ts +3 -4
- package/lib/policies.js +3 -3
- package/lib/policies.js.map +1 -1
- package/package.json +2 -2
- package/lib/http/src/interfaces.d.ts +0 -443
- package/lib/http/src/interfaces.js +0 -222
- package/lib/http/src/interfaces.js.map +0 -1
- package/lib/rbac-http/src/augumentation.js.map +0 -1
- package/lib/rbac-http/src/config/rbac-http.d.ts +0 -1
- package/lib/rbac-http/src/config/rbac-http.js +0 -21
- package/lib/rbac-http/src/config/rbac-http.js.map +0 -1
- package/lib/rbac-http/src/controllers/LoginController.d.ts +0 -12
- package/lib/rbac-http/src/controllers/LoginController.js +0 -91
- package/lib/rbac-http/src/controllers/LoginController.js.map +0 -1
- package/lib/rbac-http/src/controllers/UsersController.d.ts +0 -17
- package/lib/rbac-http/src/controllers/UsersController.js +0 -199
- package/lib/rbac-http/src/controllers/UsersController.js.map +0 -1
- package/lib/rbac-http/src/decorators.d.ts +0 -18
- package/lib/rbac-http/src/decorators.js +0 -80
- package/lib/rbac-http/src/decorators.js.map +0 -1
- package/lib/rbac-http/src/dto/login-dto.d.ts +0 -21
- package/lib/rbac-http/src/dto/login-dto.js +0 -34
- package/lib/rbac-http/src/dto/login-dto.js.map +0 -1
- package/lib/rbac-http/src/dto/password-dto.d.ts +0 -23
- package/lib/rbac-http/src/dto/password-dto.js +0 -34
- package/lib/rbac-http/src/dto/password-dto.js.map +0 -1
- package/lib/rbac-http/src/dto/user-dto.d.ts +0 -43
- package/lib/rbac-http/src/dto/user-dto.js +0 -38
- package/lib/rbac-http/src/dto/user-dto.js.map +0 -1
- package/lib/rbac-http/src/index.d.ts +0 -8
- package/lib/rbac-http/src/index.js +0 -25
- package/lib/rbac-http/src/index.js.map +0 -1
- package/lib/rbac-http/src/interfaces.d.ts +0 -23
- package/lib/rbac-http/src/interfaces.js +0 -3
- package/lib/rbac-http/src/interfaces.js.map +0 -1
- package/lib/rbac-http/src/middlewares.d.ts +0 -11
- package/lib/rbac-http/src/middlewares.js +0 -85
- package/lib/rbac-http/src/middlewares.js.map +0 -1
- package/lib/rbac-http/src/policies.d.ts +0 -13
- package/lib/rbac-http/src/policies.js +0 -57
- package/lib/rbac-http/src/policies.js.map +0 -1
- package/lib/rbac-http/src/route-args.d.ts +0 -9
- package/lib/rbac-http/src/route-args.js +0 -24
- package/lib/rbac-http/src/route-args.js.map +0 -1
- package/lib/rbac-http/src/transformers.d.ts +0 -11
- package/lib/rbac-http/src/transformers.js +0 -34
- package/lib/rbac-http/src/transformers.js.map +0 -1
- package/lib/rbac-http.js +0 -7
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LoginDto } from './../dto/login-dto';
|
|
2
|
-
import { BaseController, Ok, CookieResponse, Unauthorized } from '@spinajs/http';
|
|
3
|
-
import { AuthProvider, SessionProvider } from '@spinajs/rbac';
|
|
4
|
-
import { Configuration } from '@spinajs/configuration';
|
|
5
|
-
export declare class LoginController extends BaseController {
|
|
6
|
-
protected Configuration: Configuration;
|
|
7
|
-
protected AuthProvider: AuthProvider;
|
|
8
|
-
protected SessionProvider: SessionProvider;
|
|
9
|
-
protected SessionExpirationTime: number;
|
|
10
|
-
login(credentials: LoginDto): Promise<Unauthorized | CookieResponse>;
|
|
11
|
-
logout(ssid: string): Promise<Ok | CookieResponse>;
|
|
12
|
-
}
|
|
@@ -1,91 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.LoginController = void 0;
|
|
16
|
-
const login_dto_1 = require("./../dto/login-dto");
|
|
17
|
-
const http_1 = require("@spinajs/http");
|
|
18
|
-
const rbac_1 = require("@spinajs/rbac");
|
|
19
|
-
const di_1 = require("@spinajs/di");
|
|
20
|
-
const configuration_1 = require("@spinajs/configuration");
|
|
21
|
-
const luxon_1 = require("luxon");
|
|
22
|
-
let LoginController = class LoginController extends http_1.BaseController {
|
|
23
|
-
async login(credentials) {
|
|
24
|
-
const user = await this.AuthProvider.authenticate(credentials.Login, credentials.Password);
|
|
25
|
-
if (!user) {
|
|
26
|
-
return new http_1.Unauthorized({
|
|
27
|
-
error: {
|
|
28
|
-
message: 'login or password incorrect',
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
const lifetime = luxon_1.DateTime.now().plus({ minutes: this.SessionExpirationTime });
|
|
33
|
-
const uObject = {
|
|
34
|
-
Login: user.Login,
|
|
35
|
-
Email: user.Email,
|
|
36
|
-
NiceName: user.NiceName,
|
|
37
|
-
Metadata: user.Metadata.map((m) => ({ Key: m.Key, Value: m.Value })),
|
|
38
|
-
Role: user.Role,
|
|
39
|
-
Id: user.Id,
|
|
40
|
-
};
|
|
41
|
-
const session = new rbac_1.Session({
|
|
42
|
-
Data: uObject,
|
|
43
|
-
Expiration: lifetime,
|
|
44
|
-
});
|
|
45
|
-
await this.SessionProvider.updateSession(session);
|
|
46
|
-
return new http_1.CookieResponse('ssid', session.SessionId, this.SessionExpirationTime, uObject);
|
|
47
|
-
}
|
|
48
|
-
async logout(ssid) {
|
|
49
|
-
if (!ssid) {
|
|
50
|
-
return new http_1.Ok();
|
|
51
|
-
}
|
|
52
|
-
await this.SessionProvider.deleteSession(ssid);
|
|
53
|
-
// send empty cookie to confirm session deletion
|
|
54
|
-
return new http_1.CookieResponse('ssid', null, this.SessionExpirationTime);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
__decorate([
|
|
58
|
-
(0, di_1.Autoinject)(),
|
|
59
|
-
__metadata("design:type", configuration_1.Configuration)
|
|
60
|
-
], LoginController.prototype, "Configuration", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
(0, di_1.Autoinject)(),
|
|
63
|
-
__metadata("design:type", rbac_1.AuthProvider)
|
|
64
|
-
], LoginController.prototype, "AuthProvider", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
(0, di_1.Autoinject)(),
|
|
67
|
-
__metadata("design:type", rbac_1.SessionProvider)
|
|
68
|
-
], LoginController.prototype, "SessionProvider", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
(0, configuration_1.Config)('acl.session.expiration', 10),
|
|
71
|
-
__metadata("design:type", Number)
|
|
72
|
-
], LoginController.prototype, "SessionExpirationTime", void 0);
|
|
73
|
-
__decorate([
|
|
74
|
-
(0, http_1.Post)(),
|
|
75
|
-
__param(0, (0, http_1.Body)()),
|
|
76
|
-
__metadata("design:type", Function),
|
|
77
|
-
__metadata("design:paramtypes", [login_dto_1.LoginDto]),
|
|
78
|
-
__metadata("design:returntype", Promise)
|
|
79
|
-
], LoginController.prototype, "login", null);
|
|
80
|
-
__decorate([
|
|
81
|
-
(0, http_1.Get)(),
|
|
82
|
-
__param(0, (0, http_1.Cookie)()),
|
|
83
|
-
__metadata("design:type", Function),
|
|
84
|
-
__metadata("design:paramtypes", [String]),
|
|
85
|
-
__metadata("design:returntype", Promise)
|
|
86
|
-
], LoginController.prototype, "logout", null);
|
|
87
|
-
LoginController = __decorate([
|
|
88
|
-
(0, http_1.BasePath)('auth')
|
|
89
|
-
], LoginController);
|
|
90
|
-
exports.LoginController = LoginController;
|
|
91
|
-
//# sourceMappingURL=LoginController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoginController.js","sourceRoot":"","sources":["../../../../src/controllers/LoginController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA8C;AAC9C,wCAAoH;AACpH,wCAAuE;AACvE,oCAAyC;AACzC,0DAA+D;AAC/D,iCAAiC;AAGjC,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,qBAAc;IAc1C,KAAK,CAAC,KAAK,CAAS,WAAqB;QAC9C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QAE3F,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,IAAI,mBAAY,CAAC;gBACtB,KAAK,EAAE;oBACL,OAAO,EAAE,6BAA6B;iBACvC;aACF,CAAC,CAAC;SACJ;QACD,MAAM,QA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AAU,GAAE;8BACc,sBAAe;wDAAC;AAG3C;IADC,IAAA,sBAAM,EAAC,wBAAwB,EAAE,EAAE,CAAC;;8DACG;AAGxC;IADC,IAAA,WAAI,GAAE;IACa,WAAA,IAAA,WAAI,GAAE,CAAA;;qCAAc,oBAAQ;;4CA6B/C;AAGD;IADC,IAAA,UAAG,GAAE;IACe,WAAA,IAAA,aAAM,GAAE,CAAA;;;;6CAS5B;AAvDU,eAAe;IAD3B,IAAA,eAAQ,EAAC,MAAM,CAAC;GACJ,eAAe,CAwD3B;AAxDY,0CAAe"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { PasswordDto } from './../dto/password-dto';
|
|
2
|
-
import { UserDto } from './../dto/user-dto';
|
|
3
|
-
import * as express from 'express';
|
|
4
|
-
import { BaseController, Ok, NotFound } from '@spinajs/http';
|
|
5
|
-
import { IContainer } from '@spinajs/di';
|
|
6
|
-
import { UserDataTransformer, IUserResult } from '../transformers';
|
|
7
|
-
import { SORT_ORDER } from '@spinajs/orm/lib/enums';
|
|
8
|
-
export declare class UsersController extends BaseController {
|
|
9
|
-
protected DataTransformer: UserDataTransformer<IUserResult>;
|
|
10
|
-
protected Container: IContainer;
|
|
11
|
-
listUsers(search: string, page: number, perPage: number, order: string, orderDirection: SORT_ORDER, request: express.Request): Promise<NotFound | Ok>;
|
|
12
|
-
getUser(id: number): Promise<Ok>;
|
|
13
|
-
addUser(user: UserDto): Promise<Ok>;
|
|
14
|
-
deleteUser(id: number): Promise<Ok>;
|
|
15
|
-
updateUser(id: number, user: UserDto): Promise<Ok>;
|
|
16
|
-
updateUserPassword(id: number, pwd: PasswordDto): Promise<Ok>;
|
|
17
|
-
}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
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;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
32
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
33
|
-
};
|
|
34
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
35
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.UsersController = void 0;
|
|
39
|
-
const password_dto_1 = require("./../dto/password-dto");
|
|
40
|
-
const user_dto_1 = require("./../dto/user-dto");
|
|
41
|
-
const rbac_1 = require("@spinajs/rbac");
|
|
42
|
-
const express = __importStar(require("express"));
|
|
43
|
-
const http_1 = require("@spinajs/http");
|
|
44
|
-
const exceptions_1 = require("@spinajs/exceptions");
|
|
45
|
-
const orm_1 = require("@spinajs/orm");
|
|
46
|
-
const di_1 = require("@spinajs/di");
|
|
47
|
-
const transformers_1 = require("../transformers");
|
|
48
|
-
const enums_1 = require("@spinajs/orm/lib/enums");
|
|
49
|
-
const OrderSchema = {
|
|
50
|
-
type: 'string',
|
|
51
|
-
enum: ['asc', 'desc'],
|
|
52
|
-
};
|
|
53
|
-
let UsersController = class UsersController extends http_1.BaseController {
|
|
54
|
-
async listUsers(search, page, perPage, order, orderDirection, request) {
|
|
55
|
-
const query = rbac_1.User.all()
|
|
56
|
-
.whereNull('DeletedAt')
|
|
57
|
-
.skip((page - 1) * perPage)
|
|
58
|
-
.take(perPage)
|
|
59
|
-
.order(order, orderDirection)
|
|
60
|
-
.populate('Roles')
|
|
61
|
-
.populate('Metadata');
|
|
62
|
-
const countQuery = rbac_1.User.query().select(new orm_1.RawQuery('count(*) as count')).whereNull('DeletedAt');
|
|
63
|
-
if (search) {
|
|
64
|
-
const searchFunc = function () {
|
|
65
|
-
this.where('Email', 'like', `%${search}%`);
|
|
66
|
-
this.orWhere('Login', 'like', `${search}%`);
|
|
67
|
-
this.orWhere('NiceName', 'like', `%${search}%`);
|
|
68
|
-
};
|
|
69
|
-
query.where(searchFunc);
|
|
70
|
-
countQuery.where(searchFunc);
|
|
71
|
-
}
|
|
72
|
-
const r = await query;
|
|
73
|
-
const c = await countQuery.asRaw();
|
|
74
|
-
if (r.length === 0) {
|
|
75
|
-
return new http_1.NotFound('no users met search criteria');
|
|
76
|
-
}
|
|
77
|
-
return new http_1.Ok(this.DataTransformer.transform({
|
|
78
|
-
Data: r,
|
|
79
|
-
Total: c[0].count,
|
|
80
|
-
}, request));
|
|
81
|
-
}
|
|
82
|
-
async getUser(id) {
|
|
83
|
-
const user = await rbac_1.User.where({
|
|
84
|
-
Id: id,
|
|
85
|
-
})
|
|
86
|
-
.whereNull('DeletedAt')
|
|
87
|
-
.populate('Metadata')
|
|
88
|
-
.populate('Roles')
|
|
89
|
-
.firstOrFail();
|
|
90
|
-
return new http_1.Ok(user);
|
|
91
|
-
}
|
|
92
|
-
async addUser(user) {
|
|
93
|
-
const password = this.Container.resolve(rbac_1.PasswordProvider);
|
|
94
|
-
if (user.Password !== user.ConfirmPassword) {
|
|
95
|
-
throw new exceptions_1.InvalidArgument('password does not match');
|
|
96
|
-
}
|
|
97
|
-
let hashedPassword = '';
|
|
98
|
-
let userPassword = user.Password;
|
|
99
|
-
if (!userPassword) {
|
|
100
|
-
userPassword = password.generate();
|
|
101
|
-
}
|
|
102
|
-
hashedPassword = await password.hash(userPassword);
|
|
103
|
-
const entity = new rbac_1.User({
|
|
104
|
-
Email: user.Email,
|
|
105
|
-
Login: user.Login,
|
|
106
|
-
NiceName: user.NiceName,
|
|
107
|
-
Password: hashedPassword,
|
|
108
|
-
CreatedAt: new Date(),
|
|
109
|
-
});
|
|
110
|
-
await entity.insert();
|
|
111
|
-
return new http_1.Ok({ Id: entity.Id });
|
|
112
|
-
}
|
|
113
|
-
async deleteUser(id) {
|
|
114
|
-
const entity = await rbac_1.User.getOrFail(id);
|
|
115
|
-
await entity.destroy();
|
|
116
|
-
return new http_1.Ok();
|
|
117
|
-
}
|
|
118
|
-
async updateUser(id, user) {
|
|
119
|
-
const entity = await rbac_1.User.getOrFail(id);
|
|
120
|
-
entity.Email = user.Email;
|
|
121
|
-
entity.NiceName = user.NiceName;
|
|
122
|
-
entity.Login = user.Login;
|
|
123
|
-
await entity.update();
|
|
124
|
-
return new http_1.Ok();
|
|
125
|
-
}
|
|
126
|
-
async updateUserPassword(id, pwd) {
|
|
127
|
-
if (pwd.Password !== pwd.ConfirmPassword) {
|
|
128
|
-
throw new exceptions_1.InvalidArgument('password does not match');
|
|
129
|
-
}
|
|
130
|
-
const entity = await rbac_1.User.getOrFail(id);
|
|
131
|
-
const password = this.Container.resolve(rbac_1.PasswordProvider);
|
|
132
|
-
const hashedPassword = await password.hash(pwd.Password);
|
|
133
|
-
entity.Password = hashedPassword;
|
|
134
|
-
await entity.update();
|
|
135
|
-
return new http_1.Ok();
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
__decorate([
|
|
139
|
-
(0, di_1.Autoinject)(),
|
|
140
|
-
__metadata("design:type", transformers_1.UserDataTransformer)
|
|
141
|
-
], UsersController.prototype, "DataTransformer", void 0);
|
|
142
|
-
__decorate([
|
|
143
|
-
(0, di_1.Autoinject)(di_1.Container),
|
|
144
|
-
__metadata("design:type", Object)
|
|
145
|
-
], UsersController.prototype, "Container", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
(0, http_1.Get)('/'),
|
|
148
|
-
__param(0, (0, http_1.Query)()),
|
|
149
|
-
__param(1, (0, http_1.Query)({ type: 'number', min: 1, default: 0 })),
|
|
150
|
-
__param(2, (0, http_1.Query)({ type: 'number', min: 1, default: 30 })),
|
|
151
|
-
__param(3, (0, http_1.Query)()),
|
|
152
|
-
__param(4, (0, http_1.Query)(OrderSchema)),
|
|
153
|
-
__param(5, (0, http_1.Req)()),
|
|
154
|
-
__metadata("design:type", Function),
|
|
155
|
-
__metadata("design:paramtypes", [String, Number, Number, String, String, Object]),
|
|
156
|
-
__metadata("design:returntype", Promise)
|
|
157
|
-
], UsersController.prototype, "listUsers", null);
|
|
158
|
-
__decorate([
|
|
159
|
-
(0, http_1.Get)(':id'),
|
|
160
|
-
__param(0, (0, http_1.PKey)()),
|
|
161
|
-
__metadata("design:type", Function),
|
|
162
|
-
__metadata("design:paramtypes", [Number]),
|
|
163
|
-
__metadata("design:returntype", Promise)
|
|
164
|
-
], UsersController.prototype, "getUser", null);
|
|
165
|
-
__decorate([
|
|
166
|
-
(0, http_1.Post)('/'),
|
|
167
|
-
__param(0, (0, http_1.Body)()),
|
|
168
|
-
__metadata("design:type", Function),
|
|
169
|
-
__metadata("design:paramtypes", [user_dto_1.UserDto]),
|
|
170
|
-
__metadata("design:returntype", Promise)
|
|
171
|
-
], UsersController.prototype, "addUser", null);
|
|
172
|
-
__decorate([
|
|
173
|
-
(0, http_1.Del)(':id'),
|
|
174
|
-
__param(0, (0, http_1.PKey)()),
|
|
175
|
-
__metadata("design:type", Function),
|
|
176
|
-
__metadata("design:paramtypes", [Number]),
|
|
177
|
-
__metadata("design:returntype", Promise)
|
|
178
|
-
], UsersController.prototype, "deleteUser", null);
|
|
179
|
-
__decorate([
|
|
180
|
-
(0, http_1.Put)(':id'),
|
|
181
|
-
__param(0, (0, http_1.PKey)()),
|
|
182
|
-
__param(1, (0, http_1.Body)()),
|
|
183
|
-
__metadata("design:type", Function),
|
|
184
|
-
__metadata("design:paramtypes", [Number, user_dto_1.UserDto]),
|
|
185
|
-
__metadata("design:returntype", Promise)
|
|
186
|
-
], UsersController.prototype, "updateUser", null);
|
|
187
|
-
__decorate([
|
|
188
|
-
(0, http_1.Put)(':id/change-password'),
|
|
189
|
-
__param(0, (0, http_1.PKey)()),
|
|
190
|
-
__param(1, (0, http_1.Body)()),
|
|
191
|
-
__metadata("design:type", Function),
|
|
192
|
-
__metadata("design:paramtypes", [Number, password_dto_1.PasswordDto]),
|
|
193
|
-
__metadata("design:returntype", Promise)
|
|
194
|
-
], UsersController.prototype, "updateUserPassword", null);
|
|
195
|
-
UsersController = __decorate([
|
|
196
|
-
(0, http_1.BasePath)('users')
|
|
197
|
-
], UsersController);
|
|
198
|
-
exports.UsersController = UsersController;
|
|
199
|
-
//# sourceMappingURL=UsersController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UsersController.js","sourceRoot":"","sources":["../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AA,WAAI,GAAE,CAAA;IAAc,WAAA,IAAA,WAAI,GAAE,CAAA;;6CAAO,kBAAO;;iDAShE;AAGD;IADC,IAAA,UAAG,EAAC,qBAAqB,CAAC;IACM,WAAA,IAAA,WAAI,GAAE,CAAA;IAAc,WAAA,IAAA,WAAI,GAAE,CAAA;;6CAAM,0BAAW;;yDAY3E;AAxHU,eAAe;IAD3B,IAAA,eAAQ,EAAC,OAAO,CAAC;GACL,eAAe,CAyH3B;AAzHY,0CAAe"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IRbacDescriptor, PermissionType } from './interfaces';
|
|
2
|
-
export declare const ACL_CONTROLLER_DESCRIPTOR: unique symbol;
|
|
3
|
-
export declare function setRbacMetadata(target: any, callback: (meta: IRbacDescriptor) => void): void;
|
|
4
|
-
/**
|
|
5
|
-
* Assign resource for controller
|
|
6
|
-
*
|
|
7
|
-
* @param resource - name of resource
|
|
8
|
-
* @param permission - default permission
|
|
9
|
-
*/
|
|
10
|
-
export declare function Resource(resource: string, permission?: PermissionType): any;
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* Assigns permission for controller route
|
|
14
|
-
*
|
|
15
|
-
* @param permission - permission to set
|
|
16
|
-
*/
|
|
17
|
-
export declare function Permission(permission?: PermissionType): any;
|
|
18
|
-
export declare function FromUser(): (target: any, propertyKey?: string | symbol, indexOrDescriptor?: number | PropertyDescriptor) => void;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FromUser = exports.Permission = exports.Resource = exports.setRbacMetadata = exports.ACL_CONTROLLER_DESCRIPTOR = void 0;
|
|
4
|
-
const http_1 = require("@spinajs/http");
|
|
5
|
-
const policies_1 = require("./policies");
|
|
6
|
-
exports.ACL_CONTROLLER_DESCRIPTOR = Symbol('ACL_CONTROLLER_DESCRIPTOR_SYMBOL');
|
|
7
|
-
function setRbacMetadata(target, callback) {
|
|
8
|
-
let metadata = Reflect.getMetadata(exports.ACL_CONTROLLER_DESCRIPTOR, target.prototype || target);
|
|
9
|
-
if (!metadata) {
|
|
10
|
-
metadata = {
|
|
11
|
-
Resource: '',
|
|
12
|
-
Routes: new Map(),
|
|
13
|
-
Permission: 'readOwn',
|
|
14
|
-
};
|
|
15
|
-
Reflect.defineMetadata(exports.ACL_CONTROLLER_DESCRIPTOR, metadata, target.prototype || target);
|
|
16
|
-
}
|
|
17
|
-
if (callback) {
|
|
18
|
-
callback(metadata);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.setRbacMetadata = setRbacMetadata;
|
|
22
|
-
function descriptor(callback) {
|
|
23
|
-
return (target, propertyKey, indexOrDescriptor) => {
|
|
24
|
-
let metadata = Reflect.getMetadata(exports.ACL_CONTROLLER_DESCRIPTOR, target.prototype || target);
|
|
25
|
-
if (!metadata) {
|
|
26
|
-
metadata = {
|
|
27
|
-
Resource: '',
|
|
28
|
-
Routes: new Map(),
|
|
29
|
-
Permission: 'readOwn',
|
|
30
|
-
};
|
|
31
|
-
Reflect.defineMetadata(exports.ACL_CONTROLLER_DESCRIPTOR, metadata, target.prototype || target);
|
|
32
|
-
}
|
|
33
|
-
if (callback) {
|
|
34
|
-
callback(metadata, target, propertyKey, indexOrDescriptor);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Assign resource for controller
|
|
40
|
-
*
|
|
41
|
-
* @param resource - name of resource
|
|
42
|
-
* @param permission - default permission
|
|
43
|
-
*/
|
|
44
|
-
function Resource(resource, permission = 'readOwn') {
|
|
45
|
-
return descriptor((metadata, target) => {
|
|
46
|
-
(0, http_1.Policy)(policies_1.RbacPolicy)(target, null, null);
|
|
47
|
-
metadata.Resource = resource;
|
|
48
|
-
metadata.Permission = permission;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
exports.Resource = Resource;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* Assigns permission for controller route
|
|
55
|
-
*
|
|
56
|
-
* @param permission - permission to set
|
|
57
|
-
*/
|
|
58
|
-
function Permission(permission = 'readOwn') {
|
|
59
|
-
return descriptor((metadata, target, propertyKey) => {
|
|
60
|
-
let route = null;
|
|
61
|
-
if (propertyKey) {
|
|
62
|
-
if (metadata.Routes.has(propertyKey)) {
|
|
63
|
-
route = metadata.Routes.get(propertyKey);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
route = {
|
|
67
|
-
Permission: permission,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
metadata.Routes.set(propertyKey, route);
|
|
71
|
-
}
|
|
72
|
-
(0, http_1.Policy)(policies_1.RbacPolicy)(target, propertyKey, null);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
exports.Permission = Permission;
|
|
76
|
-
function FromUser() {
|
|
77
|
-
return (0, http_1.Route)((0, http_1.Parameter)('UserArg'));
|
|
78
|
-
}
|
|
79
|
-
exports.FromUser = FromUser;
|
|
80
|
-
//# sourceMappingURL=decorators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/decorators.ts"],"names":[],"mappings":";;;AACA,wCAAyD;AACzD,yCAAwC;AAE3B,QAAA,yBAAyB,GAAG,MAAM,CAAC,kCAAkC,CAAC,CAAC;AAEpF,SAAgB,eAAe,CAAC,MAAW,EAAE,QAAyC;IACpF,IAAI,QAAQ,GAAoB,OAAO,CAAC,WAAW,CAAC,iCAAyB,EAAE,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,CAAC;IAC3G,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG;YACT,QAAQ,EAAE,EAAE;YACZ,MAAM,EAAE,IAAI,GAAG,EAA0C;YACzD,UAAU,EAAE,SAAS;SACtB,CAAC;QAEF,OAAO,CAAC,cAAc,CAAC,iCAAyB,EAAE,QAAQ,EAAE,MAAM,CA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GAAmC,IAAI,CAAC;QAEjD,IAAI,WAAW,EAAE;YACf,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;gBACpC,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;aAC1C;iBAAM;gBACL,KAAK,GAAG;oBACN,UAAU,EAAE,UAAU;iBACvB,CAAC;aACH;YAED,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;SACzC;QAED,IAAA,aAAM,EAAC,qBAAU,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC;AAlBD,gCAkBC;AAED,SAAgB,QAAQ;IACtB,OAAO,IAAA,YAAK,EAAC,IAAA,gBAAS,EAAC,SAAS,CAAC,CAAC,CAAC;AACrC,CAAC;AAFD,4BAEC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare const LoginDtoSchema: {
|
|
2
|
-
$schema: string;
|
|
3
|
-
title: string;
|
|
4
|
-
type: string;
|
|
5
|
-
properties: {
|
|
6
|
-
Login: {
|
|
7
|
-
type: string;
|
|
8
|
-
maxLength: number;
|
|
9
|
-
};
|
|
10
|
-
Password: {
|
|
11
|
-
type: string;
|
|
12
|
-
maxLength: number;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
required: string[];
|
|
16
|
-
};
|
|
17
|
-
export declare class LoginDto {
|
|
18
|
-
Login: string;
|
|
19
|
-
Password: string;
|
|
20
|
-
constructor(data: any);
|
|
21
|
-
}
|
|
@@ -1,34 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.LoginDto = exports.LoginDtoSchema = void 0;
|
|
13
|
-
const validation_1 = require("@spinajs/validation");
|
|
14
|
-
exports.LoginDtoSchema = {
|
|
15
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
16
|
-
title: 'User login DTO',
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {
|
|
19
|
-
Login: { type: 'string', maxLength: 32 },
|
|
20
|
-
Password: { type: 'string', maxLength: 32 },
|
|
21
|
-
},
|
|
22
|
-
required: ['Login', 'Password'],
|
|
23
|
-
};
|
|
24
|
-
let LoginDto = class LoginDto {
|
|
25
|
-
constructor(data) {
|
|
26
|
-
Object.assign(this, data);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
LoginDto = __decorate([
|
|
30
|
-
(0, validation_1.Schema)(exports.LoginDtoSchema),
|
|
31
|
-
__metadata("design:paramtypes", [Object])
|
|
32
|
-
], LoginDto);
|
|
33
|
-
exports.LoginDto = LoginDto;
|
|
34
|
-
//# sourceMappingURL=login-dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login-dto.js","sourceRoot":"","sources":["../../../../src/dto/login-dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA6C;AAEhC,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,yCAAyC;IAClD,KAAK,EAAE,gBAAgB;IACvB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;QACxC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;KAC5C;IACD,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;CAChC,CAAC;AAGF,IAAa,QAAQ,GAArB,MAAa,QAAQ;IAKnB,YAAY,IAAS;QACnB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF,CAAA;AARY,QAAQ;IADpB,IAAA,mBAAM,EAAC,sBAAc,CAAC;;GACV,QAAQ,CAQpB;AARY,4BAAQ"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare const PasswordDtoSchema: {
|
|
2
|
-
$schema: string;
|
|
3
|
-
title: string;
|
|
4
|
-
type: string;
|
|
5
|
-
properties: {
|
|
6
|
-
Password: {
|
|
7
|
-
type: string;
|
|
8
|
-
maxLength: number;
|
|
9
|
-
minLength: number;
|
|
10
|
-
};
|
|
11
|
-
ConfirmPassword: {
|
|
12
|
-
type: string;
|
|
13
|
-
maxLength: number;
|
|
14
|
-
minLength: number;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
required: string[];
|
|
18
|
-
};
|
|
19
|
-
export declare class PasswordDto {
|
|
20
|
-
Password: string;
|
|
21
|
-
ConfirmPassword: string;
|
|
22
|
-
constructor(data: any);
|
|
23
|
-
}
|
|
@@ -1,34 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PasswordDto = exports.PasswordDtoSchema = void 0;
|
|
13
|
-
const validation_1 = require("@spinajs/validation");
|
|
14
|
-
exports.PasswordDtoSchema = {
|
|
15
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
16
|
-
title: 'User password DTO',
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {
|
|
19
|
-
Password: { type: 'string', maxLength: 32, minLength: 6 },
|
|
20
|
-
ConfirmPassword: { type: 'string', maxLength: 32, minLength: 6 },
|
|
21
|
-
},
|
|
22
|
-
required: ['Password', 'ConfirmPassword'],
|
|
23
|
-
};
|
|
24
|
-
let PasswordDto = class PasswordDto {
|
|
25
|
-
constructor(data) {
|
|
26
|
-
Object.assign(this, data);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
PasswordDto = __decorate([
|
|
30
|
-
(0, validation_1.Schema)(exports.PasswordDtoSchema),
|
|
31
|
-
__metadata("design:paramtypes", [Object])
|
|
32
|
-
], PasswordDto);
|
|
33
|
-
exports.PasswordDto = PasswordDto;
|
|
34
|
-
//# sourceMappingURL=password-dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"password-dto.js","sourceRoot":"","sources":["../../../../src/dto/password-dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA6C;AAEhC,QAAA,iBAAiB,GAAG;IAC/B,OAAO,EAAE,yCAAyC;IAClD,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE;QACzD,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE;KACjE;IACD,QAAQ,EAAE,CAAC,UAAU,EAAE,iBAAiB,CAAC;CAC1C,CAAC;AAGF,IAAa,WAAW,GAAxB,MAAa,WAAW;IAKtB,YAAY,IAAS;QACnB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF,CAAA;AARY,WAAW;IADvB,IAAA,mBAAM,EAAC,yBAAiB,CAAC;;GACb,WAAW,CAQvB;AARY,kCAAW"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare const UserDtoSchema: {
|
|
2
|
-
$schema: string;
|
|
3
|
-
title: string;
|
|
4
|
-
type: string;
|
|
5
|
-
properties: {
|
|
6
|
-
Id: {
|
|
7
|
-
type: string;
|
|
8
|
-
};
|
|
9
|
-
Email: {
|
|
10
|
-
type: string;
|
|
11
|
-
format: string;
|
|
12
|
-
maxLength: number;
|
|
13
|
-
};
|
|
14
|
-
Login: {
|
|
15
|
-
type: string;
|
|
16
|
-
maxLength: number;
|
|
17
|
-
};
|
|
18
|
-
ConfirmPassword: {
|
|
19
|
-
type: string;
|
|
20
|
-
maxLength: number;
|
|
21
|
-
minLength: number;
|
|
22
|
-
};
|
|
23
|
-
Password: {
|
|
24
|
-
type: string;
|
|
25
|
-
maxLength: number;
|
|
26
|
-
minLength: number;
|
|
27
|
-
};
|
|
28
|
-
NiceName: {
|
|
29
|
-
type: string;
|
|
30
|
-
maxLength: number;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
required: string[];
|
|
34
|
-
};
|
|
35
|
-
export declare class UserDto {
|
|
36
|
-
Id?: number;
|
|
37
|
-
Email: string;
|
|
38
|
-
Login: string;
|
|
39
|
-
Password: string;
|
|
40
|
-
ConfirmPassword: string;
|
|
41
|
-
NiceName: string;
|
|
42
|
-
constructor(data: any);
|
|
43
|
-
}
|
|
@@ -1,38 +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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UserDto = exports.UserDtoSchema = void 0;
|
|
13
|
-
const validation_1 = require("@spinajs/validation");
|
|
14
|
-
exports.UserDtoSchema = {
|
|
15
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
16
|
-
title: 'User DTO',
|
|
17
|
-
type: 'object',
|
|
18
|
-
properties: {
|
|
19
|
-
Id: { type: 'number' },
|
|
20
|
-
Email: { type: 'string', format: 'email', maxLength: 64 },
|
|
21
|
-
Login: { type: 'string', maxLength: 64 },
|
|
22
|
-
ConfirmPassword: { type: 'string', maxLength: 32, minLength: 6 },
|
|
23
|
-
Password: { type: 'string', maxLength: 32, minLength: 6 },
|
|
24
|
-
NiceName: { type: 'string', maxLength: 64 },
|
|
25
|
-
},
|
|
26
|
-
required: ['Email', 'NiceName'],
|
|
27
|
-
};
|
|
28
|
-
let UserDto = class UserDto {
|
|
29
|
-
constructor(data) {
|
|
30
|
-
Object.assign(this, data);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
UserDto = __decorate([
|
|
34
|
-
(0, validation_1.Schema)(exports.UserDtoSchema),
|
|
35
|
-
__metadata("design:paramtypes", [Object])
|
|
36
|
-
], UserDto);
|
|
37
|
-
exports.UserDto = UserDto;
|
|
38
|
-
//# sourceMappingURL=user-dto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-dto.js","sourceRoot":"","sources":["../../../../src/dto/user-dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA6C;AAChC,QAAA,aAAa,GAAG;IAC3B,OAAO,EAAE,yCAAyC;IAClD,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACtB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;QACzD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;QACxC,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE;QAChE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE;QACzD,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;KAC5C;IACD,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;CAChC,CAAC;AAGF,IAAa,OAAO,GAApB,MAAa,OAAO;IAalB,YAAY,IAAS;QACnB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF,CAAA;AAhBY,OAAO;IADnB,IAAA,mBAAM,EAAC,qBAAa,CAAC;;GACT,OAAO,CAgBnB;AAhBY,0BAAO"}
|