@goweekdays/core 2.4.1 → 2.4.2
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +44 -79
- package/dist/index.js +1757 -2283
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1653 -2180
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,10 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
1
2
|
import Joi from 'joi';
|
|
2
3
|
import * as mongodb from 'mongodb';
|
|
3
4
|
import { ObjectId, ClientSession, Db, Collection } from 'mongodb';
|
|
4
|
-
import { Request, Response, NextFunction } from 'express';
|
|
5
5
|
import * as bson from 'bson';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
|
-
type TAddress = {
|
|
9
|
-
_id?: ObjectId;
|
|
10
|
-
type: string;
|
|
11
|
-
user: ObjectId | string;
|
|
12
|
-
org?: ObjectId | string;
|
|
13
|
-
country: string;
|
|
14
|
-
address: string;
|
|
15
|
-
continuedAddress?: string;
|
|
16
|
-
city: string;
|
|
17
|
-
province: string;
|
|
18
|
-
postalCode: string;
|
|
19
|
-
taxId: string;
|
|
20
|
-
};
|
|
21
|
-
declare const addressSchema: Joi.ObjectSchema<any>;
|
|
22
|
-
declare function MAddress(value: any): TAddress;
|
|
23
|
-
|
|
24
|
-
declare function useAddressRepo(): {
|
|
25
|
-
createIndex: () => Promise<void>;
|
|
26
|
-
add: (value: TAddress, session?: ClientSession) => Promise<ObjectId>;
|
|
27
|
-
getByUserId: (user: string | ObjectId) => Promise<TAddress | null>;
|
|
28
|
-
getByOrgId: (org: string | ObjectId) => Promise<TAddress | null>;
|
|
29
|
-
updateById: (_id: string | ObjectId, value: Pick<TAddress, "org" | "country" | "address" | "continuedAddress" | "city" | "province" | "postalCode" | "taxId">, session?: ClientSession) => Promise<string>;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
declare function useAddressController(): {
|
|
33
|
-
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
34
|
-
getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
35
|
-
getByOrgId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
36
|
-
updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
8
|
declare function useAuthService(): {
|
|
40
9
|
login: ({ email, password }?: {
|
|
41
10
|
email: string;
|
|
@@ -208,13 +177,13 @@ declare const TCounter: z.ZodObject<{
|
|
|
208
177
|
type: string;
|
|
209
178
|
createdAt: Date;
|
|
210
179
|
count: number;
|
|
211
|
-
_id?: ObjectId | undefined;
|
|
212
180
|
deletedAt?: Date | undefined;
|
|
181
|
+
_id?: ObjectId | undefined;
|
|
213
182
|
updatedAt?: Date | undefined;
|
|
214
183
|
}, {
|
|
215
184
|
type: string;
|
|
216
|
-
_id?: string | ObjectId | undefined;
|
|
217
185
|
deletedAt?: Date | undefined;
|
|
186
|
+
_id?: string | ObjectId | undefined;
|
|
218
187
|
updatedAt?: Date | undefined;
|
|
219
188
|
createdAt?: Date | undefined;
|
|
220
189
|
count?: number | undefined;
|
|
@@ -225,14 +194,14 @@ declare function useCounterModel(db: Db): {
|
|
|
225
194
|
type: string;
|
|
226
195
|
createdAt: Date;
|
|
227
196
|
count: number;
|
|
228
|
-
_id?: ObjectId | undefined;
|
|
229
197
|
deletedAt?: Date | undefined;
|
|
198
|
+
_id?: ObjectId | undefined;
|
|
230
199
|
updatedAt?: Date | undefined;
|
|
231
200
|
};
|
|
232
201
|
validateCounter: (data: unknown) => z.SafeParseReturnType<{
|
|
233
202
|
type: string;
|
|
234
|
-
_id?: string | ObjectId | undefined;
|
|
235
203
|
deletedAt?: Date | undefined;
|
|
204
|
+
_id?: string | ObjectId | undefined;
|
|
236
205
|
updatedAt?: Date | undefined;
|
|
237
206
|
createdAt?: Date | undefined;
|
|
238
207
|
count?: number | undefined;
|
|
@@ -240,23 +209,22 @@ declare function useCounterModel(db: Db): {
|
|
|
240
209
|
type: string;
|
|
241
210
|
createdAt: Date;
|
|
242
211
|
count: number;
|
|
243
|
-
_id?: ObjectId | undefined;
|
|
244
212
|
deletedAt?: Date | undefined;
|
|
213
|
+
_id?: ObjectId | undefined;
|
|
245
214
|
updatedAt?: Date | undefined;
|
|
246
215
|
}>;
|
|
247
216
|
collection: Collection<{
|
|
248
217
|
type: string;
|
|
249
218
|
createdAt: Date;
|
|
250
219
|
count: number;
|
|
251
|
-
_id?: ObjectId | undefined;
|
|
252
220
|
deletedAt?: Date | undefined;
|
|
221
|
+
_id?: ObjectId | undefined;
|
|
253
222
|
updatedAt?: Date | undefined;
|
|
254
223
|
}>;
|
|
255
224
|
};
|
|
256
225
|
|
|
257
226
|
declare function useCounterRepo(): {
|
|
258
|
-
|
|
259
|
-
createUniqueIndex: () => Promise<void>;
|
|
227
|
+
createIndexes: () => Promise<void>;
|
|
260
228
|
add: (type: string) => Promise<void>;
|
|
261
229
|
getByType: (type: string) => Promise<any>;
|
|
262
230
|
incrementByType: (type: string, session?: ClientSession) => Promise<void>;
|
|
@@ -279,6 +247,7 @@ declare class MFile implements TFile {
|
|
|
279
247
|
}
|
|
280
248
|
|
|
281
249
|
declare function useFileRepo(): {
|
|
250
|
+
createIndexes: () => Promise<string>;
|
|
282
251
|
createFile: (value: TFile, session?: ClientSession) => Promise<string>;
|
|
283
252
|
deleteFileById: (_id: string | ObjectId, session?: ClientSession) => Promise<string>;
|
|
284
253
|
getAllDraftedFiles: () => Promise<any[]>;
|
|
@@ -315,6 +284,7 @@ declare const schemaMemberStatus: Joi.ObjectSchema<any>;
|
|
|
315
284
|
declare function modelMember(value: TMember): TMember;
|
|
316
285
|
|
|
317
286
|
declare function useMemberRepo(): {
|
|
287
|
+
createIndexes: () => Promise<string>;
|
|
318
288
|
add: (value: TMember, session?: ClientSession) => Promise<string>;
|
|
319
289
|
getById: (_id: string | ObjectId) => Promise<TMember | null>;
|
|
320
290
|
getByRole: (role: string | ObjectId) => Promise<TMember | null>;
|
|
@@ -343,7 +313,7 @@ declare function useMemberRepo(): {
|
|
|
343
313
|
name: string;
|
|
344
314
|
}[]>;
|
|
345
315
|
updateStatusByUserId: (user: string | ObjectId, status: string) => Promise<string>;
|
|
346
|
-
updateName: (value: Pick<TMember, "
|
|
316
|
+
updateName: (value: Pick<TMember, "name" | "user">, session?: ClientSession) => Promise<string>;
|
|
347
317
|
getByUserId: (user: string | ObjectId) => Promise<TMember | null>;
|
|
348
318
|
getOrgsByMembership: ({ search, limit, page, user }?: {
|
|
349
319
|
search: string;
|
|
@@ -440,51 +410,43 @@ declare function useOrgController(): {
|
|
|
440
410
|
updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
441
411
|
};
|
|
442
412
|
|
|
443
|
-
type
|
|
413
|
+
type TPromo = {
|
|
444
414
|
_id?: ObjectId;
|
|
445
415
|
code: string;
|
|
446
|
-
|
|
447
|
-
type:
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
416
|
+
description?: string;
|
|
417
|
+
type: "flat" | "fixed" | "tiered";
|
|
418
|
+
flatRate?: number;
|
|
419
|
+
fixedRate?: number;
|
|
420
|
+
tiers?: Array<{
|
|
421
|
+
minSeats: number;
|
|
422
|
+
maxSeats: number;
|
|
423
|
+
rate: number;
|
|
424
|
+
}>;
|
|
425
|
+
currency: string;
|
|
426
|
+
startDate: Date | string;
|
|
427
|
+
endDate?: Date | string;
|
|
428
|
+
assignedTo?: string | ObjectId;
|
|
429
|
+
status: "active" | "inactive" | "expired";
|
|
430
|
+
assignedAt?: Date | string;
|
|
431
|
+
createdAt?: Date | string;
|
|
432
|
+
updatedAt?: Date | string;
|
|
433
|
+
deletedAt?: Date | string;
|
|
454
434
|
};
|
|
435
|
+
declare const schemaPromo: Joi.ObjectSchema<any>;
|
|
436
|
+
declare function modelPromo(data: TPromo): TPromo;
|
|
455
437
|
|
|
456
|
-
declare function
|
|
438
|
+
declare function usePromoRepo(): {
|
|
457
439
|
createIndexes: () => Promise<void>;
|
|
458
|
-
add: (value:
|
|
459
|
-
getAll: ({
|
|
460
|
-
search?: string | undefined;
|
|
440
|
+
add: (value: TPromo) => Promise<string>;
|
|
441
|
+
getAll: ({ page, limit, search, status, }?: {
|
|
461
442
|
page?: number | undefined;
|
|
462
443
|
limit?: number | undefined;
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
getById: (_id: string | ObjectId) => Promise<
|
|
468
|
-
updateFieldById: ({ _id, field, value }?: {
|
|
469
|
-
_id: string | ObjectId;
|
|
470
|
-
field: string;
|
|
471
|
-
value: string;
|
|
472
|
-
}, session?: ClientSession) => Promise<string>;
|
|
444
|
+
search?: string | undefined;
|
|
445
|
+
status?: string | undefined;
|
|
446
|
+
}) => Promise<TPaginate<TPromo>>;
|
|
447
|
+
getByCode: (code: string) => Promise<TPromo | null>;
|
|
448
|
+
getById: (_id: string | ObjectId) => Promise<TPromo | null>;
|
|
473
449
|
deleteById: (_id: string | ObjectId) => Promise<string>;
|
|
474
|
-
getByName: ({ name, prefix, type }?: {
|
|
475
|
-
name: string;
|
|
476
|
-
prefix?: string | undefined;
|
|
477
|
-
type?: string | undefined;
|
|
478
|
-
}) => Promise<TPSGC | null>;
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
declare function usePSGCController(): {
|
|
482
|
-
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
483
|
-
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
484
|
-
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
485
|
-
getByName: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
486
|
-
updateField: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
487
|
-
deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
488
450
|
};
|
|
489
451
|
|
|
490
452
|
type TRole = {
|
|
@@ -782,6 +744,7 @@ declare const schemaPlan: Joi.ObjectSchema<any>;
|
|
|
782
744
|
declare function modelPlan(data: any): TPlan;
|
|
783
745
|
|
|
784
746
|
declare function usePlanRepo(): {
|
|
747
|
+
createIndexes: () => Promise<void>;
|
|
785
748
|
add: (value: TPlan) => Promise<string>;
|
|
786
749
|
getAll: ({ page, limit, search, status, }?: {
|
|
787
750
|
page?: number | undefined;
|
|
@@ -826,6 +789,7 @@ declare const schemaSubscriptionSeats: Joi.ObjectSchema<any>;
|
|
|
826
789
|
declare function modelSubscription(data: any): TSubscription;
|
|
827
790
|
|
|
828
791
|
declare function useSubscriptionRepo(): {
|
|
792
|
+
createIndexes: () => Promise<void>;
|
|
829
793
|
add: (value: TSubscription, session?: ClientSession) => Promise<string>;
|
|
830
794
|
getAll: ({ page, limit, search, status, }?: {
|
|
831
795
|
page?: number | undefined;
|
|
@@ -867,6 +831,7 @@ declare const schemaSubscriptionTransaction: Joi.ObjectSchema<any>;
|
|
|
867
831
|
declare function modelSubscriptionTransaction(data: TSubscriptionTransaction): TSubscriptionTransaction;
|
|
868
832
|
|
|
869
833
|
declare function useSubscriptionTransactionRepo(): {
|
|
834
|
+
createIndexes: () => Promise<void>;
|
|
870
835
|
add: (value: TSubscriptionTransaction, session?: ClientSession) => Promise<string>;
|
|
871
836
|
getAll: ({ page, limit, search, id }?: {
|
|
872
837
|
page?: number | undefined;
|
|
@@ -1065,4 +1030,4 @@ declare const XENDIT_SECRET_KEY: string;
|
|
|
1065
1030
|
declare const XENDIT_BASE_URL: string;
|
|
1066
1031
|
declare const DOMAIN: string;
|
|
1067
1032
|
|
|
1068
|
-
export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE,
|
|
1033
|
+
export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MBuilding, MBuildingUnit, MFile, MONGO_DB, MONGO_URI, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PORT, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT, REFRESH_TOKEN_EXPIRY, REFRESH_TOKEN_SECRET, SECRET_KEY, SPACES_ACCESS_KEY, SPACES_BUCKET, SPACES_ENDPOINT, SPACES_REGION, SPACES_SECRET_KEY, TApp, TBuilding, TBuildingUnit, TCounter, TFile, TMember, TOrg, TPermission, TPermissionGroup, TPlan, TPromo, TRole, TSubscription, TSubscriptionTransaction, TUser, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, currencies, isDev, modelApp, modelMember, modelOrg, modelPermission, modelPermissionGroup, modelPlan, modelPromo, modelRole, modelSubscription, modelSubscriptionTransaction, modelUser, modelVerification, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaInviteMember, schemaMember, schemaMemberRole, schemaMemberStatus, schemaOrg, schemaOrgAdd, schemaOrgUpdate, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaPlan, schemaPromo, schemaRole, schemaRoleUpdate, schemaSubscription, schemaSubscriptionSeats, schemaSubscriptionTransaction, schemaSubscriptionUpdate, schemaUpdateOptions, schemaUser, schemaVerification, transactionSchema, useAppController, useAppRepo, useAppService, useAuthController, useAuthService, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGitHubService, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, usePlanController, usePlanRepo, usePlanService, usePromoRepo, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionTransactionController, useSubscriptionTransactionRepo, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
|