rez_core 1.0.9 → 1.0.10

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.
@@ -1,11 +1,13 @@
1
- import { Repository } from 'typeorm';
1
+ import { EntityManager, Repository } from 'typeorm';
2
2
  import { OrganizationData } from '../entity/organization.entity';
3
+ import { ClockIDGenService } from 'src/utils/service/clockIDGenUtil.service';
3
4
  export declare class OrganizationService {
4
5
  private readonly organizationRepository;
5
- constructor(organizationRepository: Repository<OrganizationData>);
6
- create(organizationDto: Partial<OrganizationData>): Promise<OrganizationData>;
7
- findAll(): Promise<OrganizationData[]>;
8
- findOne(id: number): Promise<OrganizationData | null>;
9
- update(id: number, organizationDto: Partial<OrganizationData>): Promise<OrganizationData | null>;
10
- remove(id: number): Promise<void>;
6
+ private readonly idGen;
7
+ constructor(organizationRepository: Repository<OrganizationData>, idGen: ClockIDGenService);
8
+ create(organizationDto: Partial<OrganizationData>, manager?: EntityManager): Promise<OrganizationData>;
9
+ findAll(manager?: EntityManager): Promise<OrganizationData[]>;
10
+ findOne(id: number, manager?: EntityManager): Promise<OrganizationData | null>;
11
+ update(id: number, organizationDto: Partial<OrganizationData>, manager?: EntityManager): Promise<OrganizationData | null>;
12
+ remove(id: number, manager?: EntityManager): Promise<void>;
11
13
  }
@@ -17,32 +17,53 @@ const common_1 = require("@nestjs/common");
17
17
  const typeorm_1 = require("@nestjs/typeorm");
18
18
  const typeorm_2 = require("typeorm");
19
19
  const organization_entity_1 = require("../entity/organization.entity");
20
+ const clockIDGenUtil_service_1 = require("../../../utils/service/clockIDGenUtil.service");
20
21
  let OrganizationService = class OrganizationService {
21
- constructor(organizationRepository) {
22
+ constructor(organizationRepository, idGen) {
22
23
  this.organizationRepository = organizationRepository;
24
+ this.idGen = idGen;
23
25
  }
24
- async create(organizationDto) {
25
- const organization = this.organizationRepository.create(organizationDto);
26
- return await this.organizationRepository.save(organization);
26
+ async create(organizationDto, manager) {
27
+ const repo = manager
28
+ ? manager.getRepository(organization_entity_1.OrganizationData)
29
+ : this.organizationRepository;
30
+ organizationDto.code = this.idGen.idGenerator('ORG');
31
+ organizationDto.status = 'ACTIVE';
32
+ organizationDto.created_date = new Date();
33
+ const organization = repo.create(organizationDto);
34
+ return await repo.save(organization);
27
35
  }
28
- async findAll() {
29
- return await this.organizationRepository.find();
36
+ async findAll(manager) {
37
+ const repo = manager
38
+ ? manager.getRepository(organization_entity_1.OrganizationData)
39
+ : this.organizationRepository;
40
+ return await repo.find();
30
41
  }
31
- async findOne(id) {
32
- return await this.organizationRepository.findOne({ where: { id } });
42
+ async findOne(id, manager) {
43
+ const repo = manager
44
+ ? manager.getRepository(organization_entity_1.OrganizationData)
45
+ : this.organizationRepository;
46
+ return await repo.findOne({ where: { id } });
33
47
  }
34
- async update(id, organizationDto) {
35
- await this.organizationRepository.update(id, organizationDto);
36
- return this.findOne(id);
48
+ async update(id, organizationDto, manager) {
49
+ const repo = manager
50
+ ? manager.getRepository(organization_entity_1.OrganizationData)
51
+ : this.organizationRepository;
52
+ await repo.update(id, organizationDto);
53
+ return await repo.findOne({ where: { id } });
37
54
  }
38
- async remove(id) {
39
- await this.organizationRepository.delete(id);
55
+ async remove(id, manager) {
56
+ const repo = manager
57
+ ? manager.getRepository(organization_entity_1.OrganizationData)
58
+ : this.organizationRepository;
59
+ await repo.delete(id);
40
60
  }
41
61
  };
42
62
  exports.OrganizationService = OrganizationService;
43
63
  exports.OrganizationService = OrganizationService = __decorate([
44
64
  (0, common_1.Injectable)(),
45
65
  __param(0, (0, typeorm_1.InjectRepository)(organization_entity_1.OrganizationData)),
46
- __metadata("design:paramtypes", [typeorm_2.Repository])
66
+ __metadata("design:paramtypes", [typeorm_2.Repository,
67
+ clockIDGenUtil_service_1.ClockIDGenService])
47
68
  ], OrganizationService);
48
69
  //# sourceMappingURL=organization.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"organization.service.js","sourceRoot":"","sources":["../../../../src/module/enterprise/service/organization.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AACrC,uEAAiE;AAG1D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YAEmB,sBAAoD;QAApD,2BAAsB,GAAtB,sBAAsB,CAA8B;IACpE,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,eAA0C;QACrD,MAAM,YAAY,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACzE,OAAO,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,OAAO,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,eAA0C;QACjE,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF,CAAA;AA3BY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,sCAAgB,CAAC,CAAA;qCACM,oBAAU;GAH1C,mBAAmB,CA2B/B"}
1
+ {"version":3,"file":"organization.service.js","sourceRoot":"","sources":["../../../../src/module/enterprise/service/organization.service.ts"],"names":[],"mappings":";;;;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