@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.
Files changed (41) hide show
  1. package/dist/person/person.controller.js +1 -1
  2. package/dist/person/person.controller.js.map +1 -1
  3. package/dist/person/person.module.d.ts.map +1 -1
  4. package/dist/person/person.module.js +1 -29
  5. package/dist/person/person.module.js.map +1 -1
  6. package/dist/person/person.service.d.ts +3 -3
  7. package/dist/person/person.service.d.ts.map +1 -1
  8. package/dist/person/person.service.js +21 -6
  9. package/dist/person/person.service.js.map +1 -1
  10. package/package.json +2 -2
  11. package/src/person/person.controller.ts +1 -1
  12. package/src/person/person.module.ts +1 -29
  13. package/src/person/person.service.ts +30 -6
  14. package/src/person/address/address.controller.ts +0 -67
  15. package/src/person/address/address.service.ts +0 -91
  16. package/src/person/address/dto/create.dto.ts +0 -30
  17. package/src/person/address/dto/update.dto.ts +0 -4
  18. package/src/person/contact/contact.controller.ts +0 -67
  19. package/src/person/contact/contact.service.ts +0 -83
  20. package/src/person/contact/dto/create.dto.ts +0 -14
  21. package/src/person/contact/dto/update.dto.ts +0 -4
  22. package/src/person/document/document.controller.ts +0 -67
  23. package/src/person/document/document.service.ts +0 -83
  24. package/src/person/document/dto/create.dto.ts +0 -10
  25. package/src/person/document/dto/update.dto.ts +0 -4
  26. package/src/person/person-company/dto/create.dto.ts +0 -14
  27. package/src/person/person-company/dto/update.dto.ts +0 -4
  28. package/src/person/person-company/person-company.controller.ts +0 -45
  29. package/src/person/person-company/person-company.service.ts +0 -32
  30. package/src/person/person-individual/dto/create.dto.ts +0 -20
  31. package/src/person/person-individual/dto/update.dto.ts +0 -4
  32. package/src/person/person-individual/person-individual.controller.ts +0 -45
  33. package/src/person/person-individual/person-individual.service.ts +0 -36
  34. package/src/person/person-metadata/dto/create.dto.ts +0 -9
  35. package/src/person/person-metadata/dto/update.dto.ts +0 -4
  36. package/src/person/person-metadata/person-metadata.controller.ts +0 -67
  37. package/src/person/person-metadata/person-metadata.service.ts +0 -83
  38. package/src/person/person-relation/dto/create.dto.ts +0 -10
  39. package/src/person/person-relation/dto/update.dto.ts +0 -4
  40. package/src/person/person-relation/person-relation.controller.ts +0 -67
  41. package/src/person/person-relation/person-relation.service.ts +0 -91
@@ -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 { CreateDTO } from './dto/create.dto';
16
- import { UpdateDTO } from './dto/update.dto';
17
- import { PersonRelationService } from './person-relation.service';
18
-
19
- @Role()
20
- @Controller('person/:personId/person-relation')
21
- export class PersonRelationController {
22
- constructor(
23
- @Inject(forwardRef(() => PersonRelationService))
24
- private readonly personRelationService: PersonRelationService
25
- ) {}
26
-
27
- @Post()
28
- create(
29
- @Param('personId', ParseIntPipe) personId: number,
30
- @Body() data: CreateDTO
31
- ) {
32
- return this.personRelationService.create(personId, data);
33
- }
34
-
35
- @Get()
36
- list(
37
- @Param('personId', ParseIntPipe) personId: number,
38
- @Pagination() paginationParams
39
- ) {
40
- return this.personRelationService.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.personRelationService.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.personRelationService.update(personId, id, data);
58
- }
59
-
60
- @Delete()
61
- delete(
62
- @Param('personId', ParseIntPipe) personId: number,
63
- @Body() { ids }: DeleteDTO
64
- ) {
65
- return this.personRelationService.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 PersonRelationService {
14
- constructor(
15
- private readonly prismaService: PrismaService,
16
- private readonly paginationService: PaginationService
17
- ) {}
18
-
19
- async create(personId: number, data: CreateDTO) {
20
- return this.prismaService.person_relation.create({
21
- data: {
22
- person_id: personId,
23
- ...data
24
- }
25
- });
26
- }
27
-
28
- async get(personId: number, id: number) {
29
- return this.prismaService.person_relation.findFirst({
30
- where: {
31
- person_id: personId,
32
- id: id
33
- },
34
- include: {
35
- person_relation_type: true,
36
- person_person_relation_related_person_idToperson: true,
37
- }
38
- });
39
- }
40
-
41
- async list(paginationParams: PaginationDTO, personId?: number) {
42
- const where: any = {};
43
- if (personId !== undefined) where.person_id = personId;
44
-
45
- return this.paginationService.paginate(
46
- this.prismaService.person_relation,
47
- {
48
- fields: 'related_person_id,relation_type_id',
49
- ...paginationParams
50
- },
51
- {
52
- where,
53
- include: {
54
- person_relation_type: true,
55
- person_person_relation_related_person_idToperson: true,
56
- }
57
- }
58
- );
59
- }
60
-
61
- async update(personId: number, id: number, data: UpdateDTO) {
62
- return this.prismaService.person_relation.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.person_relation.deleteMany({
83
- where: {
84
- person_id: personId,
85
- id: {
86
- in: ids
87
- }
88
- }
89
- });
90
- }
91
- }