@new-hros/libs-sql 1.0.0 → 1.1.1

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.
@@ -4,8 +4,5 @@ export declare abstract class BaseEntity {
4
4
  createdAt: Date;
5
5
  updatedAt: Date;
6
6
  deletedAt?: Date;
7
- isDeleted: boolean;
8
7
  version: number;
9
- createdBy?: string;
10
- updatedBy?: string;
11
8
  }
@@ -17,10 +17,7 @@ class BaseEntity {
17
17
  createdAt;
18
18
  updatedAt;
19
19
  deletedAt;
20
- isDeleted;
21
20
  version;
22
- createdBy;
23
- updatedBy;
24
21
  }
25
22
  exports.BaseEntity = BaseEntity;
26
23
  __decorate([
@@ -29,7 +26,7 @@ __decorate([
29
26
  ], BaseEntity.prototype, "id", void 0);
30
27
  __decorate([
31
28
  (0, typeorm_1.Index)(),
32
- (0, typeorm_1.Column)({ name: 'tenant_code', type: 'varchar', length: 64 }),
29
+ (0, typeorm_1.Column)({ name: 'tenant_code', type: 'varchar', length: 16 }),
33
30
  __metadata("design:type", String)
34
31
  ], BaseEntity.prototype, "tenantCode", void 0);
35
32
  __decorate([
@@ -44,20 +41,8 @@ __decorate([
44
41
  (0, typeorm_1.DeleteDateColumn)({ name: 'deleted_at', type: 'timestamptz', nullable: true }),
45
42
  __metadata("design:type", Date)
46
43
  ], BaseEntity.prototype, "deletedAt", void 0);
47
- __decorate([
48
- (0, typeorm_1.Column)({ name: 'is_deleted', type: 'boolean', default: false }),
49
- __metadata("design:type", Boolean)
50
- ], BaseEntity.prototype, "isDeleted", void 0);
51
44
  __decorate([
52
45
  (0, typeorm_1.VersionColumn)({ default: 1 }),
53
46
  __metadata("design:type", Number)
54
47
  ], BaseEntity.prototype, "version", void 0);
55
- __decorate([
56
- (0, typeorm_1.Column)({ name: 'created_by', type: 'varchar', length: 128, nullable: true }),
57
- __metadata("design:type", String)
58
- ], BaseEntity.prototype, "createdBy", void 0);
59
- __decorate([
60
- (0, typeorm_1.Column)({ name: 'updated_by', type: 'varchar', length: 128, nullable: true }),
61
- __metadata("design:type", String)
62
- ], BaseEntity.prototype, "updatedBy", void 0);
63
48
  //# sourceMappingURL=base.entity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.entity.js","sourceRoot":"","sources":["../src/base.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAQiB;AAEjB,MAAsB,UAAU;IAE9B,EAAE,CAAU;IAIZ,UAAU,CAAU;IAGpB,SAAS,CAAQ;IAGjB,SAAS,CAAQ;IAGjB,SAAS,CAAQ;IAGjB,SAAS,CAAW;IAGpB,OAAO,CAAU;IAGjB,SAAS,CAAU;IAGnB,SAAS,CAAU;CACpB;AA5BD,gCA4BC;AA1BC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;sCACnB;AAIZ;IAFC,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;8CACzC;AAGpB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAClD,IAAI;6CAAC;AAGjB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;8BAClD,IAAI;6CAAC;AAGjB;IADC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BAClE,IAAI;6CAAC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;6CAC5C;AAGpB;IADC,IAAA,uBAAa,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;2CACb;AAGjB;IADC,IAAA,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';
2
- import { TransactionService } from './transaction.service';
3
- import { PaginationOptions, PaginatedResult } from './pagination';
1
+ import { DeepPartial, FindOptionsWhere, Repository } from 'typeorm';
4
2
  import { BaseEntity } from './base.entity';
3
+ import { PaginatedResult, PaginationOptions } from './pagination';
4
+ import { TransactionService } from './transaction.service';
5
+ export interface QueryOneOptions {
6
+ required?: boolean;
7
+ }
8
+ export interface QueryManyOptions {
9
+ onlyIds?: boolean;
10
+ pagination?: PaginationOptions;
11
+ cache?: boolean;
12
+ withDeleted?: boolean;
13
+ }
5
14
  export declare abstract class BaseRepository<Entity extends BaseEntity> {
6
15
  protected readonly entityTarget: new () => Entity;
7
16
  protected readonly transactionService: TransactionService;
@@ -9,10 +18,26 @@ export declare abstract class BaseRepository<Entity extends BaseEntity> {
9
18
  protected get repository(): Repository<Entity>;
10
19
  protected get tenantCode(): string;
11
20
  private applyTenantScope;
12
- create(entityData: Partial<Entity>): Promise<Entity>;
21
+ create(entityData: DeepPartial<Entity>): Promise<Entity>;
22
+ findOne(where: FindOptionsWhere<Entity>): Promise<Entity | null>;
23
+ findOne(where: FindOptionsWhere<Entity>, options: QueryOneOptions & {
24
+ required: true;
25
+ }): Promise<Entity>;
13
26
  findById(id: string): Promise<Entity | null>;
27
+ findById(id: string, options: QueryOneOptions & {
28
+ required: true;
29
+ }): Promise<Entity>;
14
30
  findPaginated(options: PaginationOptions, where?: FindOptionsWhere<Entity>): Promise<PaginatedResult<Entity>>;
15
- update(id: string, entityData: Partial<Entity>): Promise<Entity>;
31
+ find(where: FindOptionsWhere<Entity>): Promise<Entity[]>;
32
+ find(where: FindOptionsWhere<Entity>, options: QueryManyOptions & {
33
+ onlyIds: true;
34
+ }): Promise<string[]>;
35
+ find(where: FindOptionsWhere<Entity>, options: QueryManyOptions & {
36
+ pagination: PaginationOptions;
37
+ }): Promise<PaginatedResult<Entity>>;
38
+ update(id: string, entityData: DeepPartial<Entity>): Promise<Entity>;
16
39
  delete(id: string): Promise<void>;
40
+ forceDelete(id: string): Promise<void>;
17
41
  restore(id: string): Promise<void>;
42
+ exists(where: FindOptionsWhere<Entity>): Promise<boolean>;
18
43
  }
@@ -21,23 +21,33 @@ class BaseRepository {
21
21
  return code;
22
22
  }
23
23
  applyTenantScope(where) {
24
- const scope = { tenantCode: this.tenantCode, isDeleted: false };
24
+ const scope = { tenantCode: this.tenantCode };
25
25
  return { ...(where || {}), ...scope };
26
26
  }
27
27
  async create(entityData) {
28
- const user = libs_core_1.RequestContextService.getUser();
29
28
  const entity = this.repository.create({
30
29
  ...entityData,
31
30
  tenantCode: this.tenantCode,
32
- createdBy: user?.userId || undefined,
33
- updatedBy: user?.userId || undefined,
34
31
  });
35
32
  return this.repository.save(entity);
36
33
  }
37
- async findById(id) {
38
- return this.repository.findOne({
34
+ async findOne(where, options) {
35
+ const data = await this.repository.findOne({
36
+ where: this.applyTenantScope(where),
37
+ });
38
+ if (!data && options?.required) {
39
+ throw new Error(`Record not found with query: ${where}`);
40
+ }
41
+ return data || null;
42
+ }
43
+ async findById(id, options) {
44
+ const data = await this.repository.findOne({
39
45
  where: this.applyTenantScope({ id }),
40
46
  });
47
+ if (!data && options?.required) {
48
+ throw new Error(`Record not found with ID: ${id}`);
49
+ }
50
+ return data || null;
41
51
  }
42
52
  async findPaginated(options, where) {
43
53
  const page = Math.max(1, options.page || 1);
@@ -50,41 +60,56 @@ class BaseRepository {
50
60
  });
51
61
  return (0, pagination_1.buildPaginatedResult)(data, total, options);
52
62
  }
53
- async update(id, entityData) {
54
- const user = libs_core_1.RequestContextService.getUser();
55
- const existing = await this.findById(id);
56
- if (!existing) {
57
- throw new Error(`Record not found with ID: ${id}`);
63
+ async find(where, options) {
64
+ if (options?.onlyIds) {
65
+ const data = await this.repository.find({
66
+ select: { id: true },
67
+ where: this.applyTenantScope(where),
68
+ });
69
+ return data.map((item) => item.id);
58
70
  }
59
- const updated = this.repository.merge(existing, {
60
- ...entityData,
61
- updatedBy: user?.userId || undefined,
71
+ if (options?.pagination) {
72
+ return this.findPaginated(options.pagination, where);
73
+ }
74
+ return this.repository.find({
75
+ ...options,
76
+ where: this.applyTenantScope(where),
62
77
  });
78
+ }
79
+ async update(id, entityData) {
80
+ const existing = await this.findById(id, { required: true });
81
+ const updated = this.repository.merge(existing, entityData);
63
82
  return this.repository.save(updated);
64
83
  }
65
84
  async delete(id) {
66
- const user = libs_core_1.RequestContextService.getUser();
67
- const existing = await this.findById(id);
68
- if (!existing) {
85
+ const isExist = await this.exists({ id });
86
+ if (!isExist) {
69
87
  throw new Error(`Record not found with ID: ${id}`);
70
88
  }
71
- existing.isDeleted = true;
72
- existing.deletedAt = new Date();
73
- existing.updatedBy = user?.userId || undefined;
74
- await this.repository.save(existing);
89
+ await this.repository.softDelete(id);
90
+ }
91
+ async forceDelete(id) {
92
+ const isExist = await this.exists({ id });
93
+ if (!isExist) {
94
+ throw new Error(`Record not found with ID: ${id}`);
95
+ }
96
+ await this.repository.delete(id);
75
97
  }
76
98
  async restore(id) {
77
- const user = libs_core_1.RequestContextService.getUser();
78
99
  const existing = await this.repository.findOne({
79
- where: { id, tenantCode: this.tenantCode, isDeleted: true },
100
+ where: this.applyTenantScope({ id }),
101
+ withDeleted: true,
80
102
  });
81
103
  if (!existing) {
82
104
  throw new Error(`Soft-deleted record not found with ID: ${id}`);
83
105
  }
84
- existing.isDeleted = false;
85
- existing.deletedAt = undefined;
86
- existing.updatedBy = user?.userId || undefined;
87
- await this.repository.save(existing);
106
+ await this.repository.restore(id);
107
+ }
108
+ async exists(where) {
109
+ const count = await this.repository.count({
110
+ where: this.applyTenantScope(where),
111
+ });
112
+ return count > 0;
88
113
  }
89
114
  }
90
115
  exports.BaseRepository = BaseRepository;
@@ -1 +1 @@
1
- {"version":3,"file":"base.repository.js","sourceRoot":"","sources":["../src/base.repository.ts"],"names":[],"mappings":";;;AAEA,mDAA4D;AAC5D,6CAAwF;AAGxF,MAAsB,cAAc;IAEb;IACA;IAFrB,YACqB,YAA8B,EAC9B,kBAAsC;QADtC,iB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C;QACtE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YAC7C,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAA8B,CAAC;YAChE,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,0CAA0C,EAAE,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAA+B;QAC1C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;YACxC,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;SACpC,CAAC,CAAC;QACH,OAAO,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;CACF;AAvJD,wCAuJC"}
@@ -0,0 +1,32 @@
1
+ import { BaseEntity } from '../base.entity';
2
+ import { Department } from './department.entity';
3
+ import { Grade } from './grade.entity';
4
+ import { JobTitle } from './job-title.entity';
5
+ import { Location } from './location.entity';
6
+ export declare class Company extends BaseEntity {
7
+ name: string;
8
+ status: 'pending' | 'active' | 'inactive';
9
+ legalName: string;
10
+ registrationNo: string;
11
+ taxId: string;
12
+ website: string;
13
+ industry: string;
14
+ size: number;
15
+ logo: string;
16
+ foundedDate: Date;
17
+ holdingId?: string | null;
18
+ contactName?: string | null;
19
+ contactEmail?: string | null;
20
+ contactPhone?: string | null;
21
+ contactTitle?: string | null;
22
+ secondaryContactName?: string | null;
23
+ secondaryContactEmail?: string | null;
24
+ secondaryContactPhone?: string | null;
25
+ secondaryContactTitle?: string | null;
26
+ holding?: Company | null;
27
+ subsidiaries?: Company[];
28
+ departments?: Department[];
29
+ locations?: Location[];
30
+ grades?: Grade[];
31
+ jobTitles?: JobTitle[];
32
+ }
@@ -0,0 +1,152 @@
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.Company = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const base_entity_1 = require("../base.entity");
15
+ const department_entity_1 = require("./department.entity");
16
+ const grade_entity_1 = require("./grade.entity");
17
+ const job_title_entity_1 = require("./job-title.entity");
18
+ const location_entity_1 = require("./location.entity");
19
+ let Company = class Company extends base_entity_1.BaseEntity {
20
+ name;
21
+ status;
22
+ legalName;
23
+ registrationNo;
24
+ taxId;
25
+ website;
26
+ industry;
27
+ size;
28
+ logo;
29
+ foundedDate;
30
+ holdingId;
31
+ contactName;
32
+ contactEmail;
33
+ contactPhone;
34
+ contactTitle;
35
+ secondaryContactName;
36
+ secondaryContactEmail;
37
+ secondaryContactPhone;
38
+ secondaryContactTitle;
39
+ holding;
40
+ subsidiaries;
41
+ departments;
42
+ locations;
43
+ grades;
44
+ jobTitles;
45
+ };
46
+ exports.Company = Company;
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ name: 'name', type: 'varchar', length: 255 }),
49
+ __metadata("design:type", String)
50
+ ], Company.prototype, "name", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Index)('idx_company_status'),
53
+ (0, typeorm_1.Column)({ name: 'status', type: 'varchar', length: 32, default: 'pending' }),
54
+ __metadata("design:type", String)
55
+ ], Company.prototype, "status", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({ name: 'legal_name', type: 'varchar', length: 255 }),
58
+ __metadata("design:type", String)
59
+ ], Company.prototype, "legalName", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.Column)({ name: 'registration_no', type: 'varchar', length: 100 }),
62
+ __metadata("design:type", String)
63
+ ], Company.prototype, "registrationNo", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)({ name: 'tax_id', type: 'varchar', length: 100 }),
66
+ __metadata("design:type", String)
67
+ ], Company.prototype, "taxId", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)({ name: 'website', type: 'varchar', length: 255 }),
70
+ __metadata("design:type", String)
71
+ ], Company.prototype, "website", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.Column)({ name: 'industry', type: 'varchar', length: 64 }),
74
+ __metadata("design:type", String)
75
+ ], Company.prototype, "industry", void 0);
76
+ __decorate([
77
+ (0, typeorm_1.Column)({ name: 'size', type: 'integer' }),
78
+ __metadata("design:type", Number)
79
+ ], Company.prototype, "size", void 0);
80
+ __decorate([
81
+ (0, typeorm_1.Column)({ name: 'logo', type: 'varchar', length: 256 }),
82
+ __metadata("design:type", String)
83
+ ], Company.prototype, "logo", void 0);
84
+ __decorate([
85
+ (0, typeorm_1.Column)({ name: 'founded_date', type: 'date' }),
86
+ __metadata("design:type", Date)
87
+ ], Company.prototype, "foundedDate", void 0);
88
+ __decorate([
89
+ (0, typeorm_1.Column)({ name: 'holding_id', type: 'uuid', nullable: true }),
90
+ __metadata("design:type", Object)
91
+ ], Company.prototype, "holdingId", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.Column)({ name: 'contact_name', type: 'varchar', length: 255, nullable: true }),
94
+ __metadata("design:type", Object)
95
+ ], Company.prototype, "contactName", void 0);
96
+ __decorate([
97
+ (0, typeorm_1.Column)({ name: 'contact_email', type: 'varchar', length: 255, nullable: true }),
98
+ __metadata("design:type", Object)
99
+ ], Company.prototype, "contactEmail", void 0);
100
+ __decorate([
101
+ (0, typeorm_1.Column)({ name: 'contact_phone', type: 'varchar', length: 64, nullable: true }),
102
+ __metadata("design:type", Object)
103
+ ], Company.prototype, "contactPhone", void 0);
104
+ __decorate([
105
+ (0, typeorm_1.Column)({ name: 'contact_title', type: 'varchar', length: 255, nullable: true }),
106
+ __metadata("design:type", Object)
107
+ ], Company.prototype, "contactTitle", void 0);
108
+ __decorate([
109
+ (0, typeorm_1.Column)({ name: 'secondary_contact_name', type: 'varchar', length: 255, nullable: true }),
110
+ __metadata("design:type", Object)
111
+ ], Company.prototype, "secondaryContactName", void 0);
112
+ __decorate([
113
+ (0, typeorm_1.Column)({ name: 'secondary_contact_email', type: 'varchar', length: 255, nullable: true }),
114
+ __metadata("design:type", Object)
115
+ ], Company.prototype, "secondaryContactEmail", void 0);
116
+ __decorate([
117
+ (0, typeorm_1.Column)({ name: 'secondary_contact_phone', type: 'varchar', length: 64, nullable: true }),
118
+ __metadata("design:type", Object)
119
+ ], Company.prototype, "secondaryContactPhone", void 0);
120
+ __decorate([
121
+ (0, typeorm_1.Column)({ name: 'secondary_contact_title', type: 'varchar', length: 255, nullable: true }),
122
+ __metadata("design:type", Object)
123
+ ], Company.prototype, "secondaryContactTitle", void 0);
124
+ __decorate([
125
+ (0, typeorm_1.ManyToOne)(() => Company, (company) => company.subsidiaries, { nullable: true }),
126
+ (0, typeorm_1.JoinColumn)({ name: 'holding_id' }),
127
+ __metadata("design:type", Object)
128
+ ], Company.prototype, "holding", void 0);
129
+ __decorate([
130
+ (0, typeorm_1.OneToMany)(() => Company, (company) => company.holding),
131
+ __metadata("design:type", Array)
132
+ ], Company.prototype, "subsidiaries", void 0);
133
+ __decorate([
134
+ (0, typeorm_1.OneToMany)(() => department_entity_1.Department, (dept) => dept.company),
135
+ __metadata("design:type", Array)
136
+ ], Company.prototype, "departments", void 0);
137
+ __decorate([
138
+ (0, typeorm_1.OneToMany)(() => location_entity_1.Location, (loc) => loc.company),
139
+ __metadata("design:type", Array)
140
+ ], Company.prototype, "locations", void 0);
141
+ __decorate([
142
+ (0, typeorm_1.OneToMany)(() => grade_entity_1.Grade, (grade) => grade.company),
143
+ __metadata("design:type", Array)
144
+ ], Company.prototype, "grades", void 0);
145
+ __decorate([
146
+ (0, typeorm_1.OneToMany)(() => job_title_entity_1.JobTitle, (jobTitle) => jobTitle.company),
147
+ __metadata("design:type", Array)
148
+ ], Company.prototype, "jobTitles", void 0);
149
+ exports.Company = Company = __decorate([
150
+ (0, typeorm_1.Entity)('companies')
151
+ ], Company);
152
+ //# sourceMappingURL=company.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"company.entity.js","sourceRoot":"","sources":["../../src/common/company.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAkF;AAClF,gDAA4C;AAC5C,2DAAiD;AACjD,iDAAuC;AACvC,yDAA8C;AAC9C,uDAA6C;AAGtC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,wBAAU;IAErC,IAAI,CAAS;IAIb,MAAM,CAAoC;IAG1C,SAAS,CAAS;IAGlB,cAAc,CAAS;IAGvB,KAAK,CAAS;IAGd,OAAO,CAAS;IAGhB,QAAQ,CAAS;IAGjB,IAAI,CAAS;IAGb,IAAI,CAAS;IAGb,WAAW,CAAO;IAGlB,SAAS,CAAiB;IAI1B,WAAW,CAAiB;IAG5B,YAAY,CAAiB;IAG7B,YAAY,CAAiB;IAG7B,YAAY,CAAiB;IAI7B,oBAAoB,CAAiB;IAGrC,qBAAqB,CAAiB;IAGtC,qBAAqB,CAAiB;IAGtC,qBAA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 +1,14 @@
1
+ import { BaseEntity } from '../base.entity';
2
+ import { Company } from './company.entity';
3
+ import { JobTitle } from './job-title.entity';
4
+ export declare class Department extends BaseEntity {
5
+ companyId: string;
6
+ code: string;
7
+ name?: string | null;
8
+ isDivision: boolean;
9
+ parentId?: string | null;
10
+ company?: Company;
11
+ parent?: Department | null;
12
+ subDepartments?: Department[];
13
+ jobTitles?: JobTitle[];
14
+ }
@@ -0,0 +1,70 @@
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.Department = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const base_entity_1 = require("../base.entity");
15
+ const company_entity_1 = require("./company.entity");
16
+ const job_title_entity_1 = require("./job-title.entity");
17
+ let Department = class Department extends base_entity_1.BaseEntity {
18
+ companyId;
19
+ code;
20
+ name;
21
+ isDivision;
22
+ parentId;
23
+ company;
24
+ parent;
25
+ subDepartments;
26
+ jobTitles;
27
+ };
28
+ exports.Department = Department;
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ name: 'company_id', type: 'uuid' }),
31
+ __metadata("design:type", String)
32
+ ], Department.prototype, "companyId", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ name: 'code', type: 'varchar', length: 64 }),
35
+ __metadata("design:type", String)
36
+ ], Department.prototype, "code", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ name: 'name', type: 'varchar', length: 255, nullable: true }),
39
+ __metadata("design:type", Object)
40
+ ], Department.prototype, "name", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ name: 'is_division', type: 'boolean', default: false }),
43
+ __metadata("design:type", Boolean)
44
+ ], Department.prototype, "isDivision", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ name: 'parent_id', type: 'uuid', nullable: true }),
47
+ __metadata("design:type", Object)
48
+ ], Department.prototype, "parentId", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.ManyToOne)(() => company_entity_1.Company, (company) => company.departments),
51
+ (0, typeorm_1.JoinColumn)({ name: 'company_id' }),
52
+ __metadata("design:type", company_entity_1.Company)
53
+ ], Department.prototype, "company", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.ManyToOne)(() => Department, (dept) => dept.subDepartments, { nullable: true }),
56
+ (0, typeorm_1.JoinColumn)({ name: 'parent_id' }),
57
+ __metadata("design:type", Object)
58
+ ], Department.prototype, "parent", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.OneToMany)(() => Department, (dept) => dept.parent),
61
+ __metadata("design:type", Array)
62
+ ], Department.prototype, "subDepartments", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.OneToMany)(() => job_title_entity_1.JobTitle, (jobTitle) => jobTitle.department),
65
+ __metadata("design:type", Array)
66
+ ], Department.prototype, "jobTitles", void 0);
67
+ exports.Department = Department = __decorate([
68
+ (0, typeorm_1.Entity)('departments')
69
+ ], Department);
70
+ //# sourceMappingURL=department.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"department.entity.js","sourceRoot":"","sources":["../../src/common/department.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA2E;AAC3E,gDAA4C;AAC5C,qDAA2C;AAC3C,yDAA8C;AAGvC,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,wBAAU;IAExC,SAAS,CAAS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P;AAG3B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC;;kDACrB;AAG9B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2BAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;;6CACtC;qBA7BZ,UAAU;IADtB,IAAA,gBAAM,EAAC,aAAa,CAAC;GACT,UAAU,CA8BtB"}
@@ -0,0 +1,10 @@
1
+ import { BaseEntity } from '../base.entity';
2
+ import { Company } from './company.entity';
3
+ import { JobTitle } from './job-title.entity';
4
+ export declare class Grade extends BaseEntity {
5
+ companyId: string;
6
+ code: string;
7
+ name?: string | null;
8
+ company?: Company;
9
+ jobTitles?: JobTitle[];
10
+ }
@@ -0,0 +1,49 @@
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.Grade = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const base_entity_1 = require("../base.entity");
15
+ const company_entity_1 = require("./company.entity");
16
+ const job_title_entity_1 = require("./job-title.entity");
17
+ let Grade = class Grade extends base_entity_1.BaseEntity {
18
+ companyId;
19
+ code;
20
+ name;
21
+ company;
22
+ jobTitles;
23
+ };
24
+ exports.Grade = Grade;
25
+ __decorate([
26
+ (0, typeorm_1.Column)({ name: 'company_id', type: 'uuid' }),
27
+ __metadata("design:type", String)
28
+ ], Grade.prototype, "companyId", void 0);
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ name: 'code', type: 'varchar', length: 64 }),
31
+ __metadata("design:type", String)
32
+ ], Grade.prototype, "code", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ name: 'name', type: 'varchar', length: 255, nullable: true }),
35
+ __metadata("design:type", Object)
36
+ ], Grade.prototype, "name", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.ManyToOne)(() => company_entity_1.Company, (company) => company.grades),
39
+ (0, typeorm_1.JoinColumn)({ name: 'company_id' }),
40
+ __metadata("design:type", company_entity_1.Company)
41
+ ], Grade.prototype, "company", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.OneToMany)(() => job_title_entity_1.JobTitle, (jobTitle) => jobTitle.grade),
44
+ __metadata("design:type", Array)
45
+ ], Grade.prototype, "jobTitles", void 0);
46
+ exports.Grade = Grade = __decorate([
47
+ (0, typeorm_1.Entity)('grades')
48
+ ], Grade);
49
+ //# sourceMappingURL=grade.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grade.entity.js","sourceRoot":"","sources":["../../src/common/grade.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAOiB;AACjB,gDAA4C;AAC5C,qDAA2C;AAC3C,yDAA8C;AAGvC,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,wBAAU;IAEnC,SAAS,CAAS;IAGlB,IAAI,CAAS;IAGb,IAAI,CAAiB;IAKrB,OAAO,CAAW;IAGlB,SAAS,CAAc;CACxB,CAAA;AAjBY,sBAAK;AAEhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCAC3B;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;mCACzC;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mCAClD;AAKrB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IACrD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BACzB,wBAAO;sCAAC;AAGlB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2BAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;;wCACjC;gBAhBZ,KAAK;IADjB,IAAA,gBAAM,EAAC,QAAQ,CAAC;GACJ,KAAK,CAiBjB"}
@@ -0,0 +1,5 @@
1
+ export * from './company.entity';
2
+ export * from './department.entity';
3
+ export * from './location.entity';
4
+ export * from './grade.entity';
5
+ export * from './job-title.entity';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./company.entity"), exports);
18
+ __exportStar(require("./department.entity"), exports);
19
+ __exportStar(require("./location.entity"), exports);
20
+ __exportStar(require("./grade.entity"), exports);
21
+ __exportStar(require("./job-title.entity"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,sDAAoC;AACpC,oDAAkC;AAClC,iDAA+B;AAC/B,qDAAmC"}
@@ -0,0 +1,14 @@
1
+ import { BaseEntity } from '../base.entity';
2
+ import { Company } from './company.entity';
3
+ import { Department } from './department.entity';
4
+ import { Grade } from './grade.entity';
5
+ export declare class JobTitle extends BaseEntity {
6
+ companyId: string;
7
+ departmentId: string;
8
+ gradeId: string;
9
+ code: string;
10
+ name?: string | null;
11
+ company?: Company;
12
+ department?: Department;
13
+ grade?: Grade;
14
+ }
@@ -0,0 +1,67 @@
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.JobTitle = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const base_entity_1 = require("../base.entity");
15
+ const company_entity_1 = require("./company.entity");
16
+ const department_entity_1 = require("./department.entity");
17
+ const grade_entity_1 = require("./grade.entity");
18
+ let JobTitle = class JobTitle extends base_entity_1.BaseEntity {
19
+ companyId;
20
+ departmentId;
21
+ gradeId;
22
+ code;
23
+ name;
24
+ company;
25
+ department;
26
+ grade;
27
+ };
28
+ exports.JobTitle = JobTitle;
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ name: 'company_id', type: 'uuid' }),
31
+ __metadata("design:type", String)
32
+ ], JobTitle.prototype, "companyId", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ name: 'department_id', type: 'uuid' }),
35
+ __metadata("design:type", String)
36
+ ], JobTitle.prototype, "departmentId", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ name: 'grade_id', type: 'uuid' }),
39
+ __metadata("design:type", String)
40
+ ], JobTitle.prototype, "gradeId", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ name: 'code', type: 'varchar', length: 64 }),
43
+ __metadata("design:type", String)
44
+ ], JobTitle.prototype, "code", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ name: 'name', type: 'varchar', length: 255, nullable: true }),
47
+ __metadata("design:type", Object)
48
+ ], JobTitle.prototype, "name", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.ManyToOne)(() => company_entity_1.Company, (company) => company.jobTitles),
51
+ (0, typeorm_1.JoinColumn)({ name: 'company_id' }),
52
+ __metadata("design:type", company_entity_1.Company)
53
+ ], JobTitle.prototype, "company", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.ManyToOne)(() => department_entity_1.Department, (dept) => dept.jobTitles),
56
+ (0, typeorm_1.JoinColumn)({ name: 'department_id' }),
57
+ __metadata("design:type", department_entity_1.Department)
58
+ ], JobTitle.prototype, "department", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.ManyToOne)(() => grade_entity_1.Grade, (grade) => grade.jobTitles),
61
+ (0, typeorm_1.JoinColumn)({ name: 'grade_id' }),
62
+ __metadata("design:type", grade_entity_1.Grade)
63
+ ], JobTitle.prototype, "grade", void 0);
64
+ exports.JobTitle = JobTitle = __decorate([
65
+ (0, typeorm_1.Entity)('job_titles')
66
+ ], JobTitle);
67
+ //# sourceMappingURL=job-title.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job-title.entity.js","sourceRoot":"","sources":["../../src/common/job-title.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgE;AAChE,gDAA4C;AAC5C,qDAA2C;AAC3C,2DAAiD;AACjD,iDAAuC;AAGhC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,wBAAU;IAEtC,SAAS,CAAS;IAGlB,YAAY,CAAS;IAGrB,OAAO,CAAS;IAGhB,IAAI,CAAS;IAGb,IAAI,CAAiB;IAKrB,OAAO,CAAW;IAIlB,UAAU,CAAc;IAIxB,KAAK,CAAS;CACf,CAAA;AA5BY,4BAAQ;AAEnB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAC3B;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAC3B;AAGrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCAC3B;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;sCACzC;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCAClD;AAKrB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;IACxD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BACzB,wBAAO;yCAAC;AAIlB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,8BAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC;IACrD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;8BACzB,8BAAU;4CAAC;AAIxB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,oBAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC;IAClD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;8BACzB,oBAAK;uCAAC;mBA3BH,QAAQ;IADpB,IAAA,gBAAM,EAAC,YAAY,CAAC;GACR,QAAQ,CA4BpB"}
@@ -0,0 +1,20 @@
1
+ import { BaseEntity } from '../base.entity';
2
+ import { Company } from './company.entity';
3
+ export declare class Location extends BaseEntity {
4
+ companyId: string;
5
+ name: string;
6
+ addressLine: string;
7
+ city: string;
8
+ state: string;
9
+ country: string;
10
+ zipCode: string;
11
+ timezone: string;
12
+ contactName?: string | null;
13
+ contactEmail?: string | null;
14
+ contactPhone?: string | null;
15
+ contactTitle?: string | null;
16
+ mapUrl?: string | null;
17
+ isHeadquarter: boolean;
18
+ regionCoverMeters: number;
19
+ company?: Company;
20
+ }
@@ -0,0 +1,103 @@
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.Location = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const base_entity_1 = require("../base.entity");
15
+ const company_entity_1 = require("./company.entity");
16
+ let Location = class Location extends base_entity_1.BaseEntity {
17
+ companyId;
18
+ name;
19
+ addressLine;
20
+ city;
21
+ state;
22
+ country;
23
+ zipCode;
24
+ timezone;
25
+ contactName;
26
+ contactEmail;
27
+ contactPhone;
28
+ contactTitle;
29
+ mapUrl;
30
+ isHeadquarter;
31
+ regionCoverMeters;
32
+ company;
33
+ };
34
+ exports.Location = Location;
35
+ __decorate([
36
+ (0, typeorm_1.Column)({ name: 'company_id', type: 'uuid' }),
37
+ __metadata("design:type", String)
38
+ ], Location.prototype, "companyId", void 0);
39
+ __decorate([
40
+ (0, typeorm_1.Column)({ name: 'name', type: 'varchar', length: 64 }),
41
+ __metadata("design:type", String)
42
+ ], Location.prototype, "name", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)({ name: 'address_line', type: 'varchar', length: 255 }),
45
+ __metadata("design:type", String)
46
+ ], Location.prototype, "addressLine", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ name: 'city', type: 'varchar', length: 255 }),
49
+ __metadata("design:type", String)
50
+ ], Location.prototype, "city", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ name: 'state', type: 'varchar', length: 100 }),
53
+ __metadata("design:type", String)
54
+ ], Location.prototype, "state", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ name: 'country', type: 'varchar', length: 100 }),
57
+ __metadata("design:type", String)
58
+ ], Location.prototype, "country", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ name: 'zip_code', type: 'varchar', length: 64 }),
61
+ __metadata("design:type", String)
62
+ ], Location.prototype, "zipCode", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ name: 'timezone', type: 'varchar', length: 64 }),
65
+ __metadata("design:type", String)
66
+ ], Location.prototype, "timezone", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ name: 'contact_name', type: 'varchar', length: 255, nullable: true }),
69
+ __metadata("design:type", Object)
70
+ ], Location.prototype, "contactName", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.Column)({ name: 'contact_email', type: 'varchar', length: 255, nullable: true }),
73
+ __metadata("design:type", Object)
74
+ ], Location.prototype, "contactEmail", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ name: 'contact_phone', type: 'varchar', length: 64, nullable: true }),
77
+ __metadata("design:type", Object)
78
+ ], Location.prototype, "contactPhone", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({ name: 'contact_title', type: 'varchar', length: 255, nullable: true }),
81
+ __metadata("design:type", Object)
82
+ ], Location.prototype, "contactTitle", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({ name: 'map_url', type: 'varchar', length: 255, nullable: true }),
85
+ __metadata("design:type", Object)
86
+ ], Location.prototype, "mapUrl", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({ name: 'is_headquarter', type: 'boolean', default: false }),
89
+ __metadata("design:type", Boolean)
90
+ ], Location.prototype, "isHeadquarter", void 0);
91
+ __decorate([
92
+ (0, typeorm_1.Column)({ name: 'region_cover_meters', type: 'bigint', default: 100 }),
93
+ __metadata("design:type", Number)
94
+ ], Location.prototype, "regionCoverMeters", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.ManyToOne)(() => company_entity_1.Company, (company) => company.locations),
97
+ (0, typeorm_1.JoinColumn)({ name: 'company_id' }),
98
+ __metadata("design:type", company_entity_1.Company)
99
+ ], Location.prototype, "company", void 0);
100
+ exports.Location = Location = __decorate([
101
+ (0, typeorm_1.Entity)('locations')
102
+ ], Location);
103
+ //# sourceMappingURL=location.entity.js.map
@@ -0,0 +1 @@
1
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E,GAAG,EAAE,CAAC;;mDAC5C;AAK1B;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;IACxD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;8BACzB,wBAAO;yCAAC;mBAnDP,QAAQ;IADpB,IAAA,gBAAM,EAAC,WAAW,CAAC;GACP,QAAQ,CAoDpB"}
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from './unit-of-work.service';
6
6
  export * from './sql-health.service';
7
7
  export * from './sql-error.mapper';
8
8
  export * from './sql.module';
9
+ export * from './common';
package/dist/index.js CHANGED
@@ -22,4 +22,5 @@ __exportStar(require("./unit-of-work.service"), exports);
22
22
  __exportStar(require("./sql-health.service"), exports);
23
23
  __exportStar(require("./sql-error.mapper"), exports);
24
24
  __exportStar(require("./sql.module"), exports);
25
+ __exportStar(require("./common"), exports);
25
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+CAA6B;AAC7B,oDAAkC;AAClC,wDAAsC;AACtC,yDAAuC;AACvC,uDAAqC;AACrC,qDAAmC;AACnC,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+CAA6B;AAC7B,oDAAkC;AAClC,wDAAsC;AACtC,yDAAuC;AACvC,uDAAqC;AACrC,qDAAmC;AACnC,+CAA6B;AAC7B,2CAAyB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@new-hros/libs-sql",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "NestJS multi-tenant platform foundation - SQL Database Layer",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@nestjs/common": "^10.0.0",
30
30
  "@nestjs/typeorm": "^10.0.0",
31
- "@new-hros/libs-core": "^1.0.0",
31
+ "@new-hros/libs-core": "^1.1.1",
32
32
  "typeorm": "^0.3.0"
33
33
  },
34
34
  "devDependencies": {