@admc-go-th/admc-library 1.0.17 → 1.0.18

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.
@@ -108,6 +108,7 @@ declare class users extends Model<usersAttributes, usersAttributes> implements u
108
108
 
109
109
  interface authRoleAttributes {
110
110
  id?: number;
111
+ uuid: string;
111
112
  name: string;
112
113
  display?: string;
113
114
  status?: number;
@@ -118,6 +119,7 @@ interface authRoleAttributes {
118
119
  }
119
120
  declare class authRole extends Model<authRoleAttributes, authRoleAttributes> implements authRoleAttributes {
120
121
  id?: number;
122
+ uuid: string;
121
123
  name: string;
122
124
  display?: string;
123
125
  status?: number;
@@ -76,7 +76,7 @@ declare class authItem extends Model<authItemAttributes, authItemAttributes> imp
76
76
  createdDate?: Date;
77
77
  updatedBy?: string;
78
78
  updatedDate?: Date;
79
- menus?: menu[];
79
+ menu?: menu;
80
80
  authItemChildren?: authItemChild[];
81
81
  }
82
82
 
@@ -0,0 +1,14 @@
1
+ import { FindOptions } from "sequelize/types/model";
2
+ import { authRole as AuthRole } from "../tables";
3
+
4
+ export class authRole extends AuthRole {
5
+ static async findByUUID(
6
+ uuid: string,
7
+ options?: Omit<FindOptions, 'where'>
8
+ ): Promise<AuthRole | null> {
9
+ return await this.findOne({
10
+ where: { uuid },
11
+ ...options,
12
+ });
13
+ }
14
+ }
@@ -1,2 +1,3 @@
1
- export * from "./menu";
2
- export * from "./users";
1
+ export * from "./menu";
2
+ export * from "./users";
3
+ export * from "./authRole";
@@ -1,5 +1,5 @@
1
1
  import {
2
- Model, Table, Column, DataType, Index, Sequelize, ForeignKey, HasMany
2
+ Model, Table, Column, DataType, Index, Sequelize, ForeignKey, HasOne, HasMany
3
3
  } from "sequelize-typescript";
4
4
  import { menu } from "./menu";
5
5
  import { authItemChild } from "./authItemChild";
@@ -80,10 +80,10 @@ export class authItem extends Model<authItemAttributes, authItemAttributes> impl
80
80
  })
81
81
  declare updatedDate?: Date;
82
82
 
83
- @HasMany(() => menu, {
83
+ @HasOne(() => menu, {
84
84
  sourceKey: "keyName"
85
85
  })
86
- declare menus?: menu[];
86
+ declare menu?: menu;
87
87
 
88
88
  @HasMany(() => authItemChild, {
89
89
  sourceKey: "keyName"
@@ -30,5 +30,4 @@ export class authItemChild extends Model<authItemChildAttributes, authItemChildA
30
30
 
31
31
  @BelongsTo(() => authItem)
32
32
  declare authItem?: authItem;
33
-
34
33
  }
@@ -5,6 +5,7 @@ import { authAssignment } from "./authAssignment";
5
5
 
6
6
  export interface authRoleAttributes {
7
7
  id?: number;
8
+ uuid: string;
8
9
  name: string;
9
10
  display?: string;
10
11
  status?: number;
@@ -27,6 +28,11 @@ export class authRole extends Model<authRoleAttributes, authRoleAttributes> impl
27
28
  })
28
29
  declare id?: number;
29
30
 
31
+ @Column({
32
+ type: DataType.STRING(60)
33
+ })
34
+ declare uuid: string;
35
+
30
36
  @Column({
31
37
  type: DataType.STRING(100)
32
38
  })
@@ -1,2 +1,2 @@
1
1
  import 'sequelize-typescript';
2
- export { b as authAssignment, a as authAssignmentAttributes } from '../../authAssignment-DSQ-klvX.js';
2
+ export { b as authAssignment, a as authAssignmentAttributes } from '../../authAssignment-zERupLM6.js';
@@ -389,6 +389,11 @@ __decorateClass([
389
389
  type: import_sequelize_typescript4.DataType.INTEGER
390
390
  })
391
391
  ], authRole.prototype, "id", 2);
392
+ __decorateClass([
393
+ (0, import_sequelize_typescript4.Column)({
394
+ type: import_sequelize_typescript4.DataType.STRING(60)
395
+ })
396
+ ], authRole.prototype, "uuid", 2);
392
397
  __decorateClass([
393
398
  (0, import_sequelize_typescript4.Column)({
394
399
  type: import_sequelize_typescript4.DataType.STRING(100)
@@ -1,2 +1,2 @@
1
1
  import 'sequelize-typescript';
2
- export { b as authItem, a as authItemAttributes } from '../../authItem-DzYA8ziY.js';
2
+ export { b as authItem, a as authItemAttributes } from '../../authItem-CKouXgWR.js';
@@ -266,10 +266,10 @@ __decorateClass([
266
266
  })
267
267
  ], authItem.prototype, "updatedDate", 2);
268
268
  __decorateClass([
269
- (0, import_sequelize_typescript4.HasMany)(() => menu, {
269
+ (0, import_sequelize_typescript4.HasOne)(() => menu, {
270
270
  sourceKey: "keyName"
271
271
  })
272
- ], authItem.prototype, "menus", 2);
272
+ ], authItem.prototype, "menu", 2);
273
273
  __decorateClass([
274
274
  (0, import_sequelize_typescript4.HasMany)(() => authItemChild, {
275
275
  sourceKey: "keyName"
@@ -1,2 +1,2 @@
1
1
  import 'sequelize-typescript';
2
- export { d as authItemChild, c as authItemChildAttributes } from '../../authItem-DzYA8ziY.js';
2
+ export { d as authItemChild, c as authItemChildAttributes } from '../../authItem-CKouXgWR.js';
@@ -241,10 +241,10 @@ __decorateClass([
241
241
  })
242
242
  ], authItem.prototype, "updatedDate", 2);
243
243
  __decorateClass([
244
- (0, import_sequelize_typescript3.HasMany)(() => menu, {
244
+ (0, import_sequelize_typescript3.HasOne)(() => menu, {
245
245
  sourceKey: "keyName"
246
246
  })
247
- ], authItem.prototype, "menus", 2);
247
+ ], authItem.prototype, "menu", 2);
248
248
  __decorateClass([
249
249
  (0, import_sequelize_typescript3.HasMany)(() => authItemChild, {
250
250
  sourceKey: "keyName"
@@ -1,2 +1,2 @@
1
1
  import 'sequelize-typescript';
2
- export { d as authRole, c as authRoleAttributes } from '../../authAssignment-DSQ-klvX.js';
2
+ export { d as authRole, c as authRoleAttributes } from '../../authAssignment-zERupLM6.js';
@@ -451,6 +451,11 @@ __decorateClass([
451
451
  type: import_sequelize_typescript5.DataType.INTEGER
452
452
  })
453
453
  ], authRole.prototype, "id", 2);
454
+ __decorateClass([
455
+ (0, import_sequelize_typescript5.Column)({
456
+ type: import_sequelize_typescript5.DataType.STRING(60)
457
+ })
458
+ ], authRole.prototype, "uuid", 2);
454
459
  __decorateClass([
455
460
  (0, import_sequelize_typescript5.Column)({
456
461
  type: import_sequelize_typescript5.DataType.STRING(100)
@@ -1,4 +1,4 @@
1
- export { b as authAssignment, a as authAssignmentAttributes, d as authRole, c as authRoleAttributes, e as mdContent, m as mdContentAttributes, g as mdContentGroup, f as mdContentGroupAttributes, h as users, u as usersAttributes } from '../../authAssignment-DSQ-klvX.js';
2
- export { b as authItem, a as authItemAttributes, d as authItemChild, c as authItemChildAttributes, e as menu, m as menuAttributes, g as msModule, f as msModuleAttributes } from '../../authItem-DzYA8ziY.js';
1
+ export { b as authAssignment, a as authAssignmentAttributes, d as authRole, c as authRoleAttributes, e as mdContent, m as mdContentAttributes, g as mdContentGroup, f as mdContentGroupAttributes, h as users, u as usersAttributes } from '../../authAssignment-zERupLM6.js';
2
+ export { b as authItem, a as authItemAttributes, d as authItemChild, c as authItemChildAttributes, e as menu, m as menuAttributes, g as msModule, f as msModuleAttributes } from '../../authItem-CKouXgWR.js';
3
3
  export { authRoleChild, authRoleChildAttributes } from './authRoleChild.js';
4
4
  import 'sequelize-typescript';
@@ -400,6 +400,11 @@ __decorateClass([
400
400
  type: import_sequelize_typescript4.DataType.INTEGER
401
401
  })
402
402
  ], authRole.prototype, "id", 2);
403
+ __decorateClass([
404
+ (0, import_sequelize_typescript4.Column)({
405
+ type: import_sequelize_typescript4.DataType.STRING(60)
406
+ })
407
+ ], authRole.prototype, "uuid", 2);
403
408
  __decorateClass([
404
409
  (0, import_sequelize_typescript4.Column)({
405
410
  type: import_sequelize_typescript4.DataType.STRING(100)
@@ -753,10 +758,10 @@ __decorateClass([
753
758
  })
754
759
  ], authItem.prototype, "updatedDate", 2);
755
760
  __decorateClass([
756
- (0, import_sequelize_typescript9.HasMany)(() => menu, {
761
+ (0, import_sequelize_typescript9.HasOne)(() => menu, {
757
762
  sourceKey: "keyName"
758
763
  })
759
- ], authItem.prototype, "menus", 2);
764
+ ], authItem.prototype, "menu", 2);
760
765
  __decorateClass([
761
766
  (0, import_sequelize_typescript9.HasMany)(() => authItemChild, {
762
767
  sourceKey: "keyName"
@@ -1,2 +1,2 @@
1
1
  import 'sequelize-typescript';
2
- export { e as mdContent, m as mdContentAttributes } from '../../authAssignment-DSQ-klvX.js';
2
+ export { e as mdContent, m as mdContentAttributes } from '../../authAssignment-zERupLM6.js';
@@ -50,6 +50,11 @@ __decorateClass([
50
50
  type: import_sequelize_typescript.DataType.INTEGER
51
51
  })
52
52
  ], authRole.prototype, "id", 2);
53
+ __decorateClass([
54
+ (0, import_sequelize_typescript.Column)({
55
+ type: import_sequelize_typescript.DataType.STRING(60)
56
+ })
57
+ ], authRole.prototype, "uuid", 2);
53
58
  __decorateClass([
54
59
  (0, import_sequelize_typescript.Column)({
55
60
  type: import_sequelize_typescript.DataType.STRING(100)
@@ -1,2 +1,2 @@
1
1
  import 'sequelize-typescript';
2
- export { g as mdContentGroup, f as mdContentGroupAttributes } from '../../authAssignment-DSQ-klvX.js';
2
+ export { g as mdContentGroup, f as mdContentGroupAttributes } from '../../authAssignment-zERupLM6.js';
@@ -53,6 +53,11 @@ __decorateClass([
53
53
  type: import_sequelize_typescript.DataType.INTEGER
54
54
  })
55
55
  ], authRole.prototype, "id", 2);
56
+ __decorateClass([
57
+ (0, import_sequelize_typescript.Column)({
58
+ type: import_sequelize_typescript.DataType.STRING(60)
59
+ })
60
+ ], authRole.prototype, "uuid", 2);
56
61
  __decorateClass([
57
62
  (0, import_sequelize_typescript.Column)({
58
63
  type: import_sequelize_typescript.DataType.STRING(100)
@@ -1,2 +1,2 @@
1
1
  import 'sequelize-typescript';
2
- export { e as menu, m as menuAttributes } from '../../authItem-DzYA8ziY.js';
2
+ export { e as menu, m as menuAttributes } from '../../authItem-CKouXgWR.js';
@@ -182,10 +182,10 @@ __decorateClass([
182
182
  })
183
183
  ], authItem.prototype, "updatedDate", 2);
184
184
  __decorateClass([
185
- (0, import_sequelize_typescript3.HasMany)(() => menu, {
185
+ (0, import_sequelize_typescript3.HasOne)(() => menu, {
186
186
  sourceKey: "keyName"
187
187
  })
188
- ], authItem.prototype, "menus", 2);
188
+ ], authItem.prototype, "menu", 2);
189
189
  __decorateClass([
190
190
  (0, import_sequelize_typescript3.HasMany)(() => authItemChild, {
191
191
  sourceKey: "keyName"
@@ -1,2 +1,2 @@
1
1
  import 'sequelize-typescript';
2
- export { g as msModule, f as msModuleAttributes } from '../../authItem-DzYA8ziY.js';
2
+ export { g as msModule, f as msModuleAttributes } from '../../authItem-CKouXgWR.js';
@@ -129,10 +129,10 @@ __decorateClass([
129
129
  })
130
130
  ], authItem.prototype, "updatedDate", 2);
131
131
  __decorateClass([
132
- (0, import_sequelize_typescript2.HasMany)(() => menu, {
132
+ (0, import_sequelize_typescript2.HasOne)(() => menu, {
133
133
  sourceKey: "keyName"
134
134
  })
135
- ], authItem.prototype, "menus", 2);
135
+ ], authItem.prototype, "menu", 2);
136
136
  __decorateClass([
137
137
  (0, import_sequelize_typescript2.HasMany)(() => authItemChild, {
138
138
  sourceKey: "keyName"
@@ -1,2 +1,2 @@
1
1
  import 'sequelize-typescript';
2
- export { h as users, u as usersAttributes } from '../../authAssignment-DSQ-klvX.js';
2
+ export { h as users, u as usersAttributes } from '../../authAssignment-zERupLM6.js';
@@ -47,6 +47,11 @@ __decorateClass([
47
47
  type: import_sequelize_typescript.DataType.INTEGER
48
48
  })
49
49
  ], authRole.prototype, "id", 2);
50
+ __decorateClass([
51
+ (0, import_sequelize_typescript.Column)({
52
+ type: import_sequelize_typescript.DataType.STRING(60)
53
+ })
54
+ ], authRole.prototype, "uuid", 2);
50
55
  __decorateClass([
51
56
  (0, import_sequelize_typescript.Column)({
52
57
  type: import_sequelize_typescript.DataType.STRING(100)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admc-go-th/admc-library",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -0,0 +1,7 @@
1
+ declare enum EStatus {
2
+ ACTIVE = 1,
3
+ INACTIVE = 2,
4
+ REMOVED = 9
5
+ }
6
+
7
+ export { EStatus };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/types/jwt/enum/status.ts
21
+ var status_exports = {};
22
+ __export(status_exports, {
23
+ EStatus: () => EStatus
24
+ });
25
+ module.exports = __toCommonJS(status_exports);
26
+ var EStatus = /* @__PURE__ */ ((EStatus2) => {
27
+ EStatus2[EStatus2["ACTIVE"] = 1] = "ACTIVE";
28
+ EStatus2[EStatus2["INACTIVE"] = 2] = "INACTIVE";
29
+ EStatus2[EStatus2["REMOVED"] = 9] = "REMOVED";
30
+ return EStatus2;
31
+ })(EStatus || {});
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ EStatus
35
+ });
@@ -0,0 +1,6 @@
1
+ declare enum EUserRoles {
2
+ ADMIN = 2,
3
+ USER = 1
4
+ }
5
+
6
+ export { EUserRoles };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/types/jwt/enum/user-role.ts
21
+ var user_role_exports = {};
22
+ __export(user_role_exports, {
23
+ EUserRoles: () => EUserRoles
24
+ });
25
+ module.exports = __toCommonJS(user_role_exports);
26
+ var EUserRoles = /* @__PURE__ */ ((EUserRoles2) => {
27
+ EUserRoles2[EUserRoles2["ADMIN"] = 2] = "ADMIN";
28
+ EUserRoles2[EUserRoles2["USER"] = 1] = "USER";
29
+ return EUserRoles2;
30
+ })(EUserRoles || {});
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ EUserRoles
34
+ });