storemw-core-api 1.0.3 → 1.0.5
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/middlewares/request/validateAuthorization.js +8 -2
- package/dist/models/ModelFactory.d.ts +14 -9
- package/dist/models/ModelFactory.js +48 -19
- package/dist/models/account/AccountModel.d.ts +12 -1
- package/dist/models/branch/BranchModel.d.ts +72 -44
- package/dist/models/branch_user/BranchUserModel.d.ts +12 -1
- package/dist/models/business/BusinessModel.d.ts +65 -44
- package/dist/models/group/GroupModel.d.ts +14 -1
- package/dist/models/group/GroupOwnerModel.d.ts +13 -1
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +4 -2
- package/dist/models/injection_field/DocumentInjectionFieldModel.d.ts +53 -1
- package/dist/models/injection_field/InjectionFieldModel.d.ts +18 -1
- package/dist/models/injection_field/InjectionFieldModel.js +1 -0
- package/dist/models/injection_field/ItemInjectionFieldModel.d.ts +41 -1
- package/dist/models/injection_field/LogisticInjectionFieldModel.d.ts +14 -1
- package/dist/models/injection_field/RepositoryInjectionFieldModel.d.ts +19 -1
- package/dist/models/injection_field/UserInjectionFieldModel.d.ts +37 -9
- package/dist/models/item/BrandModel.d.ts +13 -1
- package/dist/models/item/CategoryModel.d.ts +14 -1
- package/dist/models/item/ItemModel.d.ts +34 -1
- package/dist/models/item/ProductModel.d.ts +18 -1
- package/dist/models/item/UomModel.d.ts +16 -1
- package/dist/models/location/LocationModel.d.ts +47 -23
- package/dist/models/location/LocationRackModel.d.ts +16 -1
- package/dist/models/location/LocationRackModel.js +1 -1
- package/dist/models/location/LocationSlotModel.d.ts +15 -1
- package/dist/models/region/AreaModel.d.ts +22 -9
- package/dist/models/region/CountryModel.d.ts +14 -1
- package/dist/models/region/StateModel.d.ts +13 -1
- package/dist/models/user/AdministratorModel.d.ts +11 -1
- package/dist/models/user/CustomerModel.d.ts +35 -16
- package/dist/models/user/UserModel.d.ts +19 -1
- package/dist/models/user/UserPropModel.d.ts +17 -1
- package/dist/models/user/UserStatusModel.d.ts +14 -1
- package/dist/models/user/WorkerModel.d.ts +12 -1
- package/dist/services/auth/AuthService.js +10 -2
- package/dist/services/injection_field/UserInjectionFieldService.d.ts +1 -1
- package/dist/services/location/LocationLocationService.d.ts +9 -9
- package/dist/services/location/LocationLocationService.js +0 -2
- package/dist/services/region/AreaService.d.ts +3 -3
- package/dist/services/user/AdministratorService.js +0 -1
- package/dist/services/user/CustomerService.d.ts +6 -6
- package/dist/services/user/UserService.js +6 -3
- package/dist/services/user/WorkerService.js +0 -1
- package/dist/utils/passwordUtils.js +6 -1
- package/package.json +9 -1
|
@@ -29,8 +29,14 @@ const validateAuthorization = (req, res, next) => {
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
const jwtData = jsonwebtoken_1.default.verify(token, authSecretKey); // Verify JWT token
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// for old format
|
|
33
|
+
let accountId = jwtData?.account?.id ?? 0;
|
|
34
|
+
let actionUserId = jwtData?.user?.id ?? 0;
|
|
35
|
+
// for new format
|
|
36
|
+
if (jwtData?.account?.account_id)
|
|
37
|
+
accountId = jwtData?.account?.account_id;
|
|
38
|
+
if (jwtData?.user?.user_id)
|
|
39
|
+
actionUserId = jwtData?.user?.user_id;
|
|
34
40
|
if (accountId === 0)
|
|
35
41
|
throw (0, utils_1.sendError)(res, "UNAUTHORIZED", "Missing accountId in authorization", "", "", utils_1.HTTP_STATUS.UNAUTHORIZED);
|
|
36
42
|
if (actionUserId === 0)
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { DefaultOmitFields } from "../models/default";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
type Column = {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const ModelFactory: <TClient extends Record<string, any>, // PrismaClient
|
|
7
|
+
TName extends keyof TClient, // "plant_clones"
|
|
8
|
+
TDelegate extends TClient[TName], // PrismaClient["plant_clones"]
|
|
9
|
+
TModel>({ debug, prisma, modelName, primaryKey, accountId, actionUserId, }: {
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
prisma: TClient;
|
|
12
|
+
modelName: TName;
|
|
6
13
|
primaryKey?: keyof TModel;
|
|
7
14
|
accountId: number;
|
|
8
15
|
actionUserId: number;
|
|
9
16
|
}) => {
|
|
10
17
|
primaryKey: keyof TModel;
|
|
11
|
-
getFields: (prefix?: string, excludeKeywords?: string[]) => Promise<
|
|
12
|
-
name: string;
|
|
13
|
-
type: string;
|
|
14
|
-
}[]>;
|
|
18
|
+
getFields: (prefix?: string, excludeKeywords?: string[]) => Promise<Column[]>;
|
|
15
19
|
create: ({ data }: {
|
|
16
20
|
data: Omit<any, DefaultOmitFields>;
|
|
17
21
|
}) => Promise<TModel>;
|
|
@@ -24,7 +28,7 @@ export declare const ModelFactory: <TModel extends object>({ prisma, modelName,
|
|
|
24
28
|
update: ({ id, where, data }: {
|
|
25
29
|
id?: number;
|
|
26
30
|
where?: Record<string, any>;
|
|
27
|
-
data:
|
|
31
|
+
data: Partial<TModel>;
|
|
28
32
|
}) => Promise<TModel>;
|
|
29
33
|
trash: ({ ids }: {
|
|
30
34
|
ids: number[];
|
|
@@ -36,3 +40,4 @@ export declare const ModelFactory: <TModel extends object>({ prisma, modelName,
|
|
|
36
40
|
raw: <T = any>(query: string, params?: any[]) => Promise<T[]>;
|
|
37
41
|
rawExec: (query: string, params?: any[]) => Promise<number>;
|
|
38
42
|
};
|
|
43
|
+
export {};
|
|
@@ -2,37 +2,64 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModelFactory = void 0;
|
|
4
4
|
const default_1 = require("../models/default");
|
|
5
|
-
const ModelFactory = ({ prisma, modelName, primaryKey = "id", accountId, actionUserId, }) => {
|
|
6
|
-
const
|
|
5
|
+
const ModelFactory = ({ debug = false, prisma, modelName, primaryKey = "id", accountId, actionUserId, }) => {
|
|
6
|
+
// const delegate = prisma[modelName] as any;
|
|
7
|
+
const delegate = prisma[modelName];
|
|
8
|
+
const getFields = async (prefix, excludeKeywords = []) => {
|
|
9
|
+
// 👇 Tell TS exactly what comes back from Prisma
|
|
7
10
|
const fields = await prisma.$queryRaw `
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return cols;
|
|
11
|
+
SELECT column_name, data_type
|
|
12
|
+
FROM information_schema.columns
|
|
13
|
+
WHERE table_name = ${String(modelName)}
|
|
14
|
+
`;
|
|
15
|
+
return fields
|
|
16
|
+
.map((f) => ({
|
|
17
|
+
name: f.column_name,
|
|
18
|
+
type: f.data_type,
|
|
19
|
+
}))
|
|
20
|
+
.filter((c) => !prefix || c.name.startsWith(prefix))
|
|
21
|
+
.filter((c) => !excludeKeywords.some((kw) => c.name.includes(kw)));
|
|
20
22
|
};
|
|
23
|
+
// const getFields = async (
|
|
24
|
+
// prefix?: string,
|
|
25
|
+
// excludeKeywords?: string[]
|
|
26
|
+
// ): Promise<{ name: string; type: string }[]> => {
|
|
27
|
+
// const fields = await prisma.$queryRaw<{ column_name: string; data_type: string }[]>`
|
|
28
|
+
// SELECT column_name, data_type
|
|
29
|
+
// FROM information_schema.columns
|
|
30
|
+
// WHERE table_name = ${String(modelName)}
|
|
31
|
+
// `;
|
|
32
|
+
// let cols = fields.map(f => ({ name: f.column_name, type: f.data_type }));
|
|
33
|
+
// if (prefix) {
|
|
34
|
+
// cols = cols.filter(c => c.name.startsWith(prefix));
|
|
35
|
+
// }
|
|
36
|
+
// if (excludeKeywords && excludeKeywords.length > 0) {
|
|
37
|
+
// cols = cols.filter(c => !excludeKeywords.some(kw => c.name.includes(kw)));
|
|
38
|
+
// }
|
|
39
|
+
// return cols;
|
|
40
|
+
// };
|
|
21
41
|
const create = async ({ data }) => {
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
const _data = { ...data, ...(0, default_1.getDefaultCreateFields)(actionUserId, accountId) };
|
|
43
|
+
if (debug) {
|
|
44
|
+
console.log(`[ModelFactory(data)]: ${JSON.stringify(_data)}`);
|
|
45
|
+
console.log("[ModelFactory:init]", { modelName, primaryKey });
|
|
46
|
+
console.log("[ModelFactory:delegate]", JSON.stringify(Object.keys(prisma)));
|
|
47
|
+
console.log("[ModelFactory:model]", Object.keys(delegate));
|
|
48
|
+
}
|
|
49
|
+
return delegate.create({
|
|
50
|
+
data: _data,
|
|
24
51
|
});
|
|
25
52
|
};
|
|
26
53
|
const get = async ({ id, where, include, }) => {
|
|
27
54
|
const condition = id ? { [primaryKey]: id } : where ?? {};
|
|
28
55
|
const condition2 = { accountid: accountId };
|
|
29
|
-
return
|
|
56
|
+
return delegate.findFirst({
|
|
30
57
|
where: { ...condition, ...condition2, ...default_1.getDefaultGetWhere },
|
|
31
58
|
include,
|
|
32
59
|
});
|
|
33
60
|
};
|
|
34
61
|
const list = async ({ where, orderBy, offset, limit, include } = {}) => {
|
|
35
|
-
return
|
|
62
|
+
return delegate.findMany({
|
|
36
63
|
where,
|
|
37
64
|
orderBy,
|
|
38
65
|
skip: offset,
|
|
@@ -127,7 +154,9 @@ const ModelFactory = ({ prisma, modelName, primaryKey = "id", accountId, actionU
|
|
|
127
154
|
// return obj;
|
|
128
155
|
// }
|
|
129
156
|
const raw = async (query, params = []) => {
|
|
130
|
-
|
|
157
|
+
const client = prisma;
|
|
158
|
+
// return prisma.$queryRawUnsafe<T[]>(query, ...params);
|
|
159
|
+
return client.$queryRawUnsafe(query, ...params);
|
|
131
160
|
};
|
|
132
161
|
const rawExec = async (query, params = []) => {
|
|
133
162
|
return prisma.$executeRawUnsafe(query, ...params); // returns number of affected rows
|
|
@@ -96,7 +96,18 @@ export declare const AccountModel: ({ prisma, accountId, actionUserId }: {
|
|
|
96
96
|
update: ({ id, where, data }: {
|
|
97
97
|
id?: number;
|
|
98
98
|
where?: Record<string, any>;
|
|
99
|
-
data:
|
|
99
|
+
data: Partial<{
|
|
100
|
+
name: string;
|
|
101
|
+
account_id: bigint;
|
|
102
|
+
createdatetime: Date | null;
|
|
103
|
+
createuserid: bigint;
|
|
104
|
+
updatedatetime: Date | null;
|
|
105
|
+
updateuserid: bigint;
|
|
106
|
+
isdelete: boolean | null;
|
|
107
|
+
istrash: boolean | null;
|
|
108
|
+
accountid: bigint;
|
|
109
|
+
business_id: bigint | null;
|
|
110
|
+
}>;
|
|
100
111
|
}) => Promise<{
|
|
101
112
|
name: string;
|
|
102
113
|
account_id: bigint;
|
|
@@ -13,19 +13,19 @@ export declare const ModelBranchFields: {
|
|
|
13
13
|
isdelete: "isdelete";
|
|
14
14
|
istrash: "istrash";
|
|
15
15
|
accountid: "accountid";
|
|
16
|
-
remark: "remark";
|
|
17
|
-
address_1: "address_1";
|
|
18
|
-
address_2: "address_2";
|
|
19
|
-
state_id: "state_id";
|
|
20
16
|
area_id: "area_id";
|
|
21
|
-
|
|
22
|
-
postcode: "postcode";
|
|
17
|
+
state_id: "state_id";
|
|
23
18
|
branch_id: "branch_id";
|
|
24
19
|
branch_name: "branch_name";
|
|
25
20
|
branch_code: "branch_code";
|
|
21
|
+
address_1: "address_1";
|
|
22
|
+
address_2: "address_2";
|
|
23
|
+
country_id: "country_id";
|
|
24
|
+
postcode: "postcode";
|
|
26
25
|
pic_name: "pic_name";
|
|
27
26
|
pic_contact: "pic_contact";
|
|
28
27
|
pic_email: "pic_email";
|
|
28
|
+
remark: "remark";
|
|
29
29
|
is_hq: "is_hq";
|
|
30
30
|
branch_contact: "branch_contact";
|
|
31
31
|
branch_email: "branch_email";
|
|
@@ -59,7 +59,7 @@ export declare const BranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
59
59
|
accountId: number;
|
|
60
60
|
actionUserId: number;
|
|
61
61
|
}) => {
|
|
62
|
-
primaryKey: "type" | "status" | "area" | "user_id" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "
|
|
62
|
+
primaryKey: "type" | "status" | "area" | "user_id" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "area_id" | "state_id" | "branch_id" | "branch_name" | "branch_code" | "address_1" | "address_2" | "country_id" | "postcode" | "pic_name" | "pic_contact" | "pic_email" | "remark" | "is_hq" | "branch_contact" | "branch_email";
|
|
63
63
|
getFields: (prefix?: string, excludeKeywords?: string[]) => Promise<{
|
|
64
64
|
name: string;
|
|
65
65
|
type: string;
|
|
@@ -78,19 +78,19 @@ export declare const BranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
78
78
|
isdelete: boolean | null;
|
|
79
79
|
istrash: boolean | null;
|
|
80
80
|
accountid: bigint;
|
|
81
|
-
remark: string | null;
|
|
82
|
-
address_1: string | null;
|
|
83
|
-
address_2: string | null;
|
|
84
|
-
state_id: bigint | null;
|
|
85
81
|
area_id: bigint | null;
|
|
86
|
-
|
|
87
|
-
postcode: string | null;
|
|
82
|
+
state_id: bigint | null;
|
|
88
83
|
branch_id: bigint;
|
|
89
84
|
branch_name: string | null;
|
|
90
85
|
branch_code: string | null;
|
|
86
|
+
address_1: string | null;
|
|
87
|
+
address_2: string | null;
|
|
88
|
+
country_id: bigint | null;
|
|
89
|
+
postcode: string | null;
|
|
91
90
|
pic_name: string | null;
|
|
92
91
|
pic_contact: string | null;
|
|
93
92
|
pic_email: string | null;
|
|
93
|
+
remark: string | null;
|
|
94
94
|
is_hq: number;
|
|
95
95
|
branch_contact: string | null;
|
|
96
96
|
branch_email: string | null;
|
|
@@ -111,19 +111,19 @@ export declare const BranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
111
111
|
isdelete: boolean | null;
|
|
112
112
|
istrash: boolean | null;
|
|
113
113
|
accountid: bigint;
|
|
114
|
-
remark: string | null;
|
|
115
|
-
address_1: string | null;
|
|
116
|
-
address_2: string | null;
|
|
117
|
-
state_id: bigint | null;
|
|
118
114
|
area_id: bigint | null;
|
|
119
|
-
|
|
120
|
-
postcode: string | null;
|
|
115
|
+
state_id: bigint | null;
|
|
121
116
|
branch_id: bigint;
|
|
122
117
|
branch_name: string | null;
|
|
123
118
|
branch_code: string | null;
|
|
119
|
+
address_1: string | null;
|
|
120
|
+
address_2: string | null;
|
|
121
|
+
country_id: bigint | null;
|
|
122
|
+
postcode: string | null;
|
|
124
123
|
pic_name: string | null;
|
|
125
124
|
pic_contact: string | null;
|
|
126
125
|
pic_email: string | null;
|
|
126
|
+
remark: string | null;
|
|
127
127
|
is_hq: number;
|
|
128
128
|
branch_contact: string | null;
|
|
129
129
|
branch_email: string | null;
|
|
@@ -140,19 +140,19 @@ export declare const BranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
140
140
|
isdelete: boolean | null;
|
|
141
141
|
istrash: boolean | null;
|
|
142
142
|
accountid: bigint;
|
|
143
|
-
remark: string | null;
|
|
144
|
-
address_1: string | null;
|
|
145
|
-
address_2: string | null;
|
|
146
|
-
state_id: bigint | null;
|
|
147
143
|
area_id: bigint | null;
|
|
148
|
-
|
|
149
|
-
postcode: string | null;
|
|
144
|
+
state_id: bigint | null;
|
|
150
145
|
branch_id: bigint;
|
|
151
146
|
branch_name: string | null;
|
|
152
147
|
branch_code: string | null;
|
|
148
|
+
address_1: string | null;
|
|
149
|
+
address_2: string | null;
|
|
150
|
+
country_id: bigint | null;
|
|
151
|
+
postcode: string | null;
|
|
153
152
|
pic_name: string | null;
|
|
154
153
|
pic_contact: string | null;
|
|
155
154
|
pic_email: string | null;
|
|
155
|
+
remark: string | null;
|
|
156
156
|
is_hq: number;
|
|
157
157
|
branch_contact: string | null;
|
|
158
158
|
branch_email: string | null;
|
|
@@ -160,7 +160,35 @@ export declare const BranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
160
160
|
update: ({ id, where, data }: {
|
|
161
161
|
id?: number;
|
|
162
162
|
where?: Record<string, any>;
|
|
163
|
-
data:
|
|
163
|
+
data: Partial<{
|
|
164
|
+
type: string | null;
|
|
165
|
+
status: number | null;
|
|
166
|
+
area: string | null;
|
|
167
|
+
user_id: bigint;
|
|
168
|
+
createdatetime: Date | null;
|
|
169
|
+
createuserid: bigint;
|
|
170
|
+
updatedatetime: Date | null;
|
|
171
|
+
updateuserid: bigint;
|
|
172
|
+
isdelete: boolean | null;
|
|
173
|
+
istrash: boolean | null;
|
|
174
|
+
accountid: bigint;
|
|
175
|
+
area_id: bigint | null;
|
|
176
|
+
state_id: bigint | null;
|
|
177
|
+
branch_id: bigint;
|
|
178
|
+
branch_name: string | null;
|
|
179
|
+
branch_code: string | null;
|
|
180
|
+
address_1: string | null;
|
|
181
|
+
address_2: string | null;
|
|
182
|
+
country_id: bigint | null;
|
|
183
|
+
postcode: string | null;
|
|
184
|
+
pic_name: string | null;
|
|
185
|
+
pic_contact: string | null;
|
|
186
|
+
pic_email: string | null;
|
|
187
|
+
remark: string | null;
|
|
188
|
+
is_hq: number;
|
|
189
|
+
branch_contact: string | null;
|
|
190
|
+
branch_email: string | null;
|
|
191
|
+
}>;
|
|
164
192
|
}) => Promise<{
|
|
165
193
|
type: string | null;
|
|
166
194
|
status: number | null;
|
|
@@ -173,19 +201,19 @@ export declare const BranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
173
201
|
isdelete: boolean | null;
|
|
174
202
|
istrash: boolean | null;
|
|
175
203
|
accountid: bigint;
|
|
176
|
-
remark: string | null;
|
|
177
|
-
address_1: string | null;
|
|
178
|
-
address_2: string | null;
|
|
179
|
-
state_id: bigint | null;
|
|
180
204
|
area_id: bigint | null;
|
|
181
|
-
|
|
182
|
-
postcode: string | null;
|
|
205
|
+
state_id: bigint | null;
|
|
183
206
|
branch_id: bigint;
|
|
184
207
|
branch_name: string | null;
|
|
185
208
|
branch_code: string | null;
|
|
209
|
+
address_1: string | null;
|
|
210
|
+
address_2: string | null;
|
|
211
|
+
country_id: bigint | null;
|
|
212
|
+
postcode: string | null;
|
|
186
213
|
pic_name: string | null;
|
|
187
214
|
pic_contact: string | null;
|
|
188
215
|
pic_email: string | null;
|
|
216
|
+
remark: string | null;
|
|
189
217
|
is_hq: number;
|
|
190
218
|
branch_contact: string | null;
|
|
191
219
|
branch_email: string | null;
|
|
@@ -204,19 +232,19 @@ export declare const BranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
204
232
|
isdelete: boolean | null;
|
|
205
233
|
istrash: boolean | null;
|
|
206
234
|
accountid: bigint;
|
|
207
|
-
remark: string | null;
|
|
208
|
-
address_1: string | null;
|
|
209
|
-
address_2: string | null;
|
|
210
|
-
state_id: bigint | null;
|
|
211
235
|
area_id: bigint | null;
|
|
212
|
-
|
|
213
|
-
postcode: string | null;
|
|
236
|
+
state_id: bigint | null;
|
|
214
237
|
branch_id: bigint;
|
|
215
238
|
branch_name: string | null;
|
|
216
239
|
branch_code: string | null;
|
|
240
|
+
address_1: string | null;
|
|
241
|
+
address_2: string | null;
|
|
242
|
+
country_id: bigint | null;
|
|
243
|
+
postcode: string | null;
|
|
217
244
|
pic_name: string | null;
|
|
218
245
|
pic_contact: string | null;
|
|
219
246
|
pic_email: string | null;
|
|
247
|
+
remark: string | null;
|
|
220
248
|
is_hq: number;
|
|
221
249
|
branch_contact: string | null;
|
|
222
250
|
branch_email: string | null;
|
|
@@ -236,19 +264,19 @@ export declare const BranchModel: ({ prisma, accountId, actionUserId }: {
|
|
|
236
264
|
isdelete: boolean | null;
|
|
237
265
|
istrash: boolean | null;
|
|
238
266
|
accountid: bigint;
|
|
239
|
-
remark: string | null;
|
|
240
|
-
address_1: string | null;
|
|
241
|
-
address_2: string | null;
|
|
242
|
-
state_id: bigint | null;
|
|
243
267
|
area_id: bigint | null;
|
|
244
|
-
|
|
245
|
-
postcode: string | null;
|
|
268
|
+
state_id: bigint | null;
|
|
246
269
|
branch_id: bigint;
|
|
247
270
|
branch_name: string | null;
|
|
248
271
|
branch_code: string | null;
|
|
272
|
+
address_1: string | null;
|
|
273
|
+
address_2: string | null;
|
|
274
|
+
country_id: bigint | null;
|
|
275
|
+
postcode: string | null;
|
|
249
276
|
pic_name: string | null;
|
|
250
277
|
pic_contact: string | null;
|
|
251
278
|
pic_email: string | null;
|
|
279
|
+
remark: string | null;
|
|
252
280
|
is_hq: number;
|
|
253
281
|
branch_contact: string | null;
|
|
254
282
|
branch_email: string | null;
|
|
@@ -92,7 +92,18 @@ export declare const BranchUserModel: ({ prisma, accountId, actionUserId }: {
|
|
|
92
92
|
update: ({ id, where, data }: {
|
|
93
93
|
id?: number;
|
|
94
94
|
where?: Record<string, any>;
|
|
95
|
-
data:
|
|
95
|
+
data: Partial<{
|
|
96
|
+
user_id: bigint | null;
|
|
97
|
+
createdatetime: Date | null;
|
|
98
|
+
createuserid: bigint | null;
|
|
99
|
+
updatedatetime: Date | null;
|
|
100
|
+
updateuserid: bigint | null;
|
|
101
|
+
isdelete: boolean | null;
|
|
102
|
+
istrash: boolean | null;
|
|
103
|
+
accountid: bigint | null;
|
|
104
|
+
branch_user_id: bigint;
|
|
105
|
+
parent_user_id: bigint | null;
|
|
106
|
+
}>;
|
|
96
107
|
}) => Promise<{
|
|
97
108
|
user_id: bigint | null;
|
|
98
109
|
createdatetime: Date | null;
|
|
@@ -12,16 +12,16 @@ export declare const ModelBusinessFields: {
|
|
|
12
12
|
accountid: "accountid";
|
|
13
13
|
business_id: "business_id";
|
|
14
14
|
email: "email";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
website: "website";
|
|
18
|
-
company_contact: "company_contact";
|
|
15
|
+
area_id: "area_id";
|
|
16
|
+
state_id: "state_id";
|
|
19
17
|
address_1: "address_1";
|
|
20
18
|
address_2: "address_2";
|
|
21
|
-
state_id: "state_id";
|
|
22
|
-
area_id: "area_id";
|
|
23
19
|
country_id: "country_id";
|
|
24
20
|
postcode: "postcode";
|
|
21
|
+
company_name: "company_name";
|
|
22
|
+
id_number: "id_number";
|
|
23
|
+
website: "website";
|
|
24
|
+
company_contact: "company_contact";
|
|
25
25
|
};
|
|
26
26
|
export type ModelBusiness = businesses;
|
|
27
27
|
export type ModelBusinessOmitFields = typeof primaryKey | DefaultOmitFields;
|
|
@@ -56,7 +56,7 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
56
56
|
accountId: number;
|
|
57
57
|
actionUserId: number;
|
|
58
58
|
}) => {
|
|
59
|
-
primaryKey: "status" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "business_id" | "email" | "
|
|
59
|
+
primaryKey: "status" | "createdatetime" | "createuserid" | "updatedatetime" | "updateuserid" | "isdelete" | "istrash" | "accountid" | "business_id" | "email" | "area_id" | "state_id" | "address_1" | "address_2" | "country_id" | "postcode" | "company_name" | "id_number" | "website" | "company_contact";
|
|
60
60
|
getFields: (prefix?: string, excludeKeywords?: string[]) => Promise<{
|
|
61
61
|
name: string;
|
|
62
62
|
type: string;
|
|
@@ -74,16 +74,16 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
74
74
|
accountid: bigint;
|
|
75
75
|
business_id: bigint;
|
|
76
76
|
email: string | null;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
website: string | null;
|
|
80
|
-
company_contact: string | null;
|
|
77
|
+
area_id: bigint | null;
|
|
78
|
+
state_id: bigint | null;
|
|
81
79
|
address_1: string | null;
|
|
82
80
|
address_2: string | null;
|
|
83
|
-
state_id: bigint | null;
|
|
84
|
-
area_id: bigint | null;
|
|
85
81
|
country_id: bigint | null;
|
|
86
82
|
postcode: string | null;
|
|
83
|
+
company_name: string | null;
|
|
84
|
+
id_number: string | null;
|
|
85
|
+
website: string | null;
|
|
86
|
+
company_contact: string | null;
|
|
87
87
|
}>;
|
|
88
88
|
get: ({ id, where, include, }: {
|
|
89
89
|
id?: number;
|
|
@@ -100,16 +100,16 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
100
100
|
accountid: bigint;
|
|
101
101
|
business_id: bigint;
|
|
102
102
|
email: string | null;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
website: string | null;
|
|
106
|
-
company_contact: string | null;
|
|
103
|
+
area_id: bigint | null;
|
|
104
|
+
state_id: bigint | null;
|
|
107
105
|
address_1: string | null;
|
|
108
106
|
address_2: string | null;
|
|
109
|
-
state_id: bigint | null;
|
|
110
|
-
area_id: bigint | null;
|
|
111
107
|
country_id: bigint | null;
|
|
112
108
|
postcode: string | null;
|
|
109
|
+
company_name: string | null;
|
|
110
|
+
id_number: string | null;
|
|
111
|
+
website: string | null;
|
|
112
|
+
company_contact: string | null;
|
|
113
113
|
} | null>;
|
|
114
114
|
list: ({ where, orderBy, offset, limit, include }?: any) => Promise<{
|
|
115
115
|
status: number;
|
|
@@ -122,21 +122,42 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
122
122
|
accountid: bigint;
|
|
123
123
|
business_id: bigint;
|
|
124
124
|
email: string | null;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
website: string | null;
|
|
128
|
-
company_contact: string | null;
|
|
125
|
+
area_id: bigint | null;
|
|
126
|
+
state_id: bigint | null;
|
|
129
127
|
address_1: string | null;
|
|
130
128
|
address_2: string | null;
|
|
131
|
-
state_id: bigint | null;
|
|
132
|
-
area_id: bigint | null;
|
|
133
129
|
country_id: bigint | null;
|
|
134
130
|
postcode: string | null;
|
|
131
|
+
company_name: string | null;
|
|
132
|
+
id_number: string | null;
|
|
133
|
+
website: string | null;
|
|
134
|
+
company_contact: string | null;
|
|
135
135
|
}[]>;
|
|
136
136
|
update: ({ id, where, data }: {
|
|
137
137
|
id?: number;
|
|
138
138
|
where?: Record<string, any>;
|
|
139
|
-
data:
|
|
139
|
+
data: Partial<{
|
|
140
|
+
status: number;
|
|
141
|
+
createdatetime: Date | null;
|
|
142
|
+
createuserid: bigint;
|
|
143
|
+
updatedatetime: Date | null;
|
|
144
|
+
updateuserid: bigint;
|
|
145
|
+
isdelete: boolean | null;
|
|
146
|
+
istrash: boolean | null;
|
|
147
|
+
accountid: bigint;
|
|
148
|
+
business_id: bigint;
|
|
149
|
+
email: string | null;
|
|
150
|
+
area_id: bigint | null;
|
|
151
|
+
state_id: bigint | null;
|
|
152
|
+
address_1: string | null;
|
|
153
|
+
address_2: string | null;
|
|
154
|
+
country_id: bigint | null;
|
|
155
|
+
postcode: string | null;
|
|
156
|
+
company_name: string | null;
|
|
157
|
+
id_number: string | null;
|
|
158
|
+
website: string | null;
|
|
159
|
+
company_contact: string | null;
|
|
160
|
+
}>;
|
|
140
161
|
}) => Promise<{
|
|
141
162
|
status: number;
|
|
142
163
|
createdatetime: Date | null;
|
|
@@ -148,16 +169,16 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
148
169
|
accountid: bigint;
|
|
149
170
|
business_id: bigint;
|
|
150
171
|
email: string | null;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
website: string | null;
|
|
154
|
-
company_contact: string | null;
|
|
172
|
+
area_id: bigint | null;
|
|
173
|
+
state_id: bigint | null;
|
|
155
174
|
address_1: string | null;
|
|
156
175
|
address_2: string | null;
|
|
157
|
-
state_id: bigint | null;
|
|
158
|
-
area_id: bigint | null;
|
|
159
176
|
country_id: bigint | null;
|
|
160
177
|
postcode: string | null;
|
|
178
|
+
company_name: string | null;
|
|
179
|
+
id_number: string | null;
|
|
180
|
+
website: string | null;
|
|
181
|
+
company_contact: string | null;
|
|
161
182
|
}>;
|
|
162
183
|
trash: ({ ids }: {
|
|
163
184
|
ids: number[];
|
|
@@ -172,16 +193,16 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
172
193
|
accountid: bigint;
|
|
173
194
|
business_id: bigint;
|
|
174
195
|
email: string | null;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
website: string | null;
|
|
178
|
-
company_contact: string | null;
|
|
196
|
+
area_id: bigint | null;
|
|
197
|
+
state_id: bigint | null;
|
|
179
198
|
address_1: string | null;
|
|
180
199
|
address_2: string | null;
|
|
181
|
-
state_id: bigint | null;
|
|
182
|
-
area_id: bigint | null;
|
|
183
200
|
country_id: bigint | null;
|
|
184
201
|
postcode: string | null;
|
|
202
|
+
company_name: string | null;
|
|
203
|
+
id_number: string | null;
|
|
204
|
+
website: string | null;
|
|
205
|
+
company_contact: string | null;
|
|
185
206
|
}[]>;
|
|
186
207
|
remove: ({ ids, where }: {
|
|
187
208
|
ids?: number[];
|
|
@@ -197,16 +218,16 @@ export declare const BusinessModel: ({ prisma, accountId, actionUserId }: {
|
|
|
197
218
|
accountid: bigint;
|
|
198
219
|
business_id: bigint;
|
|
199
220
|
email: string | null;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
website: string | null;
|
|
203
|
-
company_contact: string | null;
|
|
221
|
+
area_id: bigint | null;
|
|
222
|
+
state_id: bigint | null;
|
|
204
223
|
address_1: string | null;
|
|
205
224
|
address_2: string | null;
|
|
206
|
-
state_id: bigint | null;
|
|
207
|
-
area_id: bigint | null;
|
|
208
225
|
country_id: bigint | null;
|
|
209
226
|
postcode: string | null;
|
|
227
|
+
company_name: string | null;
|
|
228
|
+
id_number: string | null;
|
|
229
|
+
website: string | null;
|
|
230
|
+
company_contact: string | null;
|
|
210
231
|
}[]>;
|
|
211
232
|
raw: <T = any>(query: string, params?: any[]) => Promise<T[]>;
|
|
212
233
|
rawExec: (query: string, params?: any[]) => Promise<number>;
|
|
@@ -104,7 +104,20 @@ export declare const GroupModel: ({ prisma, accountId, actionUserId }: {
|
|
|
104
104
|
update: ({ id, where, data }: {
|
|
105
105
|
id?: number;
|
|
106
106
|
where?: Record<string, any>;
|
|
107
|
-
data:
|
|
107
|
+
data: Partial<{
|
|
108
|
+
status: number | null;
|
|
109
|
+
createdatetime: Date | null;
|
|
110
|
+
createuserid: bigint;
|
|
111
|
+
updatedatetime: Date | null;
|
|
112
|
+
updateuserid: bigint;
|
|
113
|
+
isdelete: boolean | null;
|
|
114
|
+
istrash: boolean | null;
|
|
115
|
+
accountid: bigint;
|
|
116
|
+
group_id: bigint;
|
|
117
|
+
group_label: string | null;
|
|
118
|
+
group_description: string | null;
|
|
119
|
+
group_type: string | null;
|
|
120
|
+
}>;
|
|
108
121
|
}) => Promise<{
|
|
109
122
|
status: number | null;
|
|
110
123
|
createdatetime: Date | null;
|
|
@@ -100,7 +100,19 @@ export declare const GroupOwnerModel: ({ prisma, accountId, actionUserId }: {
|
|
|
100
100
|
update: ({ id, where, data }: {
|
|
101
101
|
id?: number;
|
|
102
102
|
where?: Record<string, any>;
|
|
103
|
-
data:
|
|
103
|
+
data: Partial<{
|
|
104
|
+
type: string;
|
|
105
|
+
user_id: bigint;
|
|
106
|
+
createdatetime: Date | null;
|
|
107
|
+
createuserid: bigint;
|
|
108
|
+
updatedatetime: Date | null;
|
|
109
|
+
updateuserid: bigint;
|
|
110
|
+
isdelete: boolean | null;
|
|
111
|
+
istrash: boolean | null;
|
|
112
|
+
accountid: bigint;
|
|
113
|
+
group_id: bigint;
|
|
114
|
+
group_owner_id: bigint;
|
|
115
|
+
}>;
|
|
104
116
|
}) => Promise<{
|
|
105
117
|
type: string;
|
|
106
118
|
user_id: bigint;
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { ModelFactory } from "./ModelFactory";
|
|
2
|
+
export type { DefaultOmitFields } from "./default";
|
|
1
3
|
export { UserModel, ModelUserFields } from "./user/UserModel";
|
|
2
4
|
export { UserStatusModel, ModelUserStatusFields } from "./user/UserStatusModel";
|
|
3
5
|
export { UserPropModel, ModelUserPropFields } from "./user/UserPropModel";
|