@darraghor/nest-backend-libs 2.17.4 → 2.17.6
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.
|
@@ -5,7 +5,7 @@ import { RequestWithUser } from "../authz/RequestWithUser";
|
|
|
5
5
|
export declare class PersonController {
|
|
6
6
|
private readonly personService;
|
|
7
7
|
constructor(personService: PersonService);
|
|
8
|
-
|
|
8
|
+
findOne(request: RequestWithUser, uuid: string): Promise<Person>;
|
|
9
9
|
update(uuid: string, updatePersonDto: UpdatePersonDto, request: RequestWithUser): Promise<import("typeorm").UpdateResult>;
|
|
10
10
|
remove(uuid: string, request: RequestWithUser): Promise<boolean>;
|
|
11
11
|
}
|
|
@@ -19,15 +19,19 @@ const update_person_dto_1 = require("./dto/update-person.dto");
|
|
|
19
19
|
const swagger_1 = require("@nestjs/swagger");
|
|
20
20
|
const person_entity_1 = require("./entities/person.entity");
|
|
21
21
|
const passport_1 = require("@nestjs/passport");
|
|
22
|
+
const class_validator_1 = require("class-validator");
|
|
22
23
|
let PersonController = class PersonController {
|
|
23
24
|
personService;
|
|
24
25
|
constructor(personService) {
|
|
25
26
|
this.personService = personService;
|
|
26
27
|
}
|
|
27
|
-
async
|
|
28
|
+
async findOne(request, uuid) {
|
|
28
29
|
if (uuid === "me") {
|
|
29
30
|
return this.personService.findOne(request.user.id);
|
|
30
31
|
}
|
|
32
|
+
if ((0, class_validator_1.isUUID)(uuid, "4")) {
|
|
33
|
+
throw new common_1.BadRequestException(uuid, "Invalid UUID");
|
|
34
|
+
}
|
|
31
35
|
// find the person if they are in the same organisation as the user
|
|
32
36
|
return await this.personService.findOneIfSameOrganisation(uuid, request.user);
|
|
33
37
|
}
|
|
@@ -47,7 +51,7 @@ __decorate([
|
|
|
47
51
|
__metadata("design:type", Function),
|
|
48
52
|
__metadata("design:paramtypes", [Object, String]),
|
|
49
53
|
__metadata("design:returntype", Promise)
|
|
50
|
-
], PersonController.prototype, "
|
|
54
|
+
], PersonController.prototype, "findOne", null);
|
|
51
55
|
__decorate([
|
|
52
56
|
(0, common_1.Patch)(":uuid"),
|
|
53
57
|
(0, swagger_1.ApiOkResponse)({ type: person_entity_1.Person }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.controller.js","sourceRoot":"","sources":["../../src/person/person.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"person.controller.js","sourceRoot":"","sources":["../../src/person/person.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AACxB,qDAA+C;AAC/C,+DAAwD;AACxD,6CAAsE;AACtE,4DAAgD;AAChD,+CAA2C;AAE3C,qDAAuC;AAKhC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACI;IAA7B,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAIvD,AAAN,KAAK,CAAC,OAAO,CACE,OAAwB,EACpB,IAAY;QAE3B,IAAI,IAAI,KAAK,IAAI,EAAE;YACf,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACtD;QACD,IAAI,IAAA,wBAAM,EAAC,IAAI,EAAE,GAAG,CAAC,EAAE;YACnB,MAAM,IAAI,4BAAmB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;SACvD;QAED,mEAAmE;QACnE,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CACrD,IAAI,EACJ,OAAO,CAAC,IAAI,CACf,CAAC;IACN,CAAC;IAIK,AAAN,KAAK,CAAC,MAAM,CACO,IAAY,EACnB,eAAgC,EAC7B,OAAwB;QAEnC,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAC5B,IAAI,EACJ,eAAe,EACf,OAAO,CAAC,IAAI,CAAC,IAAI,CACpB,CAAC;IACN,CAAC;IAIK,AAAN,KAAK,CAAC,MAAM,CAC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