@hed-hog/contact 0.0.146 → 0.0.148
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/person/person.controller.js +1 -1
- package/dist/person/person.controller.js.map +1 -1
- package/dist/person/person.module.d.ts.map +1 -1
- package/dist/person/person.module.js +1 -29
- package/dist/person/person.module.js.map +1 -1
- package/dist/person/person.service.d.ts +3 -3
- package/dist/person/person.service.d.ts.map +1 -1
- package/dist/person/person.service.js +21 -6
- package/dist/person/person.service.js.map +1 -1
- package/package.json +2 -2
- package/src/person/person.controller.ts +1 -1
- package/src/person/person.module.ts +1 -29
- package/src/person/person.service.ts +30 -6
- package/src/person/address/address.controller.ts +0 -67
- package/src/person/address/address.service.ts +0 -91
- package/src/person/address/dto/create.dto.ts +0 -30
- package/src/person/address/dto/update.dto.ts +0 -4
- package/src/person/contact/contact.controller.ts +0 -67
- package/src/person/contact/contact.service.ts +0 -83
- package/src/person/contact/dto/create.dto.ts +0 -14
- package/src/person/contact/dto/update.dto.ts +0 -4
- package/src/person/document/document.controller.ts +0 -67
- package/src/person/document/document.service.ts +0 -83
- package/src/person/document/dto/create.dto.ts +0 -10
- package/src/person/document/dto/update.dto.ts +0 -4
- package/src/person/person-company/dto/create.dto.ts +0 -14
- package/src/person/person-company/dto/update.dto.ts +0 -4
- package/src/person/person-company/person-company.controller.ts +0 -45
- package/src/person/person-company/person-company.service.ts +0 -32
- package/src/person/person-individual/dto/create.dto.ts +0 -20
- package/src/person/person-individual/dto/update.dto.ts +0 -4
- package/src/person/person-individual/person-individual.controller.ts +0 -45
- package/src/person/person-individual/person-individual.service.ts +0 -36
- package/src/person/person-metadata/dto/create.dto.ts +0 -9
- package/src/person/person-metadata/dto/update.dto.ts +0 -4
- package/src/person/person-metadata/person-metadata.controller.ts +0 -67
- package/src/person/person-metadata/person-metadata.service.ts +0 -83
- package/src/person/person-relation/dto/create.dto.ts +0 -10
- package/src/person/person-relation/dto/update.dto.ts +0 -4
- package/src/person/person-relation/person-relation.controller.ts +0 -67
- package/src/person/person-relation/person-relation.service.ts +0 -91
|
@@ -31,7 +31,7 @@ let PersonController = class PersonController {
|
|
|
31
31
|
return this.personService.list(Object.assign(Object.assign({}, paginationParams), filters));
|
|
32
32
|
}
|
|
33
33
|
async get(id, locale) {
|
|
34
|
-
return this.personService.get(id);
|
|
34
|
+
return this.personService.get(locale, id);
|
|
35
35
|
}
|
|
36
36
|
async create(data) {
|
|
37
37
|
return this.personService.create(data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.controller.js","sourceRoot":"","sources":["../../src/person/person.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA+C;AAC/C,oDAA6C;AAC7C,4DAAqD;AACrD,2CAYwB;AACxB,iDAA6C;AAC7C,iDAAsD;AACtD,qDAAiD;AAI1C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAEmB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAC5C,CAAC;IAGE,AAAN,KAAK,CAAC,QAAQ;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IACvC,CAAC;IAGK,AAAN,KAAK,CAAC,IAAI,CAAe,gBAAgB,EAAW,OAAO;QACzD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,iCAAM,gBAAgB,GAAK,OAAO,EAAG,CAAC;IACtE,CAAC;IAGK,AAAN,KAAK,CAAC,GAAG,CAA4B,EAAU,EAAY,MAAc;QACvE,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"person.controller.js","sourceRoot":"","sources":["../../src/person/person.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA+C;AAC/C,oDAA6C;AAC7C,4DAAqD;AACrD,2CAYwB;AACxB,iDAA6C;AAC7C,iDAAsD;AACtD,qDAAiD;AAI1C,IAA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,WAAA,IAAA,mBAAM,GAAE,CAAA;;;;2CAEzD;AAGK;IADL,IAAA,aAAI,GAAE;IACO,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,sBAAS;;8CAEnC;AAGK;IADL,IAAA,cAAK,EAAC,KAAK,CAAC;IAEV,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IACzB,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,mBAAM,GAAE,CAAA;;6CADK,+BAAkB;;8CAIjC;AAGK;IADL,IAAA,eAAM,GAAE;IACK,WAAA,IAAA,aAAI,GAAE,CAAA;IAAmB,WAAA,IAAA,mBAAM,GAAE,CAAA;;qCAApB,eAAS;;8CAEnC;2BAtCU,gBAAgB;IAF5B,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,QAAQ,CAAC;IAGhB,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAa,CAAC,CAAC,CAAA;qCACR,8BAAa;GAHpC,gBAAgB,CAuC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.module.d.ts","sourceRoot":"","sources":["../../src/person/person.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"person.module.d.ts","sourceRoot":"","sources":["../../src/person/person.module.ts"],"names":[],"mappings":"AAMA,qBAca,YAAY;CAAG"}
|
|
@@ -7,24 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.PersonModule = void 0;
|
|
10
|
-
const core_1 = require("@hed-hog/core");
|
|
11
10
|
const api_pagination_1 = require("@hed-hog/api-pagination");
|
|
12
11
|
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
12
|
+
const core_1 = require("@hed-hog/core");
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
-
const address_controller_1 = require("./address/address.controller");
|
|
15
|
-
const address_service_1 = require("./address/address.service");
|
|
16
|
-
const contact_controller_1 = require("./contact/contact.controller");
|
|
17
|
-
const contact_service_1 = require("./contact/contact.service");
|
|
18
|
-
const document_controller_1 = require("./document/document.controller");
|
|
19
|
-
const document_service_1 = require("./document/document.service");
|
|
20
|
-
const person_company_controller_1 = require("./person-company/person-company.controller");
|
|
21
|
-
const person_company_service_1 = require("./person-company/person-company.service");
|
|
22
|
-
const person_individual_controller_1 = require("./person-individual/person-individual.controller");
|
|
23
|
-
const person_individual_service_1 = require("./person-individual/person-individual.service");
|
|
24
|
-
const person_metadata_controller_1 = require("./person-metadata/person-metadata.controller");
|
|
25
|
-
const person_metadata_service_1 = require("./person-metadata/person-metadata.service");
|
|
26
|
-
const person_relation_controller_1 = require("./person-relation/person-relation.controller");
|
|
27
|
-
const person_relation_service_1 = require("./person-relation/person-relation.service");
|
|
28
14
|
const person_controller_1 = require("./person.controller");
|
|
29
15
|
const person_service_1 = require("./person.service");
|
|
30
16
|
let PersonModule = class PersonModule {
|
|
@@ -38,23 +24,9 @@ exports.PersonModule = PersonModule = __decorate([
|
|
|
38
24
|
(0, common_1.forwardRef)(() => api_pagination_1.PaginationModule),
|
|
39
25
|
],
|
|
40
26
|
controllers: [
|
|
41
|
-
person_metadata_controller_1.PersonMetadataController,
|
|
42
|
-
address_controller_1.PersonAddressController,
|
|
43
|
-
contact_controller_1.PersonContactController,
|
|
44
|
-
document_controller_1.PersonDocumentController,
|
|
45
|
-
person_relation_controller_1.PersonRelationController,
|
|
46
|
-
person_individual_controller_1.PersonIndividualController,
|
|
47
|
-
person_company_controller_1.PersonCompanyController,
|
|
48
27
|
person_controller_1.PersonController,
|
|
49
28
|
],
|
|
50
29
|
providers: [
|
|
51
|
-
person_metadata_service_1.PersonMetadataService,
|
|
52
|
-
address_service_1.PersonAddressService,
|
|
53
|
-
contact_service_1.PersonContactService,
|
|
54
|
-
document_service_1.PersonDocumentService,
|
|
55
|
-
person_relation_service_1.PersonRelationService,
|
|
56
|
-
person_individual_service_1.PersonIndividualService,
|
|
57
|
-
person_company_service_1.PersonCompanyService,
|
|
58
30
|
person_service_1.PersonService,
|
|
59
31
|
],
|
|
60
32
|
exports: [(0, common_1.forwardRef)(() => person_service_1.PersonService)],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.module.js","sourceRoot":"","sources":["../../src/person/person.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"person.module.js","sourceRoot":"","sources":["../../src/person/person.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,4DAA2D;AAC3D,oDAAmD;AACnD,wCAA2C;AAC3C,2CAAoD;AACpD,2DAAuD;AACvD,qDAAiD;AAe1C,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,oCAAY;uBAAZ,YAAY;IAdxB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAgB,CAAC;SACnC;QACD,WAAW,EAAE;YACX,oCAAgB;SACjB;QACD,SAAS,EAAE;YACT,8BAAa;SACd;QACD,OAAO,EAAE,CAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAa,CAAC,CAAC;KAC3C,CAAC;GACW,YAAY,CAAG"}
|
|
@@ -25,7 +25,7 @@ export declare class PersonService {
|
|
|
25
25
|
next: number;
|
|
26
26
|
data: any[];
|
|
27
27
|
}>;
|
|
28
|
-
get(id: number): Promise<{
|
|
28
|
+
get(locale: string, id: number): Promise<{
|
|
29
29
|
name: string;
|
|
30
30
|
type: import("@prisma/client").$Enums.person_type_enum;
|
|
31
31
|
id: number;
|
|
@@ -41,9 +41,9 @@ export declare class PersonService {
|
|
|
41
41
|
updated_at: Date;
|
|
42
42
|
status: import("@prisma/client").$Enums.person_status_enum;
|
|
43
43
|
}>;
|
|
44
|
-
update(id: number, data: any, locale
|
|
44
|
+
update(id: number, data: any, locale: string): Promise<{
|
|
45
45
|
success: boolean;
|
|
46
46
|
}>;
|
|
47
|
-
delete({ ids }: DeleteDTO, locale
|
|
47
|
+
delete({ ids }: DeleteDTO, locale: string): Promise<[import("@prisma/client").Prisma.BatchPayload, import("@prisma/client").Prisma.BatchPayload, import("@prisma/client").Prisma.BatchPayload, import("@prisma/client").Prisma.BatchPayload]>;
|
|
48
48
|
}
|
|
49
49
|
//# sourceMappingURL=person.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.service.d.ts","sourceRoot":"","sources":["../../src/person/person.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,aAAa;IAGtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,QAAQ;;;;;;;IAkBR,IAAI,CAAC,gBAAgB,EAAE,aAAa,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;;;;;;;;;IAqCvE,GAAG,CAAC,EAAE,EAAE,MAAM;;;;;;;;
|
|
1
|
+
{"version":3,"file":"person.service.d.ts","sourceRoot":"","sources":["../../src/person/person.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,aAAa;IAGtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,QAAQ;;;;;;;IAkBR,IAAI,CAAC,gBAAgB,EAAE,aAAa,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;;;;;;;;;IAqCvE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;;;;;;;;IAS9B,MAAM,CAAC,IAAI,EAAE,SAAS;;;;;;;;IAMtB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM;;;IA+G5C,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM;CAoChD"}
|
|
@@ -67,17 +67,23 @@ let PersonService = class PersonService {
|
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
async get(id) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
async get(locale, id) {
|
|
71
|
+
const person = await this.prismaService.person.findUnique({ where: { id } });
|
|
72
|
+
if (!person) {
|
|
73
|
+
throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('personNotFound', locale, `Person with ID ${id} not found`));
|
|
74
|
+
}
|
|
75
|
+
return person;
|
|
74
76
|
}
|
|
75
77
|
async create(data) {
|
|
76
78
|
return this.prismaService.person.create({
|
|
77
79
|
data,
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
|
-
async update(id, data, locale
|
|
82
|
+
async update(id, data, locale) {
|
|
83
|
+
const person = await this.prismaService.person.findUnique({ where: { id } });
|
|
84
|
+
if (!person) {
|
|
85
|
+
throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('personNotFound', locale, `Person with ID ${id} not found`));
|
|
86
|
+
}
|
|
81
87
|
const incomingContacts = data.contacts || [];
|
|
82
88
|
const incomingAddresses = data.addresses || [];
|
|
83
89
|
const incomingDocuments = data.documents || [];
|
|
@@ -171,10 +177,19 @@ let PersonService = class PersonService {
|
|
|
171
177
|
return { success: true };
|
|
172
178
|
});
|
|
173
179
|
}
|
|
174
|
-
async delete({ ids }, locale
|
|
180
|
+
async delete({ ids }, locale) {
|
|
175
181
|
if (ids == undefined || ids == null) {
|
|
176
182
|
throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('deleteItemsRequired', locale, 'You must select at least one item to delete.'));
|
|
177
183
|
}
|
|
184
|
+
const existing = await this.prismaService.person.findMany({
|
|
185
|
+
where: { id: { in: ids } },
|
|
186
|
+
select: { id: true },
|
|
187
|
+
});
|
|
188
|
+
const existingIds = existing.map(p => p.id);
|
|
189
|
+
const missingIds = ids.filter(id => !existingIds.includes(id));
|
|
190
|
+
if (missingIds.length > 0) {
|
|
191
|
+
throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('personNotFound', locale, `Person(s) with ID(s) ${missingIds.join(', ')} not found.`));
|
|
192
|
+
}
|
|
178
193
|
return this.prismaService.$transaction([
|
|
179
194
|
this.prismaService.contact.deleteMany({ where: { person_id: { in: ids } } }),
|
|
180
195
|
this.prismaService.address.deleteMany({ where: { person_id: { in: ids } } }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.service.js","sourceRoot":"","sources":["../../src/person/person.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,oDAAoD;AACpD,4DAA2E;AAC3E,oDAAoD;AACpD,2CAKwB;AAIjB,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,k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.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"@nestjs/jwt": "^11",
|
|
11
11
|
"@nestjs/mapped-types": "*",
|
|
12
12
|
"@hed-hog/api-mail": "0.0.7",
|
|
13
|
-
"@hed-hog/api-prisma": "0.0.4",
|
|
14
13
|
"@hed-hog/api-locale": "0.0.11",
|
|
15
14
|
"@hed-hog/core": "0.0.145",
|
|
15
|
+
"@hed-hog/api-prisma": "0.0.4",
|
|
16
16
|
"@hed-hog/api-pagination": "0.0.5",
|
|
17
17
|
"@hed-hog/api": "0.0.3"
|
|
18
18
|
},
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
import { CoreModule } from "@hed-hog/core";
|
|
2
1
|
import { PaginationModule } from "@hed-hog/api-pagination";
|
|
3
2
|
import { PrismaModule } from "@hed-hog/api-prisma";
|
|
3
|
+
import { CoreModule } from "@hed-hog/core";
|
|
4
4
|
import { forwardRef, Module } from "@nestjs/common";
|
|
5
|
-
import { PersonAddressController } from "./address/address.controller";
|
|
6
|
-
import { PersonAddressService } from "./address/address.service";
|
|
7
|
-
import { PersonContactController } from "./contact/contact.controller";
|
|
8
|
-
import { PersonContactService } from "./contact/contact.service";
|
|
9
|
-
import { PersonDocumentController } from "./document/document.controller";
|
|
10
|
-
import { PersonDocumentService } from "./document/document.service";
|
|
11
|
-
import { PersonCompanyController } from "./person-company/person-company.controller";
|
|
12
|
-
import { PersonCompanyService } from "./person-company/person-company.service";
|
|
13
|
-
import { PersonIndividualController } from "./person-individual/person-individual.controller";
|
|
14
|
-
import { PersonIndividualService } from "./person-individual/person-individual.service";
|
|
15
|
-
import { PersonMetadataController } from "./person-metadata/person-metadata.controller";
|
|
16
|
-
import { PersonMetadataService } from "./person-metadata/person-metadata.service";
|
|
17
|
-
import { PersonRelationController } from "./person-relation/person-relation.controller";
|
|
18
|
-
import { PersonRelationService } from "./person-relation/person-relation.service";
|
|
19
5
|
import { PersonController } from "./person.controller";
|
|
20
6
|
import { PersonService } from "./person.service";
|
|
21
7
|
@Module({
|
|
@@ -25,23 +11,9 @@ import { PersonService } from "./person.service";
|
|
|
25
11
|
forwardRef(() => PaginationModule),
|
|
26
12
|
],
|
|
27
13
|
controllers: [
|
|
28
|
-
PersonMetadataController,
|
|
29
|
-
PersonAddressController,
|
|
30
|
-
PersonContactController,
|
|
31
|
-
PersonDocumentController,
|
|
32
|
-
PersonRelationController,
|
|
33
|
-
PersonIndividualController,
|
|
34
|
-
PersonCompanyController,
|
|
35
14
|
PersonController,
|
|
36
15
|
],
|
|
37
16
|
providers: [
|
|
38
|
-
PersonMetadataService,
|
|
39
|
-
PersonAddressService,
|
|
40
|
-
PersonContactService,
|
|
41
|
-
PersonDocumentService,
|
|
42
|
-
PersonRelationService,
|
|
43
|
-
PersonIndividualService,
|
|
44
|
-
PersonCompanyService,
|
|
45
17
|
PersonService,
|
|
46
18
|
],
|
|
47
19
|
exports: [forwardRef(() => PersonService)],
|
|
@@ -74,10 +74,13 @@ export class PersonService {
|
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
async get(id: number) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
async get(locale: string, id: number) {
|
|
78
|
+
const person = await this.prismaService.person.findUnique({ where: { id } });
|
|
79
|
+
if (!person) {
|
|
80
|
+
throw new BadRequestException(getLocaleText('personNotFound', locale, `Person with ID ${id} not found`));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return person
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
async create(data: CreateDTO) {
|
|
@@ -86,7 +89,12 @@ export class PersonService {
|
|
|
86
89
|
});
|
|
87
90
|
}
|
|
88
91
|
|
|
89
|
-
async update(id: number, data: any, locale: string
|
|
92
|
+
async update(id: number, data: any, locale: string) {
|
|
93
|
+
const person = await this.prismaService.person.findUnique({ where: { id } });
|
|
94
|
+
if (!person) {
|
|
95
|
+
throw new BadRequestException(getLocaleText('personNotFound', locale, `Person with ID ${id} not found`));
|
|
96
|
+
}
|
|
97
|
+
|
|
90
98
|
const incomingContacts = data.contacts || [];
|
|
91
99
|
const incomingAddresses = data.addresses || [];
|
|
92
100
|
const incomingDocuments = data.documents || [];
|
|
@@ -192,13 +200,29 @@ export class PersonService {
|
|
|
192
200
|
});
|
|
193
201
|
}
|
|
194
202
|
|
|
195
|
-
async delete({ ids }: DeleteDTO, locale: string
|
|
203
|
+
async delete({ ids }: DeleteDTO, locale: string) {
|
|
196
204
|
if (ids == undefined || ids == null) {
|
|
197
205
|
throw new BadRequestException(
|
|
198
206
|
getLocaleText('deleteItemsRequired', locale, 'You must select at least one item to delete.'),
|
|
199
207
|
);
|
|
200
208
|
}
|
|
201
209
|
|
|
210
|
+
const existing = await this.prismaService.person.findMany({
|
|
211
|
+
where: { id: { in: ids } },
|
|
212
|
+
select: { id: true },
|
|
213
|
+
});
|
|
214
|
+
const existingIds = existing.map(p => p.id);
|
|
215
|
+
const missingIds = ids.filter(id => !existingIds.includes(id));
|
|
216
|
+
if (missingIds.length > 0) {
|
|
217
|
+
throw new BadRequestException(
|
|
218
|
+
getLocaleText(
|
|
219
|
+
'personNotFound',
|
|
220
|
+
locale,
|
|
221
|
+
`Person(s) with ID(s) ${missingIds.join(', ')} not found.`
|
|
222
|
+
)
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
202
226
|
return this.prismaService.$transaction([
|
|
203
227
|
this.prismaService.contact.deleteMany({ where: { person_id: { in: ids } } }),
|
|
204
228
|
this.prismaService.address.deleteMany({ where: { person_id: { in: ids } } }),
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { DeleteDTO, Role } from '@hed-hog/api';
|
|
2
|
-
import { Pagination } from '@hed-hog/api-pagination';
|
|
3
|
-
import {
|
|
4
|
-
Body,
|
|
5
|
-
Controller,
|
|
6
|
-
Delete,
|
|
7
|
-
Get,
|
|
8
|
-
Inject,
|
|
9
|
-
Param,
|
|
10
|
-
ParseIntPipe,
|
|
11
|
-
Patch,
|
|
12
|
-
Post,
|
|
13
|
-
forwardRef
|
|
14
|
-
} from '@nestjs/common';
|
|
15
|
-
import { PersonAddressService } from './address.service';
|
|
16
|
-
import { CreateDTO } from './dto/create.dto';
|
|
17
|
-
import { UpdateDTO } from './dto/update.dto';
|
|
18
|
-
|
|
19
|
-
@Role()
|
|
20
|
-
@Controller('person/:personId/person-address')
|
|
21
|
-
export class PersonAddressController {
|
|
22
|
-
constructor(
|
|
23
|
-
@Inject(forwardRef(() => PersonAddressService))
|
|
24
|
-
private readonly personAddressService: PersonAddressService
|
|
25
|
-
) {}
|
|
26
|
-
|
|
27
|
-
@Post()
|
|
28
|
-
create(
|
|
29
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
30
|
-
@Body() data: CreateDTO
|
|
31
|
-
) {
|
|
32
|
-
return this.personAddressService.create(personId, data);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Get()
|
|
36
|
-
list(
|
|
37
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
38
|
-
@Pagination() paginationParams
|
|
39
|
-
) {
|
|
40
|
-
return this.personAddressService.list(paginationParams, personId);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@Get(':id')
|
|
44
|
-
get(
|
|
45
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
46
|
-
@Param('id', ParseIntPipe) id: number
|
|
47
|
-
) {
|
|
48
|
-
return this.personAddressService.get(personId, id);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@Patch(':id')
|
|
52
|
-
update(
|
|
53
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
54
|
-
@Param('id', ParseIntPipe) id: number,
|
|
55
|
-
@Body() data: UpdateDTO
|
|
56
|
-
) {
|
|
57
|
-
return this.personAddressService.update(personId, id, data);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@Delete()
|
|
61
|
-
delete(
|
|
62
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
63
|
-
@Body() { ids }: DeleteDTO
|
|
64
|
-
) {
|
|
65
|
-
return this.personAddressService.delete(personId, { ids });
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { DeleteDTO } from '@hed-hog/api';
|
|
2
|
-
import { getLocaleText } from '@hed-hog/api-locale';
|
|
3
|
-
import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
|
|
4
|
-
import { PrismaService } from '@hed-hog/api-prisma';
|
|
5
|
-
import {
|
|
6
|
-
BadRequestException,
|
|
7
|
-
Injectable
|
|
8
|
-
} from '@nestjs/common';
|
|
9
|
-
import { CreateDTO } from './dto/create.dto';
|
|
10
|
-
import { UpdateDTO } from './dto/update.dto';
|
|
11
|
-
|
|
12
|
-
@Injectable()
|
|
13
|
-
export class PersonAddressService {
|
|
14
|
-
constructor(
|
|
15
|
-
private readonly prismaService: PrismaService,
|
|
16
|
-
private readonly paginationService: PaginationService
|
|
17
|
-
) {}
|
|
18
|
-
|
|
19
|
-
async create(personId: number, data: CreateDTO) {
|
|
20
|
-
const { address_type_id, ...addressData } = data;
|
|
21
|
-
return this.prismaService.address.create({
|
|
22
|
-
data: {
|
|
23
|
-
...addressData,
|
|
24
|
-
line2: addressData.line2 || '',
|
|
25
|
-
person: {
|
|
26
|
-
connect: { id: personId }
|
|
27
|
-
},
|
|
28
|
-
address_type: {
|
|
29
|
-
connect: { id: address_type_id }
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async get(personId: number, id: number) {
|
|
36
|
-
return this.prismaService.address.findFirst({
|
|
37
|
-
where: {
|
|
38
|
-
person_id: personId,
|
|
39
|
-
id: id
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async list(paginationParams: PaginationDTO, personId?: number) {
|
|
45
|
-
const where: any = {};
|
|
46
|
-
if (personId !== undefined) where.person_id = personId;
|
|
47
|
-
|
|
48
|
-
return this.paginationService.paginate(
|
|
49
|
-
this.prismaService.address,
|
|
50
|
-
{
|
|
51
|
-
fields:
|
|
52
|
-
'is_primary,country_code,state,city,postal_code,line1,line2',
|
|
53
|
-
...paginationParams
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
where
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async update(personId: number, id: number, data: UpdateDTO) {
|
|
62
|
-
return this.prismaService.address.updateMany({
|
|
63
|
-
where: {
|
|
64
|
-
person_id: personId,
|
|
65
|
-
id: id
|
|
66
|
-
},
|
|
67
|
-
data
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async delete(personId: number, { ids }: DeleteDTO, locale: string = 'en') {
|
|
72
|
-
if (ids == undefined || ids == null) {
|
|
73
|
-
throw new BadRequestException(
|
|
74
|
-
getLocaleText(
|
|
75
|
-
'deleteItemsRequired',
|
|
76
|
-
locale,
|
|
77
|
-
'You must select at least one item to delete.',
|
|
78
|
-
),
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return this.prismaService.address.deleteMany({
|
|
83
|
-
where: {
|
|
84
|
-
person_id: personId,
|
|
85
|
-
id: {
|
|
86
|
-
in: ids
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getLocaleText } from '@hed-hog/api-locale';
|
|
2
|
-
import { IsBoolean, IsNumber, IsOptional, IsString } from 'class-validator';
|
|
3
|
-
|
|
4
|
-
export class CreateDTO {
|
|
5
|
-
@IsNumber({}, { message: (args) => getLocaleText('validation.numberRequired', args.value) })
|
|
6
|
-
address_type_id: number;
|
|
7
|
-
|
|
8
|
-
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
9
|
-
country_code: string;
|
|
10
|
-
|
|
11
|
-
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
12
|
-
state: string;
|
|
13
|
-
|
|
14
|
-
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
15
|
-
city: string;
|
|
16
|
-
|
|
17
|
-
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
18
|
-
postal_code: string;
|
|
19
|
-
|
|
20
|
-
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
21
|
-
line1: string;
|
|
22
|
-
|
|
23
|
-
@IsOptional()
|
|
24
|
-
@IsString({ message: (args) => getLocaleText('validation.stringRequired', args.value) })
|
|
25
|
-
line2?: string;
|
|
26
|
-
|
|
27
|
-
@IsOptional()
|
|
28
|
-
@IsBoolean({ message: (args) => getLocaleText('validation.booleanRequired', args.value) })
|
|
29
|
-
is_primary?: boolean;
|
|
30
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { DeleteDTO, Role } from '@hed-hog/api';
|
|
2
|
-
import { Pagination } from '@hed-hog/api-pagination';
|
|
3
|
-
import {
|
|
4
|
-
Body,
|
|
5
|
-
Controller,
|
|
6
|
-
Delete,
|
|
7
|
-
Get,
|
|
8
|
-
Inject,
|
|
9
|
-
Param,
|
|
10
|
-
ParseIntPipe,
|
|
11
|
-
Patch,
|
|
12
|
-
Post,
|
|
13
|
-
forwardRef
|
|
14
|
-
} from '@nestjs/common';
|
|
15
|
-
import { PersonContactService } from './contact.service';
|
|
16
|
-
import { CreateDTO } from './dto/create.dto';
|
|
17
|
-
import { UpdateDTO } from './dto/update.dto';
|
|
18
|
-
|
|
19
|
-
@Role()
|
|
20
|
-
@Controller('person/:personId/person-contact')
|
|
21
|
-
export class PersonContactController {
|
|
22
|
-
constructor(
|
|
23
|
-
@Inject(forwardRef(() => PersonContactService))
|
|
24
|
-
private readonly personContactService: PersonContactService
|
|
25
|
-
) {}
|
|
26
|
-
|
|
27
|
-
@Post()
|
|
28
|
-
create(
|
|
29
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
30
|
-
@Body() data: CreateDTO
|
|
31
|
-
) {
|
|
32
|
-
return this.personContactService.create(personId, data);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Get()
|
|
36
|
-
list(
|
|
37
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
38
|
-
@Pagination() paginationParams
|
|
39
|
-
) {
|
|
40
|
-
return this.personContactService.list(paginationParams, personId);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@Get(':id')
|
|
44
|
-
get(
|
|
45
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
46
|
-
@Param('id', ParseIntPipe) id: number
|
|
47
|
-
) {
|
|
48
|
-
return this.personContactService.get(personId, id);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@Patch(':id')
|
|
52
|
-
update(
|
|
53
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
54
|
-
@Param('id', ParseIntPipe) id: number,
|
|
55
|
-
@Body() data: UpdateDTO
|
|
56
|
-
) {
|
|
57
|
-
return this.personContactService.update(personId, id, data);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@Delete()
|
|
61
|
-
delete(
|
|
62
|
-
@Param('personId', ParseIntPipe) personId: number,
|
|
63
|
-
@Body() { ids }: DeleteDTO
|
|
64
|
-
) {
|
|
65
|
-
return this.personContactService.delete(personId, { ids });
|
|
66
|
-
}
|
|
67
|
-
}
|