@managemint-solutions/sdk 0.8.0 → 0.16.0
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/README.md +73 -1
- package/dist/additional-details/index.d.ts +3 -1
- package/dist/additional-details/index.js +15 -28
- package/dist/additional-details/index.js.map +1 -1
- package/dist/audit/dto.d.ts +13 -0
- package/dist/audit/dto.js +90 -0
- package/dist/audit/dto.js.map +1 -0
- package/dist/audit/index.d.ts +104 -0
- package/dist/audit/index.js +308 -0
- package/dist/audit/index.js.map +1 -0
- package/dist/billing/dto.d.ts +33 -0
- package/dist/billing/dto.js +71 -0
- package/dist/billing/dto.js.map +1 -0
- package/dist/billing/index.d.ts +35 -0
- package/dist/billing/index.js +115 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.js +23 -7
- package/dist/client.js.map +1 -1
- package/dist/clients/index.d.ts +3 -1
- package/dist/clients/index.js +25 -62
- package/dist/clients/index.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/nest/index.d.ts +22 -0
- package/dist/nest/index.js +28 -1
- package/dist/nest/index.js.map +1 -1
- package/dist/notes/index.d.ts +3 -1
- package/dist/notes/index.js +16 -27
- package/dist/notes/index.js.map +1 -1
- package/dist/notifications/dto.d.ts +10 -0
- package/dist/notifications/dto.js +63 -0
- package/dist/notifications/dto.js.map +1 -0
- package/dist/notifications/index.d.ts +139 -0
- package/dist/notifications/index.js +354 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/organizations/dto.d.ts +62 -0
- package/dist/organizations/dto.js +445 -0
- package/dist/organizations/dto.js.map +1 -0
- package/dist/organizations/index.d.ts +72 -0
- package/dist/organizations/index.js +221 -0
- package/dist/organizations/index.js.map +1 -0
- package/dist/permissions/dto.d.ts +27 -0
- package/dist/permissions/dto.js +215 -0
- package/dist/permissions/dto.js.map +1 -0
- package/dist/permissions/index.d.ts +36 -0
- package/dist/permissions/index.js +110 -0
- package/dist/permissions/index.js.map +1 -0
- package/dist/projects/index.d.ts +3 -1
- package/dist/projects/index.js +25 -62
- package/dist/projects/index.js.map +1 -1
- package/dist/service-client/index.d.ts +72 -0
- package/dist/service-client/index.js +119 -0
- package/dist/service-client/index.js.map +1 -0
- package/dist/statuses/index.d.ts +3 -1
- package/dist/statuses/index.js +17 -28
- package/dist/statuses/index.js.map +1 -1
- package/dist/supporting-files/index.d.ts +3 -1
- package/dist/supporting-files/index.js +14 -20
- package/dist/supporting-files/index.js.map +1 -1
- package/dist/tasks/index.d.ts +3 -1
- package/dist/tasks/index.js +21 -50
- package/dist/tasks/index.js.map +1 -1
- package/dist/users/dto.d.ts +48 -0
- package/dist/users/dto.js +267 -0
- package/dist/users/dto.js.map +1 -0
- package/dist/users/index.d.ts +38 -0
- package/dist/users/index.js +144 -0
- package/dist/users/index.js.map +1 -0
- package/dist/webhook-events/index.d.ts +65 -0
- package/dist/webhook-events/index.js +109 -0
- package/dist/webhook-events/index.js.map +1 -0
- package/package.json +2 -2
package/dist/tasks/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.TasksResource = void 0;
|
|
18
|
+
const enum_1 = require("@managemint-solutions/entities/audit-trail/enum");
|
|
19
|
+
const audit_1 = require("../audit");
|
|
18
20
|
const errors_1 = require("../errors");
|
|
19
21
|
__exportStar(require("./dto"), exports);
|
|
20
22
|
// The public contract is the shared TaskSummary / TaskEntity from @managemint-solutions/entities;
|
|
@@ -66,9 +68,14 @@ const TASK_DETAIL_SELECT = `
|
|
|
66
68
|
class TasksResource {
|
|
67
69
|
supabase;
|
|
68
70
|
auth;
|
|
69
|
-
|
|
71
|
+
table;
|
|
72
|
+
constructor(supabase, auth, audit) {
|
|
70
73
|
this.supabase = supabase;
|
|
71
74
|
this.auth = auth;
|
|
75
|
+
this.table = (0, audit_1.auditedTable)(supabase, auth, audit, {
|
|
76
|
+
table: 'tasks',
|
|
77
|
+
entityType: enum_1.AuditTrailEntityType.TASKS,
|
|
78
|
+
});
|
|
72
79
|
}
|
|
73
80
|
async list(query) {
|
|
74
81
|
const page = query.page;
|
|
@@ -152,89 +159,53 @@ class TasksResource {
|
|
|
152
159
|
async create(input) {
|
|
153
160
|
// `task_id` (the per-organization task number) is left out: the table's `set_task_id`
|
|
154
161
|
// BEFORE INSERT trigger fills it in when it arrives null.
|
|
155
|
-
const
|
|
156
|
-
.from('tasks')
|
|
157
|
-
.insert({
|
|
162
|
+
const row = await this.table.insert({
|
|
158
163
|
...input,
|
|
159
164
|
organization_id: this.auth.organization_id,
|
|
160
165
|
created_by: this.auth.mms_id,
|
|
161
166
|
created_at: new Date().toISOString(),
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
.single();
|
|
165
|
-
if (error)
|
|
166
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
167
|
-
return this.getById(data.mms_id);
|
|
167
|
+
});
|
|
168
|
+
return this.getById(row.mms_id);
|
|
168
169
|
}
|
|
169
170
|
async update(taskId, input) {
|
|
170
|
-
|
|
171
|
-
.from('tasks')
|
|
172
|
-
.update({
|
|
171
|
+
await this.table.update(taskId, {
|
|
173
172
|
...input,
|
|
174
173
|
last_updated_by: this.auth.mms_id,
|
|
175
174
|
updated_at: new Date().toISOString(),
|
|
176
|
-
})
|
|
177
|
-
.eq('mms_id', taskId)
|
|
178
|
-
.eq('organization_id', this.auth.organization_id);
|
|
179
|
-
if (error)
|
|
180
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
175
|
+
});
|
|
181
176
|
return this.getById(taskId);
|
|
182
177
|
}
|
|
183
178
|
async archive(taskId) {
|
|
184
|
-
|
|
185
|
-
.from('tasks')
|
|
186
|
-
.update({
|
|
179
|
+
await this.table.transition(taskId, enum_1.AuditTrailAction.ARCHIVE, {
|
|
187
180
|
archived: true,
|
|
188
181
|
archived_at: new Date().toISOString(),
|
|
189
182
|
archived_by: this.auth.mms_id,
|
|
190
|
-
})
|
|
191
|
-
.eq('organization_id', this.auth.organization_id)
|
|
192
|
-
.eq('mms_id', taskId);
|
|
193
|
-
if (error)
|
|
194
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
183
|
+
});
|
|
195
184
|
return this.getById(taskId);
|
|
196
185
|
}
|
|
197
186
|
async unarchive(taskId) {
|
|
198
|
-
|
|
199
|
-
.from('tasks')
|
|
200
|
-
.update({
|
|
187
|
+
await this.table.transition(taskId, enum_1.AuditTrailAction.UNARCHIVE, {
|
|
201
188
|
archived: false,
|
|
202
189
|
unarchived_at: new Date().toISOString(),
|
|
203
190
|
unarchived_by: this.auth.mms_id,
|
|
204
|
-
})
|
|
205
|
-
.eq('organization_id', this.auth.organization_id)
|
|
206
|
-
.eq('mms_id', taskId);
|
|
207
|
-
if (error)
|
|
208
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
191
|
+
});
|
|
209
192
|
return this.getById(taskId);
|
|
210
193
|
}
|
|
211
194
|
async restore(taskId) {
|
|
212
|
-
|
|
213
|
-
.from('tasks')
|
|
214
|
-
.update({
|
|
195
|
+
await this.table.transition(taskId, enum_1.AuditTrailAction.RESTORE, {
|
|
215
196
|
deleted: false,
|
|
216
197
|
restored_at: new Date().toISOString(),
|
|
217
198
|
restored_by: this.auth.mms_id,
|
|
218
|
-
})
|
|
219
|
-
.eq('organization_id', this.auth.organization_id)
|
|
220
|
-
.eq('mms_id', taskId);
|
|
221
|
-
if (error)
|
|
222
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
199
|
+
});
|
|
223
200
|
return this.getById(taskId);
|
|
224
201
|
}
|
|
225
202
|
/** Soft delete — the row stays, flagged `deleted`, and `restore()` brings it back. */
|
|
226
203
|
async remove(taskId) {
|
|
227
|
-
|
|
228
|
-
.from('tasks')
|
|
229
|
-
.update({
|
|
204
|
+
await this.table.transition(taskId, enum_1.AuditTrailAction.DELETE, {
|
|
230
205
|
deleted: true,
|
|
231
206
|
deleted_at: new Date().toISOString(),
|
|
232
207
|
deleted_by: this.auth.mms_id,
|
|
233
|
-
})
|
|
234
|
-
.eq('organization_id', this.auth.organization_id)
|
|
235
|
-
.eq('mms_id', taskId);
|
|
236
|
-
if (error)
|
|
237
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
208
|
+
});
|
|
238
209
|
}
|
|
239
210
|
}
|
|
240
211
|
exports.TasksResource = TasksResource;
|
package/dist/tasks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,0EAGyD;AAEzD,oCAA+E;AAE/E,sCAA8C;AAG9C,wCAAsB;AAEtB,kGAAkG;AAClG,+FAA+F;AAC/F,6CAA6C;AAC7C,MAAM,gBAAgB,GAAG;;;;;;;;;;;;OAYT,CAAC;AAEjB,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BX,CAAC;AAEjB,MAAa,aAAa;IAIL;IACA;IAJF,KAAK,CAAe;IAErC,YACmB,QAA6B,EAC7B,IAAiB,EAClC,KAAoB;QAFH,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,SAAI,GAAJ,IAAI,CAAa;QAGlC,IAAI,CAAC,KAAK,GAAG,IAAA,oBAAY,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;YAC/C,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,2BAAoB,CAAC,KAAK;SACvC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAkB;QAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,MAA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AC;IAC9B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAAc;QAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,uBAAgB,CAAC,OAAO,EAAE;YAC5D,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;SAC9B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,sFAAsF;IACtF,KAAK,CAAC,MAAM,CAAC,MAAc;QACzB,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,uBAAgB,CAAC,MAAM,EAAE;YAC3D,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;SAC7B,CAAC,CAAC;IACL,CAAC;CACF;AA7KD,sCA6KC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CreateUserDto as CreateUserDtoType, GetUsersDto as GetUsersDtoType, UpdateUserDto as UpdateUserDtoType, UserIdDto as UserIdDtoType } from '@managemint-solutions/entities/users/dto';
|
|
2
|
+
import { EmergencyContactRelationship, EmploymentType } from '@managemint-solutions/entities/users/enum';
|
|
3
|
+
export declare class UserIdDto implements UserIdDtoType {
|
|
4
|
+
readonly userId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class AddUserDto implements CreateUserDtoType {
|
|
7
|
+
readonly email: string;
|
|
8
|
+
readonly password: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly surname: string;
|
|
11
|
+
readonly phone: string | null;
|
|
12
|
+
readonly profile_image: string | null;
|
|
13
|
+
readonly country_code: string;
|
|
14
|
+
/**
|
|
15
|
+
* The client's idempotency key for the pro-rata seat charge (principle 1).
|
|
16
|
+
* Optional: an internally created user - the owner at signup - has no client
|
|
17
|
+
* request behind it, and one is generated for it.
|
|
18
|
+
*/
|
|
19
|
+
readonly idempotency_key?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class GetUsersQueryDto implements Omit<GetUsersDtoType, 'active_in'> {
|
|
22
|
+
readonly search?: string | null;
|
|
23
|
+
readonly page: number;
|
|
24
|
+
readonly page_size: number;
|
|
25
|
+
readonly active_in?: boolean[] | null;
|
|
26
|
+
}
|
|
27
|
+
export declare class UpdateUserDto implements UpdateUserDtoType {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly surname: string;
|
|
30
|
+
readonly phone: string;
|
|
31
|
+
readonly country_code: string;
|
|
32
|
+
readonly employment_type: EmploymentType;
|
|
33
|
+
readonly birthday?: string | null;
|
|
34
|
+
readonly start_date?: string | null;
|
|
35
|
+
readonly end_date?: string | null;
|
|
36
|
+
readonly job_title?: string | null;
|
|
37
|
+
readonly manager_id?: string | null;
|
|
38
|
+
readonly social_facebook?: string | null;
|
|
39
|
+
readonly social_linkedin?: string | null;
|
|
40
|
+
readonly social_twitter?: string | null;
|
|
41
|
+
readonly social_instagram?: string | null;
|
|
42
|
+
readonly social_github?: string | null;
|
|
43
|
+
readonly social_website?: string | null;
|
|
44
|
+
readonly emergency_contact_name?: string | null;
|
|
45
|
+
readonly emergency_contact_relationship?: EmergencyContactRelationship | null;
|
|
46
|
+
readonly emergency_contact_phone?: string | null;
|
|
47
|
+
readonly emergency_contact_email?: string | null;
|
|
48
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
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.UpdateUserDto = exports.GetUsersQueryDto = exports.AddUserDto = exports.UserIdDto = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const validators_1 = require("../validators");
|
|
16
|
+
const enum_1 = require("@managemint-solutions/entities/users/enum");
|
|
17
|
+
class UserIdDto {
|
|
18
|
+
userId;
|
|
19
|
+
}
|
|
20
|
+
exports.UserIdDto = UserIdDto;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, class_validator_1.IsUUID)('4', { message: 'Invalid user ID format' }),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], UserIdDto.prototype, "userId", void 0);
|
|
25
|
+
class AddUserDto {
|
|
26
|
+
email;
|
|
27
|
+
password;
|
|
28
|
+
name;
|
|
29
|
+
surname;
|
|
30
|
+
phone;
|
|
31
|
+
profile_image;
|
|
32
|
+
country_code;
|
|
33
|
+
/**
|
|
34
|
+
* The client's idempotency key for the pro-rata seat charge (principle 1).
|
|
35
|
+
* Optional: an internally created user - the owner at signup - has no client
|
|
36
|
+
* request behind it, and one is generated for it.
|
|
37
|
+
*/
|
|
38
|
+
idempotency_key;
|
|
39
|
+
}
|
|
40
|
+
exports.AddUserDto = AddUserDto;
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, class_validator_1.IsEmail)({}, { message: 'Invalid email address' }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], AddUserDto.prototype, "email", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_validator_1.IsString)({ message: 'Password is required' }),
|
|
47
|
+
(0, class_validator_1.MinLength)(8, { message: 'Password must be at least 8 characters' }),
|
|
48
|
+
(0, class_validator_1.Matches)(/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[!@#$%^&*])/, { message: 'Password must contain at least 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character (!@#$%^&*)' }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], AddUserDto.prototype, "password", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, class_validator_1.IsString)({ message: 'Name is required' }),
|
|
53
|
+
(0, class_validator_1.MinLength)(1, { message: 'Name is required' }),
|
|
54
|
+
(0, class_validator_1.MaxLength)(50, { message: 'Name cannot be longer than 50 characters' }),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], AddUserDto.prototype, "name", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, class_validator_1.IsString)({ message: 'Surname is required' }),
|
|
59
|
+
(0, class_validator_1.MinLength)(1, { message: 'Surname is required' }),
|
|
60
|
+
(0, class_validator_1.MaxLength)(50, { message: 'Surname cannot be longer than 50 characters' }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], AddUserDto.prototype, "surname", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, validators_1.IsNullable)(),
|
|
65
|
+
(0, class_validator_1.IsString)({ message: 'Phone number' }),
|
|
66
|
+
__metadata("design:type", Object)
|
|
67
|
+
], AddUserDto.prototype, "phone", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, validators_1.IsNullable)(),
|
|
70
|
+
(0, class_validator_1.IsString)({ message: 'Profile image URL' }),
|
|
71
|
+
__metadata("design:type", Object)
|
|
72
|
+
], AddUserDto.prototype, "profile_image", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, class_validator_1.IsString)({ message: 'Country code is required' }),
|
|
75
|
+
(0, class_validator_1.MinLength)(1, { message: 'Country code is required' }),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], AddUserDto.prototype, "country_code", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, class_validator_1.IsOptional)(),
|
|
80
|
+
(0, class_validator_1.IsUUID)('4', { message: 'Invalid idempotency key format' }),
|
|
81
|
+
__metadata("design:type", String)
|
|
82
|
+
], AddUserDto.prototype, "idempotency_key", void 0);
|
|
83
|
+
// `active_in` arrives as a CSV string and is transformed to booleans, so it is omitted from the
|
|
84
|
+
// implemented contract — the same exception GetClientsDto makes for status_id_in.
|
|
85
|
+
class GetUsersQueryDto {
|
|
86
|
+
search;
|
|
87
|
+
page = 1;
|
|
88
|
+
page_size = 10;
|
|
89
|
+
// Comma-joined booleans on the wire, e.g. "true,false". Absent = all users.
|
|
90
|
+
active_in;
|
|
91
|
+
}
|
|
92
|
+
exports.GetUsersQueryDto = GetUsersQueryDto;
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, class_validator_1.IsOptional)(),
|
|
95
|
+
(0, validators_1.IsNullable)(),
|
|
96
|
+
(0, class_validator_1.IsString)({ message: 'Invalid search query' }),
|
|
97
|
+
(0, class_validator_1.MinLength)(1, { message: 'Search query cannot be empty' }),
|
|
98
|
+
(0, class_validator_1.MaxLength)(255, { message: 'Search query cannot exceed 255 characters' }),
|
|
99
|
+
__metadata("design:type", Object)
|
|
100
|
+
], GetUsersQueryDto.prototype, "search", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, class_validator_1.IsOptional)(),
|
|
103
|
+
(0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : 1, { toClassOnly: true }),
|
|
104
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page must be a number' }),
|
|
105
|
+
(0, class_validator_1.Min)(1, { message: 'Page must be at least 1' }),
|
|
106
|
+
__metadata("design:type", Number)
|
|
107
|
+
], GetUsersQueryDto.prototype, "page", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, class_validator_1.IsOptional)(),
|
|
110
|
+
(0, class_transformer_1.Transform)(({ value }) => value ? Number(value) : 10, { toClassOnly: true }),
|
|
111
|
+
(0, class_validator_1.IsNumber)({}, { message: 'Page size must be a number' }),
|
|
112
|
+
(0, class_validator_1.Min)(1, { message: 'Page size must be at least 1' }),
|
|
113
|
+
(0, class_validator_1.Max)(100, { message: 'Page size cannot exceed 100' }),
|
|
114
|
+
__metadata("design:type", Number)
|
|
115
|
+
], GetUsersQueryDto.prototype, "page_size", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, class_validator_1.IsOptional)(),
|
|
118
|
+
(0, validators_1.IsNullable)(),
|
|
119
|
+
(0, class_transformer_1.Transform)(({ value }) => value ? value.split(',').map((entry) => entry.trim() === 'true') : null, { toClassOnly: true }),
|
|
120
|
+
(0, class_validator_1.IsBoolean)({ each: true, message: 'Active filter values must be booleans' }),
|
|
121
|
+
__metadata("design:type", Object)
|
|
122
|
+
], GetUsersQueryDto.prototype, "active_in", void 0);
|
|
123
|
+
class UpdateUserDto {
|
|
124
|
+
name;
|
|
125
|
+
surname;
|
|
126
|
+
phone;
|
|
127
|
+
country_code;
|
|
128
|
+
employment_type;
|
|
129
|
+
birthday;
|
|
130
|
+
start_date;
|
|
131
|
+
end_date;
|
|
132
|
+
job_title;
|
|
133
|
+
manager_id;
|
|
134
|
+
social_facebook;
|
|
135
|
+
social_linkedin;
|
|
136
|
+
social_twitter;
|
|
137
|
+
social_instagram;
|
|
138
|
+
social_github;
|
|
139
|
+
social_website;
|
|
140
|
+
emergency_contact_name;
|
|
141
|
+
emergency_contact_relationship;
|
|
142
|
+
emergency_contact_phone;
|
|
143
|
+
emergency_contact_email;
|
|
144
|
+
}
|
|
145
|
+
exports.UpdateUserDto = UpdateUserDto;
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, class_validator_1.IsString)({ message: 'Invalid name' }),
|
|
148
|
+
(0, class_validator_1.MinLength)(1, { message: 'Name is required' }),
|
|
149
|
+
(0, class_validator_1.MaxLength)(50, { message: 'Name cannot be longer than 50 characters' }),
|
|
150
|
+
__metadata("design:type", String)
|
|
151
|
+
], UpdateUserDto.prototype, "name", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
(0, class_validator_1.IsString)({ message: 'Invalid surname' }),
|
|
154
|
+
(0, class_validator_1.MinLength)(1, { message: 'Surname is required' }),
|
|
155
|
+
(0, class_validator_1.MaxLength)(50, { message: 'Surname cannot be longer than 50 characters' }),
|
|
156
|
+
__metadata("design:type", String)
|
|
157
|
+
], UpdateUserDto.prototype, "surname", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, class_validator_1.IsString)({ message: 'Invalid phone number' }),
|
|
160
|
+
__metadata("design:type", String)
|
|
161
|
+
], UpdateUserDto.prototype, "phone", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, class_validator_1.IsString)({ message: 'Country code is required' }),
|
|
164
|
+
(0, class_validator_1.MinLength)(1, { message: 'Country code is required' }),
|
|
165
|
+
__metadata("design:type", String)
|
|
166
|
+
], UpdateUserDto.prototype, "country_code", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
(0, class_validator_1.IsOptional)(),
|
|
169
|
+
(0, class_validator_1.IsEnum)(enum_1.EmploymentType, { message: 'Invalid employment type' }),
|
|
170
|
+
__metadata("design:type", String)
|
|
171
|
+
], UpdateUserDto.prototype, "employment_type", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
(0, class_validator_1.IsOptional)(),
|
|
174
|
+
(0, validators_1.IsNullable)(),
|
|
175
|
+
(0, class_validator_1.IsDateString)({}, { message: 'Birthday must be a valid ISO 8601 date string' }),
|
|
176
|
+
__metadata("design:type", Object)
|
|
177
|
+
], UpdateUserDto.prototype, "birthday", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
(0, class_validator_1.IsOptional)(),
|
|
180
|
+
(0, validators_1.IsNullable)(),
|
|
181
|
+
(0, class_validator_1.IsDateString)({}, { message: 'Start date must be a valid ISO 8601 date string' }),
|
|
182
|
+
__metadata("design:type", Object)
|
|
183
|
+
], UpdateUserDto.prototype, "start_date", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, class_validator_1.IsOptional)(),
|
|
186
|
+
(0, validators_1.IsNullable)(),
|
|
187
|
+
(0, class_validator_1.IsDateString)({}, { message: 'End date must be a valid ISO 8601 date string' }),
|
|
188
|
+
__metadata("design:type", Object)
|
|
189
|
+
], UpdateUserDto.prototype, "end_date", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
(0, class_validator_1.IsOptional)(),
|
|
192
|
+
(0, validators_1.IsNullable)(),
|
|
193
|
+
(0, class_validator_1.IsString)({ message: 'Invalid job title' }),
|
|
194
|
+
(0, class_validator_1.MaxLength)(100, { message: 'Job title cannot be longer than 100 characters' }),
|
|
195
|
+
__metadata("design:type", Object)
|
|
196
|
+
], UpdateUserDto.prototype, "job_title", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
(0, class_validator_1.IsOptional)(),
|
|
199
|
+
(0, validators_1.IsNullable)(),
|
|
200
|
+
(0, class_validator_1.IsUUID)('4', { message: 'Invalid manager ID format' }),
|
|
201
|
+
__metadata("design:type", Object)
|
|
202
|
+
], UpdateUserDto.prototype, "manager_id", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
(0, class_validator_1.IsOptional)(),
|
|
205
|
+
(0, validators_1.IsNullable)(),
|
|
206
|
+
(0, class_validator_1.IsUrl)({}, { message: 'Invalid Facebook URL' }),
|
|
207
|
+
__metadata("design:type", Object)
|
|
208
|
+
], UpdateUserDto.prototype, "social_facebook", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
(0, class_validator_1.IsOptional)(),
|
|
211
|
+
(0, validators_1.IsNullable)(),
|
|
212
|
+
(0, class_validator_1.IsUrl)({}, { message: 'Invalid LinkedIn URL' }),
|
|
213
|
+
__metadata("design:type", Object)
|
|
214
|
+
], UpdateUserDto.prototype, "social_linkedin", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
(0, class_validator_1.IsOptional)(),
|
|
217
|
+
(0, validators_1.IsNullable)(),
|
|
218
|
+
(0, class_validator_1.IsUrl)({}, { message: 'Invalid Twitter URL' }),
|
|
219
|
+
__metadata("design:type", Object)
|
|
220
|
+
], UpdateUserDto.prototype, "social_twitter", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
(0, class_validator_1.IsOptional)(),
|
|
223
|
+
(0, validators_1.IsNullable)(),
|
|
224
|
+
(0, class_validator_1.IsUrl)({}, { message: 'Invalid Instagram URL' }),
|
|
225
|
+
__metadata("design:type", Object)
|
|
226
|
+
], UpdateUserDto.prototype, "social_instagram", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
(0, class_validator_1.IsOptional)(),
|
|
229
|
+
(0, validators_1.IsNullable)(),
|
|
230
|
+
(0, class_validator_1.IsUrl)({}, { message: 'Invalid GitHub URL' }),
|
|
231
|
+
__metadata("design:type", Object)
|
|
232
|
+
], UpdateUserDto.prototype, "social_github", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
(0, class_validator_1.IsOptional)(),
|
|
235
|
+
(0, validators_1.IsNullable)(),
|
|
236
|
+
(0, class_validator_1.IsUrl)({}, { message: 'Invalid website URL' }),
|
|
237
|
+
__metadata("design:type", Object)
|
|
238
|
+
], UpdateUserDto.prototype, "social_website", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
(0, class_validator_1.IsOptional)(),
|
|
241
|
+
(0, validators_1.IsNullable)(),
|
|
242
|
+
(0, class_validator_1.IsString)({ message: 'Invalid emergency contact name' }),
|
|
243
|
+
(0, class_validator_1.MinLength)(1, { message: 'Emergency contact name is required' }),
|
|
244
|
+
(0, class_validator_1.MaxLength)(50, { message: 'Emergency contact name cannot be longer than 50 characters' }),
|
|
245
|
+
__metadata("design:type", Object)
|
|
246
|
+
], UpdateUserDto.prototype, "emergency_contact_name", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
(0, class_validator_1.IsOptional)(),
|
|
249
|
+
(0, validators_1.IsNullable)(),
|
|
250
|
+
(0, class_validator_1.IsEnum)(enum_1.EmergencyContactRelationship, { message: 'Invalid emergency contact relationship' }),
|
|
251
|
+
(0, class_validator_1.MinLength)(1, { message: 'Emergency contact relationship is required' }),
|
|
252
|
+
(0, class_validator_1.MaxLength)(50, { message: 'Emergency contact relationship cannot be longer than 50 characters' }),
|
|
253
|
+
__metadata("design:type", Object)
|
|
254
|
+
], UpdateUserDto.prototype, "emergency_contact_relationship", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
(0, class_validator_1.IsOptional)(),
|
|
257
|
+
(0, validators_1.IsNullable)(),
|
|
258
|
+
(0, class_validator_1.IsString)({ message: 'Invalid emergency contact phone number' }),
|
|
259
|
+
__metadata("design:type", Object)
|
|
260
|
+
], UpdateUserDto.prototype, "emergency_contact_phone", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
(0, class_validator_1.IsOptional)(),
|
|
263
|
+
(0, validators_1.IsNullable)(),
|
|
264
|
+
(0, class_validator_1.IsEmail)({}, { message: 'Invalid emergency contact email address' }),
|
|
265
|
+
__metadata("design:type", Object)
|
|
266
|
+
], UpdateUserDto.prototype, "emergency_contact_email", void 0);
|
|
267
|
+
//# sourceMappingURL=dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto.js","sourceRoot":"","sources":["../../src/users/dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,qDAeyB;AACzB,yDAA8C;AAC9C,8CAA2C;AAC3C,oEAAyG;AAEzG,MAAa,SAAS;IAEX,MAAM,CAAU;CAC1B;AAHD,8BAGC;AADU;IADR,IAAA,wBAAM,EAAC,GAAG,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE,CAAC;;yCAC1B;AAG3B,MAAa,UAAU;IAEZ,KAAK,CAAU;IAQf,QAAQ,CAAU;IAKlB,IAAI,CAAU;IAKd,OAAO,CAAU;IAIjB,KAAK,CAAiB;IAItB,aAAa,CA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AAoC,EAAE,CAAC;IAC/D,IAAA,2BAAS,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,4DAA4D,EAAE,CAAC;;6DACzC;AAOvC;IALR,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAU,GAAE;IACZ,IAAA,wBAAM,EAAC,mCAA4B,EAAE,EAAE,OAAO,EAAE,wCAAwC,EAAE,CAAC;IAC3F,IAAA,2BAAS,EAAC,CAAC,EAAE,EAAE,OAAO,EAAE,4CAA4C,EAAE,CAAC;IACvE,IAAA,2BAAS,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,oEAAoE,EAAE,CAAC;;qEACnB;AAKrE;IAHR,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAU,GAAE;IACZ,IAAA,0BAAQ,EAAC,EAAE,OAAO,EAAE,wCAAwC,EAAE,CAAC;;8DACf;AAKxC;IAHR,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAU,GAAE;IACZ,IAAA,yBAAO,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,yCAAyC,EAAE,CAAC;;8DACnB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { MmsList } from '@managemint-solutions/entities/common';
|
|
2
|
+
import type { UserIdentity, UserSummary } from '@managemint-solutions/entities/users';
|
|
3
|
+
import { type AuditActor, type AuditResource, type AuditRow } from '../audit';
|
|
4
|
+
import type { TypedSupabaseClient } from '../client';
|
|
5
|
+
import type { GetUsersQueryDto } from './dto';
|
|
6
|
+
export * from './dto';
|
|
7
|
+
/** The full users row. The api resolves its manager/created_by/last_updated_by ids into identities. */
|
|
8
|
+
export type UserRow = Record<string, unknown> & {
|
|
9
|
+
mms_id: string;
|
|
10
|
+
manager_id: string | null;
|
|
11
|
+
created_by: string | null;
|
|
12
|
+
last_updated_by: string | null;
|
|
13
|
+
};
|
|
14
|
+
export declare class UsersResource {
|
|
15
|
+
private readonly supabase;
|
|
16
|
+
private readonly auth;
|
|
17
|
+
private readonly table;
|
|
18
|
+
constructor(supabase: TypedSupabaseClient, auth: AuditActor, audit: AuditResource);
|
|
19
|
+
list(query: GetUsersQueryDto): Promise<MmsList<UserSummary>>;
|
|
20
|
+
getRow(userId: string): Promise<UserRow>;
|
|
21
|
+
/**
|
|
22
|
+
* The public profile behind a `*_by` / `manager_id` column. `user_profiles` is a
|
|
23
|
+
* `security_invoker = off` view granted to `authenticated`, so this runs on the caller's own
|
|
24
|
+
* client — it needs no service role.
|
|
25
|
+
*/
|
|
26
|
+
identityById(userId?: string | null): Promise<UserIdentity | null>;
|
|
27
|
+
/** Seats in use. Counts rows rather than fetching them. */
|
|
28
|
+
activeCount(): Promise<number>;
|
|
29
|
+
isActive(userId: string): Promise<boolean>;
|
|
30
|
+
update(userId: string, patch: AuditRow): Promise<UserRow>;
|
|
31
|
+
/** `active` is not an archive flag, so a deactivation is recorded as a plain UPDATE. */
|
|
32
|
+
setActive(userId: string, active: boolean): Promise<UserRow>;
|
|
33
|
+
/**
|
|
34
|
+
* Stamps who created a user. Runs on the service client during signup: the row is written by
|
|
35
|
+
* the `on_auth_user_created` trigger, so there is nothing to attribute it to until afterwards.
|
|
36
|
+
*/
|
|
37
|
+
stampCreatedBy(userId: string, createdBy: string | null): Promise<AuditRow>;
|
|
38
|
+
}
|