@ooneex/typeorm 0.0.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.
Files changed (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/ooneex-typeorm-0.0.1.tgz +0 -0
  4. package/dist/shared/chunk-2e7zbxcq.js +5 -0
  5. package/dist/shared/chunk-2e7zbxcq.js.map +10 -0
  6. package/dist/shared/chunk-764bzjhz.js +5 -0
  7. package/dist/shared/chunk-764bzjhz.js.map +12 -0
  8. package/dist/shared/chunk-eh420jqn.js +5 -0
  9. package/dist/shared/chunk-eh420jqn.js.map +15 -0
  10. package/dist/shared/chunk-gjsgnzaq.js +5 -0
  11. package/dist/shared/chunk-gjsgnzaq.js.map +10 -0
  12. package/dist/shared/chunk-hw4vdg6q.js +5 -0
  13. package/dist/shared/chunk-hw4vdg6q.js.map +10 -0
  14. package/dist/shared/chunk-j7nprmyh.js +5 -0
  15. package/dist/shared/chunk-j7nprmyh.js.map +10 -0
  16. package/dist/shared/chunk-kgxsdeye.js +5 -0
  17. package/dist/shared/chunk-kgxsdeye.js.map +13 -0
  18. package/dist/shared/chunk-ntrrrvwt.js +5 -0
  19. package/dist/shared/chunk-ntrrrvwt.js.map +12 -0
  20. package/dist/shared/chunk-pwhygf44.js +5 -0
  21. package/dist/shared/chunk-pwhygf44.js.map +10 -0
  22. package/dist/shared/chunk-sd6mmec6.js +5 -0
  23. package/dist/shared/chunk-sd6mmec6.js.map +12 -0
  24. package/dist/shared/chunk-wawk30n1.js +5 -0
  25. package/dist/shared/chunk-wawk30n1.js.map +14 -0
  26. package/dist/shared/chunk-wmftwzcs.js +5 -0
  27. package/dist/shared/chunk-wmftwzcs.js.map +16 -0
  28. package/dist/shared/chunk-zmzz7hqq.js +5 -0
  29. package/dist/shared/chunk-zmzz7hqq.js.map +10 -0
  30. package/dist/src/entities/book/index.d.ts +62 -0
  31. package/dist/src/entities/book/index.js +4 -0
  32. package/dist/src/entities/book/index.js.map +9 -0
  33. package/dist/src/entities/common/index.d.ts +81 -0
  34. package/dist/src/entities/common/index.js +4 -0
  35. package/dist/src/entities/common/index.js.map +9 -0
  36. package/dist/src/entities/gamification/flashcard/index.d.ts +179 -0
  37. package/dist/src/entities/gamification/flashcard/index.js +4 -0
  38. package/dist/src/entities/gamification/flashcard/index.js.map +9 -0
  39. package/dist/src/entities/gamification/index.d.ts +22 -0
  40. package/dist/src/entities/gamification/index.js +4 -0
  41. package/dist/src/entities/gamification/index.js.map +9 -0
  42. package/dist/src/entities/gamification/mcq/index.d.ts +74 -0
  43. package/dist/src/entities/gamification/mcq/index.js +4 -0
  44. package/dist/src/entities/gamification/mcq/index.js.map +9 -0
  45. package/dist/src/entities/image/index.d.ts +35 -0
  46. package/dist/src/entities/image/index.js +4 -0
  47. package/dist/src/entities/image/index.js.map +9 -0
  48. package/dist/src/entities/payment/index.d.ts +89 -0
  49. package/dist/src/entities/payment/index.js +4 -0
  50. package/dist/src/entities/payment/index.js.map +9 -0
  51. package/dist/src/entities/user/index.d.ts +122 -0
  52. package/dist/src/entities/user/index.js +4 -0
  53. package/dist/src/entities/user/index.js.map +9 -0
  54. package/dist/src/entities/video/index.d.ts +67 -0
  55. package/dist/src/entities/video/index.js +4 -0
  56. package/dist/src/entities/video/index.js.map +9 -0
  57. package/dist/src/repositories/book/index.d.ts +128 -0
  58. package/dist/src/repositories/book/index.js +4 -0
  59. package/dist/src/repositories/book/index.js.map +12 -0
  60. package/dist/src/repositories/common/index.d.ts +210 -0
  61. package/dist/src/repositories/common/index.js +4 -0
  62. package/dist/src/repositories/common/index.js.map +15 -0
  63. package/dist/src/repositories/gamification/flashcard/index.d.ts +330 -0
  64. package/dist/src/repositories/gamification/flashcard/index.js +4 -0
  65. package/dist/src/repositories/gamification/flashcard/index.js.map +16 -0
  66. package/dist/src/repositories/gamification/index.d.ts +506 -0
  67. package/dist/src/repositories/gamification/index.js +4 -0
  68. package/dist/src/repositories/gamification/index.js.map +10 -0
  69. package/dist/src/repositories/gamification/mcq/index.d.ts +163 -0
  70. package/dist/src/repositories/gamification/mcq/index.js +4 -0
  71. package/dist/src/repositories/gamification/mcq/index.js.map +13 -0
  72. package/dist/src/repositories/image/index.d.ts +57 -0
  73. package/dist/src/repositories/image/index.js +4 -0
  74. package/dist/src/repositories/image/index.js.map +10 -0
  75. package/dist/src/repositories/payment/index.d.ts +220 -0
  76. package/dist/src/repositories/payment/index.js +4 -0
  77. package/dist/src/repositories/payment/index.js.map +15 -0
  78. package/dist/src/repositories/user/index.d.ts +245 -0
  79. package/dist/src/repositories/user/index.js +4 -0
  80. package/dist/src/repositories/user/index.js.map +14 -0
  81. package/dist/src/repositories/video/index.d.ts +132 -0
  82. package/dist/src/repositories/video/index.js +4 -0
  83. package/dist/src/repositories/video/index.js.map +12 -0
  84. package/package.json +155 -0
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/repositories/gamification/LevelRepository.ts"],
4
+ "sourcesContent": [
5
+ "import { inject } from \"@ooneex/container\";\nimport type { ITypeormDatabaseAdapter } from \"@ooneex/database\";\nimport type { FilterResultType } from \"@ooneex/types\";\nimport type { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from \"typeorm\";\nimport { ILike } from \"typeorm\";\nimport { LevelEntity } from \"../../entities/gamification/LevelEntity\";\n\nexport class LevelRepository {\n constructor(\n @inject(\"database\")\n private readonly database: ITypeormDatabaseAdapter,\n ) {}\n\n public async open(): Promise<Repository<LevelEntity>> {\n return await this.database.open(LevelEntity);\n }\n\n public async close(): Promise<void> {\n await this.database.close();\n }\n\n public async find(\n criteria: FindManyOptions<LevelEntity> & { page?: number; limit?: number; q?: string },\n ): Promise<FilterResultType<LevelEntity>> {\n const repository = await this.open();\n\n const { page = 1, limit = 100, q, ...rest } = criteria;\n\n let skip: number | undefined;\n const take = limit === 0 ? 100 : limit;\n\n if (page && page > 0 && limit && limit > 0) {\n skip = (page - 1) * take;\n }\n\n // Apply level name search if q parameter is provided\n let findOptions = { ...rest, take, ...(skip !== undefined && { skip }) };\n if (q) {\n findOptions = {\n ...findOptions,\n where: {\n ...rest.where,\n name: ILike(`%${q}%`),\n },\n };\n }\n\n const result = await repository.find(findOptions);\n\n // Apply the same where conditions for count including name search\n let countWhere = rest.where;\n if (q) {\n countWhere = {\n ...rest.where,\n name: ILike(`%${q}%`),\n };\n }\n\n const total = await this.count(countWhere);\n const totalPages = Math.ceil(total / limit);\n\n return {\n resources: result,\n total,\n totalPages,\n page,\n limit,\n };\n }\n\n public async findOne(id: string): Promise<LevelEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: { id },\n });\n }\n\n public async findOneBy(criteria: FindOptionsWhere<LevelEntity>): Promise<LevelEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: criteria,\n });\n }\n\n public async findByCode(code: string): Promise<LevelEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: { code },\n });\n }\n\n public async create(entity: LevelEntity, options?: SaveOptions): Promise<LevelEntity> {\n const repository = await this.open();\n\n return await repository.save(entity, options);\n }\n\n public async createMany(entities: LevelEntity[], options?: SaveOptions): Promise<LevelEntity[]> {\n const repository = await this.open();\n\n return await repository.save(entities, options);\n }\n\n public async update(entity: LevelEntity, options?: SaveOptions): Promise<LevelEntity> {\n return await this.create(entity, options);\n }\n\n public async updateMany(entities: LevelEntity[], options?: SaveOptions): Promise<LevelEntity[]> {\n return await this.createMany(entities, options);\n }\n\n public async delete(\n criteria: FindOptionsWhere<LevelEntity> | FindOptionsWhere<LevelEntity>[],\n ): Promise<UpdateResult> {\n const repository = await this.open();\n\n return await repository.softDelete(criteria);\n }\n\n public async count(criteria?: FindOptionsWhere<LevelEntity> | FindOptionsWhere<LevelEntity>[]): Promise<number> {\n const repository = await this.open();\n\n return await repository.count(criteria ? { where: criteria } : {});\n }\n}\n"
6
+ ],
7
+ "mappings": ";qaAAA,MAAS,kCAIT,wBAAS,wBAGF,cAAM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EAA+C,CAG9F,OAAO,MAFY,MAAM,KAAK,KAAK,GAEX,KAAK,EAAU,CAAO,OAGnC,OAAM,CAAC,EAAqB,EAA6C,CACpF,OAAO,MAAM,KAAK,OAAO,EAAQ,CAAO,OAG7B,WAAU,CAAC,EAAyB,EAA+C,CAC9F,OAAO,MAAM,KAAK,WAAW,EAAU,CAAO,OAGnC,OAAM,CACjB,EACuB,CAGvB,OAAO,MAFY,MAAM,KAAK,KAAK,GAEX,WAAW,CAAQ,OAGhC,MAAK,CAAC,EAA6F,CAG9G,OAAO,MAFY,MAAM,KAAK,KAAK,GAEX,MAAM,EAAW,CAAE,MAAO,CAAS,EAAI,CAAC,CAAC,EAErE,CAxHa,EAAN,GAEF,MAAO,UAAU,GAFf,sGAAM",
8
+ "debugId": "22C9B241C8D4094864756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,163 @@
1
+ import { ITypeormDatabaseAdapter } from "@ooneex/database";
2
+ import { FilterResultType } from "@ooneex/types";
3
+ import { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from "typeorm";
4
+ import { IMcqQuestion, IMcqQuestionChoice } from "@ooneex/gamification/mcq";
5
+ import { EMcqQuestionChoiceLetter } from "@ooneex/gamification/mcq";
6
+ import { LocaleType } from "@ooneex/translation";
7
+ import { IBase } from "@ooneex/types";
8
+ declare abstract class BaseEntity implements IBase {
9
+ id: string;
10
+ isLocked?: boolean;
11
+ lockedAt?: Date;
12
+ isBlocked?: boolean;
13
+ blockedAt?: Date;
14
+ blockReason?: string;
15
+ isPublic?: boolean;
16
+ language?: LocaleType;
17
+ createdAt?: Date;
18
+ updatedAt?: Date;
19
+ deletedAt?: Date;
20
+ }
21
+ declare class McqQuestionChoiceEntity extends BaseEntity implements IMcqQuestionChoice {
22
+ letter: EMcqQuestionChoiceLetter;
23
+ text: string;
24
+ isCorrect: boolean;
25
+ explanation?: string;
26
+ question: IMcqQuestion;
27
+ }
28
+ declare class McqQuestionChoiceRepository {
29
+ private readonly database;
30
+ constructor(database: ITypeormDatabaseAdapter);
31
+ open(): Promise<Repository<McqQuestionChoiceEntity>>;
32
+ close(): Promise<void>;
33
+ find(criteria: FindManyOptions<McqQuestionChoiceEntity> & {
34
+ page?: number;
35
+ limit?: number;
36
+ }): Promise<FilterResultType<McqQuestionChoiceEntity>>;
37
+ findOne(id: string): Promise<McqQuestionChoiceEntity | null>;
38
+ findOneBy(criteria: FindOptionsWhere<McqQuestionChoiceEntity>): Promise<McqQuestionChoiceEntity | null>;
39
+ findByQuestion(questionId: string): Promise<McqQuestionChoiceEntity[]>;
40
+ findCorrectChoicesByQuestion(questionId: string): Promise<McqQuestionChoiceEntity[]>;
41
+ create(entity: McqQuestionChoiceEntity, options?: SaveOptions): Promise<McqQuestionChoiceEntity>;
42
+ createMany(entities: McqQuestionChoiceEntity[], options?: SaveOptions): Promise<McqQuestionChoiceEntity[]>;
43
+ update(entity: McqQuestionChoiceEntity, options?: SaveOptions): Promise<McqQuestionChoiceEntity>;
44
+ updateMany(entities: McqQuestionChoiceEntity[], options?: SaveOptions): Promise<McqQuestionChoiceEntity[]>;
45
+ delete(criteria: FindOptionsWhere<McqQuestionChoiceEntity> | FindOptionsWhere<McqQuestionChoiceEntity>[]): Promise<UpdateResult>;
46
+ count(criteria?: FindOptionsWhere<McqQuestionChoiceEntity> | FindOptionsWhere<McqQuestionChoiceEntity>[]): Promise<number>;
47
+ }
48
+ import { ITypeormDatabaseAdapter as ITypeormDatabaseAdapter2 } from "@ooneex/database";
49
+ import { FilterResultType as FilterResultType2 } from "@ooneex/types";
50
+ import { FindManyOptions as FindManyOptions2, FindOptionsWhere as FindOptionsWhere2, Repository as Repository2, SaveOptions as SaveOptions2, UpdateResult as UpdateResult2 } from "typeorm";
51
+ import { IMcqQuestion as IMcqQuestion2, IMcqQuestionChoice as IMcqQuestionChoice2 } from "@ooneex/gamification/mcq";
52
+ import { IImage } from "@ooneex/image";
53
+ import { IStatus } from "@ooneex/status";
54
+ import { ITag } from "@ooneex/tag";
55
+ import { IStat } from "@ooneex/types";
56
+ declare class McqQuestionEntity extends BaseEntity implements IMcqQuestion2 {
57
+ questionNumber: number;
58
+ text: string;
59
+ choices: IMcqQuestionChoice2[];
60
+ context?: string;
61
+ contextId?: string;
62
+ stat?: IStat;
63
+ status?: IStatus;
64
+ image?: IImage;
65
+ tags?: ITag[];
66
+ }
67
+ declare class McqQuestionRepository {
68
+ private readonly database;
69
+ constructor(database: ITypeormDatabaseAdapter2);
70
+ open(): Promise<Repository2<McqQuestionEntity>>;
71
+ close(): Promise<void>;
72
+ find(criteria: FindManyOptions2<McqQuestionEntity> & {
73
+ page?: number;
74
+ limit?: number;
75
+ q?: string;
76
+ }): Promise<FilterResultType2<McqQuestionEntity>>;
77
+ findOne(id: string): Promise<McqQuestionEntity | null>;
78
+ findOneBy(criteria: FindOptionsWhere2<McqQuestionEntity>): Promise<McqQuestionEntity | null>;
79
+ create(entity: McqQuestionEntity, options?: SaveOptions2): Promise<McqQuestionEntity>;
80
+ createMany(entities: McqQuestionEntity[], options?: SaveOptions2): Promise<McqQuestionEntity[]>;
81
+ update(entity: McqQuestionEntity, options?: SaveOptions2): Promise<McqQuestionEntity>;
82
+ updateMany(entities: McqQuestionEntity[], options?: SaveOptions2): Promise<McqQuestionEntity[]>;
83
+ delete(criteria: FindOptionsWhere2<McqQuestionEntity> | FindOptionsWhere2<McqQuestionEntity>[]): Promise<UpdateResult2>;
84
+ count(criteria?: FindOptionsWhere2<McqQuestionEntity> | FindOptionsWhere2<McqQuestionEntity>[]): Promise<number>;
85
+ }
86
+ import { ITypeormDatabaseAdapter as ITypeormDatabaseAdapter3 } from "@ooneex/database";
87
+ import { FilterResultType as FilterResultType3 } from "@ooneex/types";
88
+ import { FindManyOptions as FindManyOptions3, FindOptionsWhere as FindOptionsWhere3, Repository as Repository3, SaveOptions as SaveOptions3, UpdateResult as UpdateResult3 } from "typeorm";
89
+ import { EAnswerState } from "@ooneex/gamification";
90
+ import { IMcqQuestion as IMcqQuestion3, IMcqQuestionChoice as IMcqQuestionChoice3, IMcqSession, IMcqSessionQuestion } from "@ooneex/gamification/mcq";
91
+ declare class McqSessionQuestionEntity extends BaseEntity implements IMcqSessionQuestion {
92
+ session: IMcqSession;
93
+ question: IMcqQuestion3;
94
+ questionNumber: number;
95
+ selectedChoices: IMcqQuestionChoice3[];
96
+ context?: string;
97
+ contextId?: string;
98
+ state: EAnswerState;
99
+ score: number;
100
+ }
101
+ declare class McqSessionQuestionRepository {
102
+ private readonly database;
103
+ constructor(database: ITypeormDatabaseAdapter3);
104
+ open(): Promise<Repository3<McqSessionQuestionEntity>>;
105
+ close(): Promise<void>;
106
+ find(criteria: FindManyOptions3<McqSessionQuestionEntity> & {
107
+ page?: number;
108
+ limit?: number;
109
+ q?: string;
110
+ }): Promise<FilterResultType3<McqSessionQuestionEntity>>;
111
+ findOne(id: string): Promise<McqSessionQuestionEntity | null>;
112
+ findOneBy(criteria: FindOptionsWhere3<McqSessionQuestionEntity>): Promise<McqSessionQuestionEntity | null>;
113
+ create(entity: McqSessionQuestionEntity, options?: SaveOptions3): Promise<McqSessionQuestionEntity>;
114
+ createMany(entities: McqSessionQuestionEntity[], options?: SaveOptions3): Promise<McqSessionQuestionEntity[]>;
115
+ update(entity: McqSessionQuestionEntity, options?: SaveOptions3): Promise<McqSessionQuestionEntity>;
116
+ updateMany(entities: McqSessionQuestionEntity[], options?: SaveOptions3): Promise<McqSessionQuestionEntity[]>;
117
+ delete(criteria: FindOptionsWhere3<McqSessionQuestionEntity> | FindOptionsWhere3<McqSessionQuestionEntity>[]): Promise<UpdateResult3>;
118
+ count(criteria?: FindOptionsWhere3<McqSessionQuestionEntity> | FindOptionsWhere3<McqSessionQuestionEntity>[]): Promise<number>;
119
+ }
120
+ import { ITypeormDatabaseAdapter as ITypeormDatabaseAdapter4 } from "@ooneex/database";
121
+ import { FilterResultType as FilterResultType4 } from "@ooneex/types";
122
+ import { FindManyOptions as FindManyOptions4, FindOptionsWhere as FindOptionsWhere4, Repository as Repository4, SaveOptions as SaveOptions4, UpdateResult as UpdateResult4 } from "typeorm";
123
+ import { ILevel } from "@ooneex/gamification";
124
+ import { ESessionType } from "@ooneex/gamification";
125
+ import { IMcqQuestion as IMcqQuestion4, IMcqSession as IMcqSession2 } from "@ooneex/gamification/mcq";
126
+ import { EMcqSessionStatus } from "@ooneex/gamification/mcq";
127
+ declare class McqSessionEntity extends BaseEntity implements IMcqSession2 {
128
+ name: string;
129
+ totalQuestions: number;
130
+ answeredCount: number;
131
+ correctCount: number;
132
+ incorrectCount: number;
133
+ timing: number;
134
+ questions: IMcqQuestion4[];
135
+ status: EMcqSessionStatus;
136
+ score: number;
137
+ startedAt?: Date | null;
138
+ pausedAt?: Date | null;
139
+ resumedAt?: Date | null;
140
+ completedAt?: Date | null;
141
+ type: ESessionType;
142
+ level: ILevel;
143
+ }
144
+ declare class McqSessionRepository {
145
+ private readonly database;
146
+ constructor(database: ITypeormDatabaseAdapter4);
147
+ open(): Promise<Repository4<McqSessionEntity>>;
148
+ close(): Promise<void>;
149
+ find(criteria: FindManyOptions4<McqSessionEntity> & {
150
+ page?: number;
151
+ limit?: number;
152
+ q?: string;
153
+ }): Promise<FilterResultType4<McqSessionEntity>>;
154
+ findOne(id: string): Promise<McqSessionEntity | null>;
155
+ findOneBy(criteria: FindOptionsWhere4<McqSessionEntity>): Promise<McqSessionEntity | null>;
156
+ create(entity: McqSessionEntity, options?: SaveOptions4): Promise<McqSessionEntity>;
157
+ createMany(entities: McqSessionEntity[], options?: SaveOptions4): Promise<McqSessionEntity[]>;
158
+ update(entity: McqSessionEntity, options?: SaveOptions4): Promise<McqSessionEntity>;
159
+ updateMany(entities: McqSessionEntity[], options?: SaveOptions4): Promise<McqSessionEntity[]>;
160
+ delete(criteria: FindOptionsWhere4<McqSessionEntity> | FindOptionsWhere4<McqSessionEntity>[]): Promise<UpdateResult4>;
161
+ count(criteria?: FindOptionsWhere4<McqSessionEntity> | FindOptionsWhere4<McqSessionEntity>[]): Promise<number>;
162
+ }
163
+ export { McqSessionRepository, McqSessionQuestionRepository, McqQuestionRepository, McqQuestionChoiceRepository };
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{l as w,m as b,n as W,o as C}from"../../../../shared/chunk-kgxsdeye.js";import"../../../../shared/chunk-hw4vdg6q.js";import"../../../../shared/chunk-2e7zbxcq.js";import"../../../../shared/chunk-764bzjhz.js";import"../../../../shared/chunk-pwhygf44.js";import{V as N,W as T,X as U}from"../../../../shared/chunk-j7nprmyh.js";import{inject as E}from"@ooneex/container";class Y{database;constructor(x){this.database=x}async open(){return await this.database.open(b)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,...D}=x,B,F=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*F;let H=await v.find({...D,take:F,...B!==void 0&&{skip:B}}),G=await this.count(D.where),V=Math.ceil(G/A);return{resources:H,total:G,totalPages:V,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async findByQuestion(x){return await(await this.open()).find({where:{question:{id:x}},order:{letter:"ASC"}})}async findCorrectChoicesByQuestion(x){return await(await this.open()).find({where:{question:{id:x},isCorrect:!0},order:{letter:"ASC"}})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}Y=N([T(0,E("database")),U("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],Y);import{inject as f}from"@ooneex/container";import{ILike as j}from"typeorm";class Z{database;constructor(x){this.database=x}async open(){return await this.database.open(w)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,q:D,...B}=x,F,H=A===0?100:A;if(z&&z>0&&A&&A>0)F=(z-1)*H;let G={...B,take:H,...F!==void 0&&{skip:F}};if(D)G={...G,where:{...B.where,text:j(`%${D}%`)}};let V=await v.find(G),J=B.where;if(D)J={...B.where,text:j(`%${D}%`)};let K=await this.count(J),X=Math.ceil(K/A);return{resources:V,total:K,totalPages:X,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}Z=N([T(0,f("database")),U("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],Z);import{inject as O}from"@ooneex/container";import{ILike as P}from"typeorm";class _{database;constructor(x){this.database=x}async open(){return await this.database.open(C)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,q:D,...B}=x,F,H=A===0?100:A;if(z&&z>0&&A&&A>0)F=(z-1)*H;let G={...B,take:H,...F!==void 0&&{skip:F}};if(D)G={...G,where:{...B.where,question:{text:P(`%${D}%`)}}};let V=await v.find(G),J=B.where;if(D)J={...B.where,question:{text:P(`%${D}%`)}};let K=await this.count(J),X=Math.ceil(K/A);return{resources:V,total:K,totalPages:X,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}_=N([T(0,O("database")),U("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],_);import{inject as I}from"@ooneex/container";import{ILike as L}from"typeorm";class ${database;constructor(x){this.database=x}async open(){return await this.database.open(W)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,q:D,...B}=x,F,H=A===0?100:A;if(z&&z>0&&A&&A>0)F=(z-1)*H;let G={...B,take:H,...F!==void 0&&{skip:F}};if(D)G={...G,where:{...B.where,name:L(`%${D}%`)}};let V=await v.find(G),J=B.where;if(D)J={...B.where,name:L(`%${D}%`)};let K=await this.count(J),X=Math.ceil(K/A);return{resources:V,total:K,totalPages:X,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}$=N([T(0,I("database")),U("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],$);export{$ as McqSessionRepository,_ as McqSessionQuestionRepository,Z as McqQuestionRepository,Y as McqQuestionChoiceRepository};export{Y as h,Z as i,_ as j,$ as k};
3
+
4
+ //# debugId=11E930C017B42A4F64756E2164756E21
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/repositories/gamification/mcq/McqQuestionChoiceRepository.ts", "src/repositories/gamification/mcq/McqQuestionRepository.ts", "src/repositories/gamification/mcq/McqSessionQuestionRepository.ts", "src/repositories/gamification/mcq/McqSessionRepository.ts"],
4
+ "sourcesContent": [
5
+ "import { inject } from \"@ooneex/container\";\nimport type { ITypeormDatabaseAdapter } from \"@ooneex/database\";\nimport type { FilterResultType } from \"@ooneex/types\";\nimport type { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from \"typeorm\";\nimport { McqQuestionChoiceEntity } from \"../../../entities/gamification/mcq/McqQuestionChoiceEntity\";\n\nexport class McqQuestionChoiceRepository {\n constructor(\n @inject(\"database\")\n private readonly database: ITypeormDatabaseAdapter,\n ) {}\n\n public async open(): Promise<Repository<McqQuestionChoiceEntity>> {\n return await this.database.open(McqQuestionChoiceEntity);\n }\n\n public async close(): Promise<void> {\n await this.database.close();\n }\n\n public async find(\n criteria: FindManyOptions<McqQuestionChoiceEntity> & { page?: number; limit?: number },\n ): Promise<FilterResultType<McqQuestionChoiceEntity>> {\n const repository = await this.open();\n\n const { page = 1, limit = 100, ...rest } = criteria;\n\n let skip: number | undefined;\n const take = limit === 0 ? 100 : limit;\n\n if (page && page > 0 && limit && limit > 0) {\n skip = (page - 1) * take;\n }\n\n const result = await repository.find({ ...rest, take, ...(skip !== undefined && { skip }) });\n\n const total = await this.count(rest.where);\n const totalPages = Math.ceil(total / limit);\n\n return {\n resources: result,\n total,\n totalPages,\n page,\n limit,\n };\n }\n\n public async findOne(id: string): Promise<McqQuestionChoiceEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: { id },\n });\n }\n\n public async findOneBy(criteria: FindOptionsWhere<McqQuestionChoiceEntity>): Promise<McqQuestionChoiceEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: criteria,\n });\n }\n\n public async findByQuestion(questionId: string): Promise<McqQuestionChoiceEntity[]> {\n const repository = await this.open();\n\n return await repository.find({\n where: { question: { id: questionId } },\n order: { letter: \"ASC\" },\n });\n }\n\n public async findCorrectChoicesByQuestion(questionId: string): Promise<McqQuestionChoiceEntity[]> {\n const repository = await this.open();\n\n return await repository.find({\n where: {\n question: { id: questionId },\n isCorrect: true,\n },\n order: { letter: \"ASC\" },\n });\n }\n\n public async create(entity: McqQuestionChoiceEntity, options?: SaveOptions): Promise<McqQuestionChoiceEntity> {\n const repository = await this.open();\n\n return await repository.save(entity, options);\n }\n\n public async createMany(\n entities: McqQuestionChoiceEntity[],\n options?: SaveOptions,\n ): Promise<McqQuestionChoiceEntity[]> {\n const repository = await this.open();\n\n return await repository.save(entities, options);\n }\n\n public async update(entity: McqQuestionChoiceEntity, options?: SaveOptions): Promise<McqQuestionChoiceEntity> {\n return await this.create(entity, options);\n }\n\n public async updateMany(\n entities: McqQuestionChoiceEntity[],\n options?: SaveOptions,\n ): Promise<McqQuestionChoiceEntity[]> {\n return await this.createMany(entities, options);\n }\n\n public async delete(\n criteria: FindOptionsWhere<McqQuestionChoiceEntity> | FindOptionsWhere<McqQuestionChoiceEntity>[],\n ): Promise<UpdateResult> {\n const repository = await this.open();\n\n return await repository.softDelete(criteria);\n }\n\n public async count(\n criteria?: FindOptionsWhere<McqQuestionChoiceEntity> | FindOptionsWhere<McqQuestionChoiceEntity>[],\n ): Promise<number> {\n const repository = await this.open();\n\n return await repository.count(criteria ? { where: criteria } : {});\n }\n}\n",
6
+ "import { inject } from \"@ooneex/container\";\nimport type { ITypeormDatabaseAdapter } from \"@ooneex/database\";\nimport type { FilterResultType } from \"@ooneex/types\";\nimport type { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from \"typeorm\";\nimport { ILike } from \"typeorm\";\nimport { McqQuestionEntity } from \"../../../entities/gamification/mcq/McqQuestionEntity\";\n\nexport class McqQuestionRepository {\n constructor(\n @inject(\"database\")\n private readonly database: ITypeormDatabaseAdapter,\n ) {}\n\n public async open(): Promise<Repository<McqQuestionEntity>> {\n return await this.database.open(McqQuestionEntity);\n }\n\n public async close(): Promise<void> {\n await this.database.close();\n }\n\n public async find(\n criteria: FindManyOptions<McqQuestionEntity> & { page?: number; limit?: number; q?: string },\n ): Promise<FilterResultType<McqQuestionEntity>> {\n const repository = await this.open();\n\n const { page = 1, limit = 100, q, ...rest } = criteria;\n\n let skip: number | undefined;\n const take = limit === 0 ? 100 : limit;\n\n if (page && page > 0 && limit && limit > 0) {\n skip = (page - 1) * take;\n }\n\n // Apply question text search if q parameter is provided\n let findOptions = { ...rest, take, ...(skip !== undefined && { skip }) };\n if (q) {\n findOptions = {\n ...findOptions,\n where: {\n ...rest.where,\n text: ILike(`%${q}%`),\n },\n };\n }\n\n const result = await repository.find(findOptions);\n\n // Apply the same where conditions for count including text search\n let countWhere = rest.where;\n if (q) {\n countWhere = {\n ...rest.where,\n text: ILike(`%${q}%`),\n };\n }\n\n const total = await this.count(countWhere);\n const totalPages = Math.ceil(total / limit);\n\n return {\n resources: result,\n total,\n totalPages,\n page,\n limit,\n };\n }\n\n public async findOne(id: string): Promise<McqQuestionEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: { id },\n });\n }\n\n public async findOneBy(criteria: FindOptionsWhere<McqQuestionEntity>): Promise<McqQuestionEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: criteria,\n });\n }\n\n public async create(entity: McqQuestionEntity, options?: SaveOptions): Promise<McqQuestionEntity> {\n const repository = await this.open();\n\n return await repository.save(entity, options);\n }\n\n public async createMany(entities: McqQuestionEntity[], options?: SaveOptions): Promise<McqQuestionEntity[]> {\n const repository = await this.open();\n\n return await repository.save(entities, options);\n }\n\n public async update(entity: McqQuestionEntity, options?: SaveOptions): Promise<McqQuestionEntity> {\n return await this.create(entity, options);\n }\n\n public async updateMany(entities: McqQuestionEntity[], options?: SaveOptions): Promise<McqQuestionEntity[]> {\n return await this.createMany(entities, options);\n }\n\n public async delete(\n criteria: FindOptionsWhere<McqQuestionEntity> | FindOptionsWhere<McqQuestionEntity>[],\n ): Promise<UpdateResult> {\n const repository = await this.open();\n\n return await repository.softDelete(criteria);\n }\n\n public async count(\n criteria?: FindOptionsWhere<McqQuestionEntity> | FindOptionsWhere<McqQuestionEntity>[],\n ): Promise<number> {\n const repository = await this.open();\n\n return await repository.count(criteria ? { where: criteria } : {});\n }\n}\n",
7
+ "import { inject } from \"@ooneex/container\";\nimport type { ITypeormDatabaseAdapter } from \"@ooneex/database\";\nimport type { FilterResultType } from \"@ooneex/types\";\nimport type { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from \"typeorm\";\nimport { ILike } from \"typeorm\";\nimport { McqSessionQuestionEntity } from \"../../../entities/gamification/mcq/McqSessionQuestionEntity\";\n\nexport class McqSessionQuestionRepository {\n constructor(\n @inject(\"database\")\n private readonly database: ITypeormDatabaseAdapter,\n ) {}\n\n public async open(): Promise<Repository<McqSessionQuestionEntity>> {\n return await this.database.open(McqSessionQuestionEntity);\n }\n\n public async close(): Promise<void> {\n await this.database.close();\n }\n\n public async find(\n criteria: FindManyOptions<McqSessionQuestionEntity> & { page?: number; limit?: number; q?: string },\n ): Promise<FilterResultType<McqSessionQuestionEntity>> {\n const repository = await this.open();\n\n const { page = 1, limit = 100, q, ...rest } = criteria;\n\n let skip: number | undefined;\n const take = limit === 0 ? 100 : limit;\n\n if (page && page > 0 && limit && limit > 0) {\n skip = (page - 1) * take;\n }\n\n // Apply question text search if q parameter is provided\n let findOptions = { ...rest, take, ...(skip !== undefined && { skip }) };\n if (q) {\n findOptions = {\n ...findOptions,\n where: {\n ...rest.where,\n question: {\n text: ILike(`%${q}%`),\n },\n },\n };\n }\n\n const result = await repository.find(findOptions);\n\n // Apply the same where conditions for count including question text search\n let countWhere = rest.where;\n if (q) {\n countWhere = {\n ...rest.where,\n question: {\n text: ILike(`%${q}%`),\n },\n };\n }\n\n const total = await this.count(countWhere);\n const totalPages = Math.ceil(total / limit);\n\n return {\n resources: result,\n total,\n totalPages,\n page,\n limit,\n };\n }\n\n public async findOne(id: string): Promise<McqSessionQuestionEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: { id },\n });\n }\n\n public async findOneBy(\n criteria: FindOptionsWhere<McqSessionQuestionEntity>,\n ): Promise<McqSessionQuestionEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: criteria,\n });\n }\n\n public async create(entity: McqSessionQuestionEntity, options?: SaveOptions): Promise<McqSessionQuestionEntity> {\n const repository = await this.open();\n\n return await repository.save(entity, options);\n }\n\n public async createMany(\n entities: McqSessionQuestionEntity[],\n options?: SaveOptions,\n ): Promise<McqSessionQuestionEntity[]> {\n const repository = await this.open();\n\n return await repository.save(entities, options);\n }\n\n public async update(entity: McqSessionQuestionEntity, options?: SaveOptions): Promise<McqSessionQuestionEntity> {\n return await this.create(entity, options);\n }\n\n public async updateMany(\n entities: McqSessionQuestionEntity[],\n options?: SaveOptions,\n ): Promise<McqSessionQuestionEntity[]> {\n return await this.createMany(entities, options);\n }\n\n public async delete(\n criteria: FindOptionsWhere<McqSessionQuestionEntity> | FindOptionsWhere<McqSessionQuestionEntity>[],\n ): Promise<UpdateResult> {\n const repository = await this.open();\n\n return await repository.softDelete(criteria);\n }\n\n public async count(\n criteria?: FindOptionsWhere<McqSessionQuestionEntity> | FindOptionsWhere<McqSessionQuestionEntity>[],\n ): Promise<number> {\n const repository = await this.open();\n\n return await repository.count(criteria ? { where: criteria } : {});\n }\n}\n",
8
+ "import { inject } from \"@ooneex/container\";\nimport type { ITypeormDatabaseAdapter } from \"@ooneex/database\";\nimport type { FilterResultType } from \"@ooneex/types\";\nimport type { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from \"typeorm\";\nimport { ILike } from \"typeorm\";\nimport { McqSessionEntity } from \"../../../entities/gamification/mcq/McqSessionEntity\";\n\nexport class McqSessionRepository {\n constructor(\n @inject(\"database\")\n private readonly database: ITypeormDatabaseAdapter,\n ) {}\n\n public async open(): Promise<Repository<McqSessionEntity>> {\n return await this.database.open(McqSessionEntity);\n }\n\n public async close(): Promise<void> {\n await this.database.close();\n }\n\n public async find(\n criteria: FindManyOptions<McqSessionEntity> & { page?: number; limit?: number; q?: string },\n ): Promise<FilterResultType<McqSessionEntity>> {\n const repository = await this.open();\n\n const { page = 1, limit = 100, q, ...rest } = criteria;\n\n let skip: number | undefined;\n const take = limit === 0 ? 100 : limit;\n\n if (page && page > 0 && limit && limit > 0) {\n skip = (page - 1) * take;\n }\n\n // Apply session name search if q parameter is provided\n let findOptions = { ...rest, take, ...(skip !== undefined && { skip }) };\n if (q) {\n findOptions = {\n ...findOptions,\n where: {\n ...rest.where,\n name: ILike(`%${q}%`),\n },\n };\n }\n\n const result = await repository.find(findOptions);\n\n // Apply the same where conditions for count including name search\n let countWhere = rest.where;\n if (q) {\n countWhere = {\n ...rest.where,\n name: ILike(`%${q}%`),\n };\n }\n\n const total = await this.count(countWhere);\n const totalPages = Math.ceil(total / limit);\n\n return {\n resources: result,\n total,\n totalPages,\n page,\n limit,\n };\n }\n\n public async findOne(id: string): Promise<McqSessionEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: { id },\n });\n }\n\n public async findOneBy(criteria: FindOptionsWhere<McqSessionEntity>): Promise<McqSessionEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: criteria,\n });\n }\n\n public async create(entity: McqSessionEntity, options?: SaveOptions): Promise<McqSessionEntity> {\n const repository = await this.open();\n\n return await repository.save(entity, options);\n }\n\n public async createMany(entities: McqSessionEntity[], options?: SaveOptions): Promise<McqSessionEntity[]> {\n const repository = await this.open();\n\n return await repository.save(entities, options);\n }\n\n public async update(entity: McqSessionEntity, options?: SaveOptions): Promise<McqSessionEntity> {\n return await this.create(entity, options);\n }\n\n public async updateMany(entities: McqSessionEntity[], options?: SaveOptions): Promise<McqSessionEntity[]> {\n return await this.createMany(entities, options);\n }\n\n public async delete(\n criteria: FindOptionsWhere<McqSessionEntity> | FindOptionsWhere<McqSessionEntity>[],\n ): Promise<UpdateResult> {\n const repository = await this.open();\n\n return await repository.softDelete(criteria);\n }\n\n public async count(\n criteria?: FindOptionsWhere<McqSessionEntity> | FindOptionsWhere<McqSessionEntity>[],\n ): Promise<number> {\n const repository = await this.open();\n\n return await repository.count(criteria ? { where: criteria } : {});\n }\n}\n"
9
+ ],
10
+ "mappings": ";kRAAA,4BAAS,qCAMF,iBAAM,YAA4B,YAGpB,SAFnB,WAAW,CAEQ,EACjB,CADiB,qBAGN,KAAI,EAAiD,CAChE,OAAO,MAAM,KAAK,SAAS,KAAK,CAAuB,OAG5C,MAAK,EAAkB,CAClC,MAAM,KAAK,SAAS,MAAM,OAGf,KAAI,CACf,EACoD,CACpD,I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A8B,EAAoD,CACxG,OAAO,MAAM,KAAK,WAAW,EAAU,CAAO,OAGnC,OAAM,CACjB,EACuB,CAGvB,OAAO,MAFY,MAAM,KAAK,KAAK,GAEX,WAAW,CAAQ,OAGhC,MAAK,CAChB,EACiB,CAGjB,OAAO,MAFY,MAAM,KAAK,KAAK,GAEX,MAAM,EAAW,CAAE,MAAO,CAAS,EAAI,CAAC,CAAC,EAErE,CAlHa,EAAN,GAEF,MAAO,UAAU,GAFf,sGAAM",
11
+ "debugId": "11E930C017B42A4F64756E2164756E21",
12
+ "names": []
13
+ }
@@ -0,0 +1,57 @@
1
+ import { ITypeormDatabaseAdapter } from "@ooneex/database";
2
+ import { FilterResultType } from "@ooneex/types";
3
+ import { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from "typeorm";
4
+ import { IImage, ImageFormatType, ImageMimeType } from "@ooneex/image";
5
+ import { IStatus } from "@ooneex/status";
6
+ import { ITag } from "@ooneex/tag";
7
+ import { ScalarType } from "@ooneex/types";
8
+ import { LocaleType } from "@ooneex/translation";
9
+ import { IBase } from "@ooneex/types";
10
+ declare abstract class BaseEntity implements IBase {
11
+ id: string;
12
+ isLocked?: boolean;
13
+ lockedAt?: Date;
14
+ isBlocked?: boolean;
15
+ blockedAt?: Date;
16
+ blockReason?: string;
17
+ isPublic?: boolean;
18
+ language?: LocaleType;
19
+ createdAt?: Date;
20
+ updatedAt?: Date;
21
+ deletedAt?: Date;
22
+ }
23
+ declare class ImageEntity extends BaseEntity implements IImage {
24
+ url: string;
25
+ width?: number;
26
+ height?: number;
27
+ alt?: string;
28
+ title?: string;
29
+ format?: ImageFormatType;
30
+ mimeType?: ImageMimeType;
31
+ size?: number;
32
+ metadata?: Record<string, ScalarType>;
33
+ context?: string;
34
+ contextId?: string;
35
+ status?: IStatus;
36
+ tags?: ITag[];
37
+ }
38
+ declare class ImageRepository {
39
+ private readonly database;
40
+ constructor(database: ITypeormDatabaseAdapter);
41
+ open(): Promise<Repository<ImageEntity>>;
42
+ close(): Promise<void>;
43
+ find(criteria: FindManyOptions<ImageEntity> & {
44
+ page?: number;
45
+ limit?: number;
46
+ q?: string;
47
+ }): Promise<FilterResultType<ImageEntity>>;
48
+ findOne(id: string): Promise<ImageEntity | null>;
49
+ findOneBy(criteria: FindOptionsWhere<ImageEntity>): Promise<ImageEntity | null>;
50
+ create(entity: ImageEntity, options?: SaveOptions): Promise<ImageEntity>;
51
+ createMany(entities: ImageEntity[], options?: SaveOptions): Promise<ImageEntity[]>;
52
+ update(entity: ImageEntity, options?: SaveOptions): Promise<ImageEntity>;
53
+ updateMany(entities: ImageEntity[], options?: SaveOptions): Promise<ImageEntity[]>;
54
+ delete(criteria: FindOptionsWhere<ImageEntity> | FindOptionsWhere<ImageEntity>[]): Promise<UpdateResult>;
55
+ count(criteria?: FindOptionsWhere<ImageEntity> | FindOptionsWhere<ImageEntity>[]): Promise<number>;
56
+ }
57
+ export { ImageRepository };
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{Q as X}from"../../../shared/chunk-2e7zbxcq.js";import"../../../shared/chunk-764bzjhz.js";import{V as T,W as U,X as V}from"../../../shared/chunk-j7nprmyh.js";import{inject as _}from"@ooneex/container";import{ILike as G}from"typeorm";class H{database;constructor(x){this.database=x}async open(){return await this.database.open(X)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,q:B,...D}=x,J,N=A===0?100:A;if(z&&z>0&&A&&A>0)J=(z-1)*N;let K={...D,take:N,...J!==void 0&&{skip:J}};if(B){let F=[{alt:G(`%${B}%`)},{title:G(`%${B}%`)}];K={...K,where:D.where?[...F.map((M)=>({...D.where,...M}))]:F}}let Y=await v.find(K),Q=D.where;if(B){let F=[{alt:G(`%${B}%`)},{title:G(`%${B}%`)}];Q=D.where?[...F.map((M)=>({...D.where,...M}))]:F}let S=await this.count(Q),Z=Math.ceil(S/A);return{resources:Y,total:S,totalPages:Z,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}H=T([U(0,_("database")),V("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],H);export{H as ImageRepository};
3
+
4
+ //# debugId=ED9063CA2FFCEF9364756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/repositories/image/ImageRepository.ts"],
4
+ "sourcesContent": [
5
+ "import { inject } from \"@ooneex/container\";\nimport type { ITypeormDatabaseAdapter } from \"@ooneex/database\";\nimport type { FilterResultType } from \"@ooneex/types\";\nimport type { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from \"typeorm\";\nimport { ILike } from \"typeorm\";\nimport { ImageEntity } from \"../../entities/image/ImageEntity\";\n\nexport class ImageRepository {\n constructor(\n @inject(\"database\")\n private readonly database: ITypeormDatabaseAdapter,\n ) {}\n\n public async open(): Promise<Repository<ImageEntity>> {\n return await this.database.open(ImageEntity);\n }\n\n public async close(): Promise<void> {\n await this.database.close();\n }\n\n public async find(\n criteria: FindManyOptions<ImageEntity> & { page?: number; limit?: number; q?: string },\n ): Promise<FilterResultType<ImageEntity>> {\n const repository = await this.open();\n\n const { page = 1, limit = 100, q, ...rest } = criteria;\n\n let skip: number | undefined;\n const take = limit === 0 ? 100 : limit;\n\n if (page && page > 0 && limit && limit > 0) {\n skip = (page - 1) * take;\n }\n\n // Apply image search if q parameter is provided\n let findOptions = { ...rest, take, ...(skip !== undefined && { skip }) };\n if (q) {\n const searchConditions = [{ alt: ILike(`%${q}%`) }, { title: ILike(`%${q}%`) }];\n\n findOptions = {\n ...findOptions,\n where: rest.where\n ? [...searchConditions.map((condition) => ({ ...rest.where, ...condition }))]\n : searchConditions,\n };\n }\n\n const result = await repository.find(findOptions);\n\n // Apply the same where conditions for count including search\n let countWhere = rest.where;\n if (q) {\n const searchConditions = [{ alt: ILike(`%${q}%`) }, { title: ILike(`%${q}%`) }];\n\n countWhere = rest.where\n ? [...searchConditions.map((condition) => ({ ...rest.where, ...condition }))]\n : searchConditions;\n }\n\n const total = await this.count(countWhere);\n const totalPages = Math.ceil(total / limit);\n\n return {\n resources: result,\n total,\n totalPages,\n page,\n limit,\n };\n }\n\n public async findOne(id: string): Promise<ImageEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: { id },\n });\n }\n\n public async findOneBy(criteria: FindOptionsWhere<ImageEntity>): Promise<ImageEntity | null> {\n const repository = await this.open();\n\n return await repository.findOne({\n where: criteria,\n });\n }\n\n public async create(entity: ImageEntity, options?: SaveOptions): Promise<ImageEntity> {\n const repository = await this.open();\n\n return await repository.save(entity, options);\n }\n\n public async createMany(entities: ImageEntity[], options?: SaveOptions): Promise<ImageEntity[]> {\n const repository = await this.open();\n\n return await repository.save(entities, options);\n }\n\n public async update(entity: ImageEntity, options?: SaveOptions): Promise<ImageEntity> {\n return await this.create(entity, options);\n }\n\n public async updateMany(entities: ImageEntity[], options?: SaveOptions): Promise<ImageEntity[]> {\n return await this.createMany(entities, options);\n }\n\n public async delete(\n criteria: FindOptionsWhere<ImageEntity> | FindOptionsWhere<ImageEntity>[],\n ): Promise<UpdateResult> {\n const repository = await this.open();\n\n return await repository.softDelete(criteria);\n }\n\n public async count(criteria?: FindOptionsWhere<ImageEntity> | FindOptionsWhere<ImageEntity>[]): Promise<number> {\n const repository = await this.open();\n\n return await repository.count(criteria ? { where: criteria } : {});\n }\n}\n"
6
+ ],
7
+ "mappings": ";oJAAA,yBAAS,kCAIT,gBAAS,gBAGF,MAAM,CAAgB,CAGR,SAFnB,WAAW,CAEQ,EACjB,CADiB,qBAGN,KAAI,EAAqC,CACpD,OAAO,MAAM,KAAK,SAAS,KAAK,CAAW,O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qB,EAA6C,CAGpF,OAAO,MAFY,MAAM,KAAK,KAAK,GAEX,KAAK,EAAQ,CAAO,OAGjC,WAAU,CAAC,EAAyB,EAA+C,CAG9F,OAAO,MAFY,MAAM,KAAK,KAAK,GAEX,KAAK,EAAU,CAAO,OAGnC,OAAM,CAAC,EAAqB,EAA6C,CACpF,OAAO,MAAM,KAAK,OAAO,EAAQ,CAAO,OAG7B,WAAU,CAAC,EAAyB,EAA+C,CAC9F,OAAO,MAAM,KAAK,WAAW,EAAU,CAAO,OAGnC,OAAM,CACjB,EACuB,CAGvB,OAAO,MAFY,MAAM,KAAK,KAAK,GAEX,WAAW,CAAQ,OAGhC,MAAK,CAAC,EAA6F,CAG9G,OAAO,MAFY,MAAM,KAAK,KAAK,GAEX,MAAM,EAAW,CAAE,MAAO,CAAS,EAAI,CAAC,CAAC,EAErE,CAlHa,EAAN,GAEF,MAAO,UAAU,GAFf,sGAAM",
8
+ "debugId": "ED9063CA2FFCEF9364756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,220 @@
1
+ import { ITypeormDatabaseAdapter } from "@ooneex/database";
2
+ import { FilterResultType } from "@ooneex/types";
3
+ import { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from "typeorm";
4
+ import { CurrencyCodeType } from "@ooneex/currencies";
5
+ import { EDiscountType, ICoupon, IPlan, IProduct } from "@ooneex/payment";
6
+ import { LocaleType } from "@ooneex/translation";
7
+ import { IBase } from "@ooneex/types";
8
+ declare abstract class BaseEntity implements IBase {
9
+ id: string;
10
+ isLocked?: boolean;
11
+ lockedAt?: Date;
12
+ isBlocked?: boolean;
13
+ blockedAt?: Date;
14
+ blockReason?: string;
15
+ isPublic?: boolean;
16
+ language?: LocaleType;
17
+ createdAt?: Date;
18
+ updatedAt?: Date;
19
+ deletedAt?: Date;
20
+ }
21
+ declare class PaymentCouponEntity extends BaseEntity implements ICoupon {
22
+ code: string;
23
+ name?: string;
24
+ description?: string;
25
+ discountType: EDiscountType;
26
+ discountValue: number;
27
+ currency?: CurrencyCodeType;
28
+ maxUses?: number;
29
+ usedCount?: number;
30
+ startAt?: Date;
31
+ endAt?: Date;
32
+ isActive?: boolean;
33
+ minimumAmount?: number;
34
+ applicableProducts?: IProduct[];
35
+ applicablePlans?: IPlan[];
36
+ }
37
+ declare class PaymentCouponRepository {
38
+ private readonly database;
39
+ constructor(database: ITypeormDatabaseAdapter);
40
+ open(): Promise<Repository<PaymentCouponEntity>>;
41
+ close(): Promise<void>;
42
+ find(criteria: FindManyOptions<PaymentCouponEntity> & {
43
+ page?: number;
44
+ limit?: number;
45
+ q?: string;
46
+ }): Promise<FilterResultType<PaymentCouponEntity>>;
47
+ findOne(id: string): Promise<PaymentCouponEntity | null>;
48
+ findOneBy(criteria: FindOptionsWhere<PaymentCouponEntity>): Promise<PaymentCouponEntity | null>;
49
+ create(entity: PaymentCouponEntity, options?: SaveOptions): Promise<PaymentCouponEntity>;
50
+ createMany(entities: PaymentCouponEntity[], options?: SaveOptions): Promise<PaymentCouponEntity[]>;
51
+ update(entity: PaymentCouponEntity, options?: SaveOptions): Promise<PaymentCouponEntity>;
52
+ updateMany(entities: PaymentCouponEntity[], options?: SaveOptions): Promise<PaymentCouponEntity[]>;
53
+ delete(criteria: FindOptionsWhere<PaymentCouponEntity> | FindOptionsWhere<PaymentCouponEntity>[]): Promise<UpdateResult>;
54
+ count(criteria?: FindOptionsWhere<PaymentCouponEntity> | FindOptionsWhere<PaymentCouponEntity>[]): Promise<number>;
55
+ }
56
+ import { ITypeormDatabaseAdapter as ITypeormDatabaseAdapter2 } from "@ooneex/database";
57
+ import { FilterResultType as FilterResultType2 } from "@ooneex/types";
58
+ import { FindManyOptions as FindManyOptions2, FindOptionsWhere as FindOptionsWhere2, Repository as Repository2, SaveOptions as SaveOptions2, UpdateResult as UpdateResult2 } from "typeorm";
59
+ import { CurrencyCodeType as CurrencyCodeType2 } from "@ooneex/currencies";
60
+ import { ICredit } from "@ooneex/payment";
61
+ declare class PaymentCreditEntity extends BaseEntity implements ICredit {
62
+ balance: number;
63
+ currency?: CurrencyCodeType2;
64
+ expiresAt?: Date;
65
+ description?: string;
66
+ }
67
+ declare class PaymentCreditRepository {
68
+ private readonly database;
69
+ constructor(database: ITypeormDatabaseAdapter2);
70
+ open(): Promise<Repository2<PaymentCreditEntity>>;
71
+ close(): Promise<void>;
72
+ find(criteria: FindManyOptions2<PaymentCreditEntity> & {
73
+ page?: number;
74
+ limit?: number;
75
+ q?: string;
76
+ }): Promise<FilterResultType2<PaymentCreditEntity>>;
77
+ findOne(id: string): Promise<PaymentCreditEntity | null>;
78
+ findOneBy(criteria: FindOptionsWhere2<PaymentCreditEntity>): Promise<PaymentCreditEntity | null>;
79
+ create(entity: PaymentCreditEntity, options?: SaveOptions2): Promise<PaymentCreditEntity>;
80
+ createMany(entities: PaymentCreditEntity[], options?: SaveOptions2): Promise<PaymentCreditEntity[]>;
81
+ update(entity: PaymentCreditEntity, options?: SaveOptions2): Promise<PaymentCreditEntity>;
82
+ updateMany(entities: PaymentCreditEntity[], options?: SaveOptions2): Promise<PaymentCreditEntity[]>;
83
+ delete(criteria: FindOptionsWhere2<PaymentCreditEntity> | FindOptionsWhere2<PaymentCreditEntity>[]): Promise<UpdateResult2>;
84
+ count(criteria?: FindOptionsWhere2<PaymentCreditEntity> | FindOptionsWhere2<PaymentCreditEntity>[]): Promise<number>;
85
+ }
86
+ import { ITypeormDatabaseAdapter as ITypeormDatabaseAdapter3 } from "@ooneex/database";
87
+ import { FilterResultType as FilterResultType3 } from "@ooneex/types";
88
+ import { FindManyOptions as FindManyOptions3, FindOptionsWhere as FindOptionsWhere3, Repository as Repository3, SaveOptions as SaveOptions3, UpdateResult as UpdateResult3 } from "typeorm";
89
+ import { IFeature } from "@ooneex/payment";
90
+ declare class PaymentFeatureEntity extends BaseEntity implements IFeature {
91
+ name: string;
92
+ description?: string;
93
+ isEnabled?: boolean;
94
+ limit?: number;
95
+ }
96
+ declare class PaymentFeatureRepository {
97
+ private readonly database;
98
+ constructor(database: ITypeormDatabaseAdapter3);
99
+ open(): Promise<Repository3<PaymentFeatureEntity>>;
100
+ close(): Promise<void>;
101
+ find(criteria: FindManyOptions3<PaymentFeatureEntity> & {
102
+ page?: number;
103
+ limit?: number;
104
+ q?: string;
105
+ }): Promise<FilterResultType3<PaymentFeatureEntity>>;
106
+ findOne(id: string): Promise<PaymentFeatureEntity | null>;
107
+ findOneBy(criteria: FindOptionsWhere3<PaymentFeatureEntity>): Promise<PaymentFeatureEntity | null>;
108
+ create(entity: PaymentFeatureEntity, options?: SaveOptions3): Promise<PaymentFeatureEntity>;
109
+ createMany(entities: PaymentFeatureEntity[], options?: SaveOptions3): Promise<PaymentFeatureEntity[]>;
110
+ update(entity: PaymentFeatureEntity, options?: SaveOptions3): Promise<PaymentFeatureEntity>;
111
+ updateMany(entities: PaymentFeatureEntity[], options?: SaveOptions3): Promise<PaymentFeatureEntity[]>;
112
+ delete(criteria: FindOptionsWhere3<PaymentFeatureEntity> | FindOptionsWhere3<PaymentFeatureEntity>[]): Promise<UpdateResult3>;
113
+ count(criteria?: FindOptionsWhere3<PaymentFeatureEntity> | FindOptionsWhere3<PaymentFeatureEntity>[]): Promise<number>;
114
+ }
115
+ import { ITypeormDatabaseAdapter as ITypeormDatabaseAdapter4 } from "@ooneex/database";
116
+ import { FilterResultType as FilterResultType4 } from "@ooneex/types";
117
+ import { FindManyOptions as FindManyOptions4, FindOptionsWhere as FindOptionsWhere4, Repository as Repository4, SaveOptions as SaveOptions4, UpdateResult as UpdateResult4 } from "typeorm";
118
+ import { CurrencyCodeType as CurrencyCodeType3 } from "@ooneex/currencies";
119
+ import { ESubscriptionPeriod, IFeature as IFeature2, IPlan as IPlan2 } from "@ooneex/payment";
120
+ declare class PaymentPlanEntity extends BaseEntity implements IPlan2 {
121
+ name: string;
122
+ description?: string;
123
+ currency: CurrencyCodeType3;
124
+ price: number;
125
+ period: ESubscriptionPeriod;
126
+ periodCount?: number;
127
+ features?: IFeature2[];
128
+ isActive?: boolean;
129
+ trialDays?: number;
130
+ }
131
+ declare class PaymentPlanRepository {
132
+ private readonly database;
133
+ constructor(database: ITypeormDatabaseAdapter4);
134
+ open(): Promise<Repository4<PaymentPlanEntity>>;
135
+ close(): Promise<void>;
136
+ find(criteria: FindManyOptions4<PaymentPlanEntity> & {
137
+ page?: number;
138
+ limit?: number;
139
+ q?: string;
140
+ }): Promise<FilterResultType4<PaymentPlanEntity>>;
141
+ findOne(id: string): Promise<PaymentPlanEntity | null>;
142
+ findOneBy(criteria: FindOptionsWhere4<PaymentPlanEntity>): Promise<PaymentPlanEntity | null>;
143
+ create(entity: PaymentPlanEntity, options?: SaveOptions4): Promise<PaymentPlanEntity>;
144
+ createMany(entities: PaymentPlanEntity[], options?: SaveOptions4): Promise<PaymentPlanEntity[]>;
145
+ update(entity: PaymentPlanEntity, options?: SaveOptions4): Promise<PaymentPlanEntity>;
146
+ updateMany(entities: PaymentPlanEntity[], options?: SaveOptions4): Promise<PaymentPlanEntity[]>;
147
+ delete(criteria: FindOptionsWhere4<PaymentPlanEntity> | FindOptionsWhere4<PaymentPlanEntity>[]): Promise<UpdateResult4>;
148
+ count(criteria?: FindOptionsWhere4<PaymentPlanEntity> | FindOptionsWhere4<PaymentPlanEntity>[]): Promise<number>;
149
+ }
150
+ import { ITypeormDatabaseAdapter as ITypeormDatabaseAdapter5 } from "@ooneex/database";
151
+ import { FilterResultType as FilterResultType5 } from "@ooneex/types";
152
+ import { FindManyOptions as FindManyOptions5, FindOptionsWhere as FindOptionsWhere5, Repository as Repository5, SaveOptions as SaveOptions5, UpdateResult as UpdateResult5 } from "typeorm";
153
+ import { ICategory } from "@ooneex/category";
154
+ import { CurrencyCodeType as CurrencyCodeType4 } from "@ooneex/currencies";
155
+ import { IImage } from "@ooneex/image";
156
+ import { IProduct as IProduct2 } from "@ooneex/payment";
157
+ import { ITag } from "@ooneex/tag";
158
+ import { ScalarType } from "@ooneex/types";
159
+ declare class PaymentProductEntity extends BaseEntity implements IProduct2 {
160
+ name: string;
161
+ description?: string;
162
+ categories?: ICategory[];
163
+ currency: CurrencyCodeType4;
164
+ price: number;
165
+ barcode?: string;
166
+ images?: IImage[];
167
+ attributes?: Record<string, ScalarType>;
168
+ tags?: ITag[];
169
+ }
170
+ declare class PaymentProductRepository {
171
+ private readonly database;
172
+ constructor(database: ITypeormDatabaseAdapter5);
173
+ open(): Promise<Repository5<PaymentProductEntity>>;
174
+ close(): Promise<void>;
175
+ find(criteria: FindManyOptions5<PaymentProductEntity> & {
176
+ page?: number;
177
+ limit?: number;
178
+ q?: string;
179
+ }): Promise<FilterResultType5<PaymentProductEntity>>;
180
+ findOne(id: string): Promise<PaymentProductEntity | null>;
181
+ findOneBy(criteria: FindOptionsWhere5<PaymentProductEntity>): Promise<PaymentProductEntity | null>;
182
+ create(entity: PaymentProductEntity, options?: SaveOptions5): Promise<PaymentProductEntity>;
183
+ createMany(entities: PaymentProductEntity[], options?: SaveOptions5): Promise<PaymentProductEntity[]>;
184
+ update(entity: PaymentProductEntity, options?: SaveOptions5): Promise<PaymentProductEntity>;
185
+ updateMany(entities: PaymentProductEntity[], options?: SaveOptions5): Promise<PaymentProductEntity[]>;
186
+ delete(criteria: FindOptionsWhere5<PaymentProductEntity> | FindOptionsWhere5<PaymentProductEntity>[]): Promise<UpdateResult5>;
187
+ count(criteria?: FindOptionsWhere5<PaymentProductEntity> | FindOptionsWhere5<PaymentProductEntity>[]): Promise<number>;
188
+ }
189
+ import { ITypeormDatabaseAdapter as ITypeormDatabaseAdapter6 } from "@ooneex/database";
190
+ import { FilterResultType as FilterResultType6 } from "@ooneex/types";
191
+ import { FindManyOptions as FindManyOptions6, FindOptionsWhere as FindOptionsWhere6, Repository as Repository6, SaveOptions as SaveOptions6, UpdateResult as UpdateResult6 } from "typeorm";
192
+ import { ICoupon as ICoupon2, ICredit as ICredit2, IPlan as IPlan3, ISubscription } from "@ooneex/payment";
193
+ declare class PaymentSubscriptionEntity extends BaseEntity implements Omit<ISubscription, "isActive"> {
194
+ coupons?: ICoupon2[];
195
+ plans?: IPlan3[];
196
+ credits?: ICredit2[];
197
+ startAt: Date;
198
+ endAt?: Date;
199
+ isTrial?: boolean;
200
+ isActive?: boolean;
201
+ }
202
+ declare class PaymentSubscriptionRepository {
203
+ private readonly database;
204
+ constructor(database: ITypeormDatabaseAdapter6);
205
+ open(): Promise<Repository6<PaymentSubscriptionEntity>>;
206
+ close(): Promise<void>;
207
+ find(criteria: FindManyOptions6<PaymentSubscriptionEntity> & {
208
+ page?: number;
209
+ limit?: number;
210
+ }): Promise<FilterResultType6<PaymentSubscriptionEntity>>;
211
+ findOne(id: string): Promise<PaymentSubscriptionEntity | null>;
212
+ findOneBy(criteria: FindOptionsWhere6<PaymentSubscriptionEntity>): Promise<PaymentSubscriptionEntity | null>;
213
+ create(entity: PaymentSubscriptionEntity, options?: SaveOptions6): Promise<PaymentSubscriptionEntity>;
214
+ createMany(entities: PaymentSubscriptionEntity[], options?: SaveOptions6): Promise<PaymentSubscriptionEntity[]>;
215
+ update(entity: PaymentSubscriptionEntity, options?: SaveOptions6): Promise<PaymentSubscriptionEntity>;
216
+ updateMany(entities: PaymentSubscriptionEntity[], options?: SaveOptions6): Promise<PaymentSubscriptionEntity[]>;
217
+ delete(criteria: FindOptionsWhere6<PaymentSubscriptionEntity> | FindOptionsWhere6<PaymentSubscriptionEntity>[]): Promise<UpdateResult6>;
218
+ count(criteria?: FindOptionsWhere6<PaymentSubscriptionEntity> | FindOptionsWhere6<PaymentSubscriptionEntity>[]): Promise<number>;
219
+ }
220
+ export { PaymentSubscriptionRepository, PaymentProductRepository, PaymentPlanRepository, PaymentFeatureRepository, PaymentCreditRepository, PaymentCouponRepository };
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{t as I,u as L,v as h,w as E,x as R,y as C}from"../../../shared/chunk-eh420jqn.js";import"../../../shared/chunk-zmzz7hqq.js";import"../../../shared/chunk-2e7zbxcq.js";import"../../../shared/chunk-764bzjhz.js";import{V as T,W as U,X as V}from"../../../shared/chunk-j7nprmyh.js";import{inject as g}from"@ooneex/container";import{ILike as Z}from"typeorm";class ${database;constructor(x){this.database=x}async open(){return await this.database.open(E)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,q:B,...D}=x,H,K=A===0?100:A;if(z&&z>0&&A&&A>0)H=(z-1)*K;let J={...D,take:K,...H!==void 0&&{skip:H}};if(B){let G=[{code:Z(`%${B}%`)},{name:Z(`%${B}%`)},{description:Z(`%${B}%`)}];J={...J,where:D.where?[...G.map((M)=>({...D.where,...M}))]:G}}let X=await v.find(J),N=D.where;if(B){let G=[{code:Z(`%${B}%`)},{name:Z(`%${B}%`)},{description:Z(`%${B}%`)}];N=D.where?[...G.map((M)=>({...D.where,...M}))]:G}let Q=await this.count(N),Y=Math.ceil(Q/A);return{resources:X,total:Q,totalPages:Y,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}$=T([U(0,g("database")),V("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],$);import{inject as q}from"@ooneex/container";import{ILike as O}from"typeorm";class F{database;constructor(x){this.database=x}async open(){return await this.database.open(R)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,q:B,...D}=x,H,K=A===0?100:A;if(z&&z>0&&A&&A>0)H=(z-1)*K;let J={...D,take:K,...H!==void 0&&{skip:H}};if(B)J={...J,where:{...D.where,description:O(`%${B}%`)}};let X=await v.find(J),N=D.where;if(B)N={...D.where,description:O(`%${B}%`)};let Q=await this.count(N),Y=Math.ceil(Q/A);return{resources:X,total:Q,totalPages:Y,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}F=T([U(0,q("database")),V("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],F);import{inject as u}from"@ooneex/container";import{ILike as S}from"typeorm";class j{database;constructor(x){this.database=x}async open(){return await this.database.open(I)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,q:B,...D}=x,H,K=A===0?100:A;if(z&&z>0&&A&&A>0)H=(z-1)*K;let J={...D,take:K,...H!==void 0&&{skip:H}};if(B){let G=[{name:S(`%${B}%`)},{description:S(`%${B}%`)}];J={...J,where:D.where?[...G.map((M)=>({...D.where,...M}))]:G}}let X=await v.find(J),N=D.where;if(B){let G=[{name:S(`%${B}%`)},{description:S(`%${B}%`)}];N=D.where?[...G.map((M)=>({...D.where,...M}))]:G}let Q=await this.count(N),Y=Math.ceil(Q/A);return{resources:X,total:Q,totalPages:Y,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}j=T([U(0,u("database")),V("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],j);import{inject as P}from"@ooneex/container";import{ILike as w}from"typeorm";class f{database;constructor(x){this.database=x}async open(){return await this.database.open(L)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,q:B,...D}=x,H,K=A===0?100:A;if(z&&z>0&&A&&A>0)H=(z-1)*K;let J={...D,take:K,...H!==void 0&&{skip:H}};if(B){let G=[{name:w(`%${B}%`)},{description:w(`%${B}%`)}];J={...J,where:D.where?[...G.map((M)=>({...D.where,...M}))]:G}}let X=await v.find(J),N=D.where;if(B){let G=[{name:w(`%${B}%`)},{description:w(`%${B}%`)}];N=D.where?[...G.map((M)=>({...D.where,...M}))]:G}let Q=await this.count(N),Y=Math.ceil(Q/A);return{resources:X,total:Q,totalPages:Y,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}f=T([U(0,P("database")),V("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],f);import{inject as k}from"@ooneex/container";import{ILike as _}from"typeorm";class W{database;constructor(x){this.database=x}async open(){return await this.database.open(h)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,q:B,...D}=x,H,K=A===0?100:A;if(z&&z>0&&A&&A>0)H=(z-1)*K;let J={...D,take:K,...H!==void 0&&{skip:H}};if(B){let G=[{name:_(`%${B}%`)},{description:_(`%${B}%`)},{barcode:_(`%${B}%`)}];J={...J,where:D.where?[...G.map((M)=>({...D.where,...M}))]:G}}let X=await v.find(J),N=D.where;if(B){let G=[{name:_(`%${B}%`)},{description:_(`%${B}%`)},{barcode:_(`%${B}%`)}];N=D.where?[...G.map((M)=>({...D.where,...M}))]:G}let Q=await this.count(N),Y=Math.ceil(Q/A);return{resources:X,total:Q,totalPages:Y,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}W=T([U(0,k("database")),V("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],W);import{inject as l}from"@ooneex/container";class b{database;constructor(x){this.database=x}async open(){return await this.database.open(C)}async close(){await this.database.close()}async find(x){let v=await this.open(),{page:z=1,limit:A=100,...B}=x,D,H=A===0?100:A;if(z&&z>0&&A&&A>0)D=(z-1)*H;let K=await v.find({...B,take:H,...D!==void 0&&{skip:D}}),J=await this.count(B.where),X=Math.ceil(J/A);return{resources:K,total:J,totalPages:X,page:z,limit:A}}async findOne(x){return await(await this.open()).findOne({where:{id:x}})}async findOneBy(x){return await(await this.open()).findOne({where:x})}async create(x,v){return await(await this.open()).save(x,v)}async createMany(x,v){return await(await this.open()).save(x,v)}async update(x,v){return await this.create(x,v)}async updateMany(x,v){return await this.createMany(x,v)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}b=T([U(0,l("database")),V("design:paramtypes",[typeof ITypeormDatabaseAdapter==="undefined"?Object:ITypeormDatabaseAdapter])],b);export{b as PaymentSubscriptionRepository,W as PaymentProductRepository,f as PaymentPlanRepository,j as PaymentFeatureRepository,F as PaymentCreditRepository,$ as PaymentCouponRepository};
3
+
4
+ //# debugId=EEDFDF331979925864756E2164756E21