@ooneex/typeorm 0.13.0 → 0.14.0

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 (141) hide show
  1. package/dist/shared/chunk-19qhst35.js +5 -0
  2. package/dist/shared/{chunk-tqd6ek7s.js.map → chunk-19qhst35.js.map} +2 -2
  3. package/dist/shared/{chunk-trhrh4e1.js → chunk-31y260d6.js} +24 -89
  4. package/dist/shared/{chunk-trhrh4e1.js.map → chunk-31y260d6.js.map} +2 -2
  5. package/dist/shared/chunk-59vwmfpm.js +5 -0
  6. package/dist/shared/{chunk-r9hsk9fk.js.map → chunk-59vwmfpm.js.map} +1 -1
  7. package/dist/shared/chunk-5tnqjb3n.js +5 -0
  8. package/dist/shared/{chunk-2wdazj26.js.map → chunk-5tnqjb3n.js.map} +2 -2
  9. package/dist/shared/chunk-5ybg5hda.js +5 -0
  10. package/dist/shared/{chunk-m4mpkr4n.js.map → chunk-5ybg5hda.js.map} +2 -2
  11. package/dist/shared/chunk-6jnj2pfx.js +5 -0
  12. package/dist/shared/{chunk-p12g6e7b.js.map → chunk-6jnj2pfx.js.map} +2 -2
  13. package/dist/shared/chunk-6kdkyjbn.js +5 -0
  14. package/dist/shared/{chunk-mssxq87m.js.map → chunk-6kdkyjbn.js.map} +2 -2
  15. package/dist/shared/{chunk-jap9t59k.js → chunk-aj0aak90.js} +14 -52
  16. package/dist/shared/{chunk-jap9t59k.js.map → chunk-aj0aak90.js.map} +2 -2
  17. package/dist/shared/chunk-e51ktjsq.js +5 -0
  18. package/dist/shared/{chunk-efmap3y3.js.map → chunk-e51ktjsq.js.map} +2 -2
  19. package/dist/shared/{chunk-yszvxhf3.js → chunk-jr0xys18.js} +11 -41
  20. package/dist/shared/{chunk-yszvxhf3.js.map → chunk-jr0xys18.js.map} +2 -2
  21. package/dist/shared/chunk-kw4t1san.js +5 -0
  22. package/dist/shared/{chunk-m9wkjs7v.js.map → chunk-kw4t1san.js.map} +2 -2
  23. package/dist/shared/chunk-nfv9ce7v.js +5 -0
  24. package/dist/shared/{chunk-qbn9p4vj.js.map → chunk-nfv9ce7v.js.map} +2 -2
  25. package/dist/shared/chunk-p22keb3y.js +5 -0
  26. package/dist/shared/{chunk-bkdccdhn.js.map → chunk-p22keb3y.js.map} +2 -2
  27. package/dist/shared/chunk-pbns711f.js +5 -0
  28. package/dist/shared/{chunk-hkfj9j6w.js.map → chunk-pbns711f.js.map} +2 -2
  29. package/dist/shared/{chunk-6vmvyg0q.js → chunk-qrs0g3m9.js} +17 -58
  30. package/dist/shared/{chunk-6vmvyg0q.js.map → chunk-qrs0g3m9.js.map} +2 -2
  31. package/dist/shared/{chunk-eets3mef.js → chunk-qyf32qsz.js} +22 -75
  32. package/dist/shared/{chunk-eets3mef.js.map → chunk-qyf32qsz.js.map} +2 -2
  33. package/dist/shared/chunk-t1jad451.js +5 -0
  34. package/dist/shared/{chunk-cv6xa6qy.js.map → chunk-t1jad451.js.map} +2 -2
  35. package/dist/shared/chunk-t5cy307m.js +5 -0
  36. package/dist/shared/{chunk-wg7xcq50.js.map → chunk-t5cy307m.js.map} +2 -2
  37. package/dist/shared/chunk-x2d798hg.js +5 -0
  38. package/dist/shared/{chunk-sk8z5zmk.js.map → chunk-x2d798hg.js.map} +2 -2
  39. package/dist/shared/chunk-x3pmm3na.js +5 -0
  40. package/dist/shared/{chunk-cwxhwya1.js.map → chunk-x3pmm3na.js.map} +2 -2
  41. package/dist/shared/chunk-xrqhqgen.js +5 -0
  42. package/dist/shared/{chunk-chan1evn.js.map → chunk-xrqhqgen.js.map} +2 -2
  43. package/dist/shared/chunk-xwe8m6av.js +5 -0
  44. package/dist/shared/{chunk-0swb1h0m.js.map → chunk-xwe8m6av.js.map} +2 -2
  45. package/dist/shared/chunk-yrwsqc6r.js +5 -0
  46. package/dist/shared/{chunk-6m3p1ht9.js.map → chunk-yrwsqc6r.js.map} +2 -2
  47. package/dist/src/entities/book/index.js +2 -34
  48. package/dist/src/entities/book/index.js.map +1 -1
  49. package/dist/src/entities/common/index.js +2 -26
  50. package/dist/src/entities/common/index.js.map +1 -1
  51. package/dist/src/entities/country/index.js +2 -9
  52. package/dist/src/entities/country/index.js.map +1 -1
  53. package/dist/src/entities/currency/index.js +2 -9
  54. package/dist/src/entities/currency/index.js.map +1 -1
  55. package/dist/src/entities/folder/index.js +2 -394
  56. package/dist/src/entities/folder/index.js.map +2 -2
  57. package/dist/src/entities/gamification/flashcard/index.js +2 -26
  58. package/dist/src/entities/gamification/flashcard/index.js.map +1 -1
  59. package/dist/src/entities/gamification/index.js +2 -9
  60. package/dist/src/entities/gamification/index.js.map +1 -1
  61. package/dist/src/entities/gamification/mcq/index.js +2 -36
  62. package/dist/src/entities/gamification/mcq/index.js.map +1 -1
  63. package/dist/src/entities/image/index.js +2 -31
  64. package/dist/src/entities/image/index.js.map +1 -1
  65. package/dist/src/entities/medecine/index.js +2 -13
  66. package/dist/src/entities/medecine/index.js.map +1 -1
  67. package/dist/src/entities/payment/index.js +2 -23
  68. package/dist/src/entities/payment/index.js.map +1 -1
  69. package/dist/src/entities/user/index.js +2 -30
  70. package/dist/src/entities/user/index.js.map +1 -1
  71. package/dist/src/entities/video/index.js +2 -34
  72. package/dist/src/entities/video/index.js.map +1 -1
  73. package/dist/src/migrations/book/index.js +137 -541
  74. package/dist/src/migrations/book/index.js.map +2 -2
  75. package/dist/src/migrations/common/index.js +14 -63
  76. package/dist/src/migrations/common/index.js.map +2 -2
  77. package/dist/src/migrations/country/index.js +13 -48
  78. package/dist/src/migrations/country/index.js.map +2 -2
  79. package/dist/src/migrations/currency/index.js +14 -50
  80. package/dist/src/migrations/currency/index.js.map +2 -2
  81. package/dist/src/migrations/folder/index.js +104 -426
  82. package/dist/src/migrations/folder/index.js.map +2 -2
  83. package/dist/src/migrations/gamification/flashcard/index.js +96 -356
  84. package/dist/src/migrations/gamification/flashcard/index.js.map +2 -2
  85. package/dist/src/migrations/gamification/index.js +2 -8
  86. package/dist/src/migrations/gamification/index.js.map +1 -1
  87. package/dist/src/migrations/gamification/mcq/index.js +139 -553
  88. package/dist/src/migrations/gamification/mcq/index.js.map +2 -2
  89. package/dist/src/migrations/image/index.js +85 -353
  90. package/dist/src/migrations/image/index.js.map +2 -2
  91. package/dist/src/migrations/medecine/index.js +36 -132
  92. package/dist/src/migrations/medecine/index.js.map +2 -2
  93. package/dist/src/migrations/payment/index.js +94 -339
  94. package/dist/src/migrations/payment/index.js.map +2 -2
  95. package/dist/src/migrations/user/index.js +39 -331
  96. package/dist/src/migrations/user/index.js.map +2 -2
  97. package/dist/src/migrations/video/index.js +17 -345
  98. package/dist/src/migrations/video/index.js.map +2 -2
  99. package/dist/src/repositories/book/index.js +2 -997
  100. package/dist/src/repositories/book/index.js.map +2 -2
  101. package/dist/src/repositories/common/index.js +2 -439
  102. package/dist/src/repositories/common/index.js.map +2 -2
  103. package/dist/src/repositories/country/index.js +2 -89
  104. package/dist/src/repositories/country/index.js.map +2 -2
  105. package/dist/src/repositories/currency/index.js +2 -89
  106. package/dist/src/repositories/currency/index.js.map +2 -2
  107. package/dist/src/repositories/gamification/flashcard/index.js +2 -632
  108. package/dist/src/repositories/gamification/flashcard/index.js.map +2 -2
  109. package/dist/src/repositories/gamification/index.js +2 -160
  110. package/dist/src/repositories/gamification/index.js.map +2 -2
  111. package/dist/src/repositories/gamification/mcq/index.js +2 -1017
  112. package/dist/src/repositories/gamification/mcq/index.js.map +2 -2
  113. package/dist/src/repositories/image/index.js +2 -800
  114. package/dist/src/repositories/image/index.js.map +2 -2
  115. package/dist/src/repositories/medecine/index.js +2 -243
  116. package/dist/src/repositories/medecine/index.js.map +2 -2
  117. package/dist/src/repositories/payment/index.js +2 -560
  118. package/dist/src/repositories/payment/index.js.map +2 -2
  119. package/dist/src/repositories/user/index.js +2 -999
  120. package/dist/src/repositories/user/index.js.map +2 -2
  121. package/dist/src/repositories/video/index.js +2 -975
  122. package/dist/src/repositories/video/index.js.map +2 -2
  123. package/package.json +1 -1
  124. package/dist/shared/chunk-0swb1h0m.js +0 -51
  125. package/dist/shared/chunk-2wdazj26.js +0 -371
  126. package/dist/shared/chunk-6m3p1ht9.js +0 -606
  127. package/dist/shared/chunk-bkdccdhn.js +0 -105
  128. package/dist/shared/chunk-chan1evn.js +0 -72
  129. package/dist/shared/chunk-cv6xa6qy.js +0 -621
  130. package/dist/shared/chunk-cwxhwya1.js +0 -548
  131. package/dist/shared/chunk-efmap3y3.js +0 -345
  132. package/dist/shared/chunk-hkfj9j6w.js +0 -30
  133. package/dist/shared/chunk-m4mpkr4n.js +0 -34
  134. package/dist/shared/chunk-m9wkjs7v.js +0 -639
  135. package/dist/shared/chunk-mssxq87m.js +0 -195
  136. package/dist/shared/chunk-p12g6e7b.js +0 -38
  137. package/dist/shared/chunk-qbn9p4vj.js +0 -835
  138. package/dist/shared/chunk-r9hsk9fk.js +0 -20
  139. package/dist/shared/chunk-sk8z5zmk.js +0 -112
  140. package/dist/shared/chunk-tqd6ek7s.js +0 -86
  141. package/dist/shared/chunk-wg7xcq50.js +0 -38
@@ -1,1019 +1,4 @@
1
1
  // @bun
2
- import {
3
- McqQuestionChoiceEntity,
4
- McqQuestionCommentEntity,
5
- McqQuestionDislikedEntity,
6
- McqQuestionEntity,
7
- McqQuestionLikedEntity,
8
- McqQuestionReportEntity,
9
- McqQuestionSavedEntity,
10
- McqQuestionSharedEntity,
11
- McqQuestionStatEntity,
12
- McqQuestionViewedEntity,
13
- McqSessionEntity,
14
- McqSessionQuestionEntity
15
- } from "../../../../shared/chunk-6m3p1ht9.js";
16
- import"../../../../shared/chunk-mssxq87m.js";
17
- import"../../../../shared/chunk-bkdccdhn.js";
18
- import"../../../../shared/chunk-p12g6e7b.js";
19
- import"../../../../shared/chunk-sk8z5zmk.js";
20
- import"../../../../shared/chunk-m4mpkr4n.js";
21
- import"../../../../shared/chunk-chan1evn.js";
22
- import {
23
- __legacyDecorateClassTS,
24
- __legacyDecorateParamTS,
25
- __legacyMetadataTS
26
- } from "../../../../shared/chunk-r9hsk9fk.js";
2
+ import{n as Q,o as P,p as h,q as w,r as E,s as S,t as M,u as g,v as d,w as k,x as y,y as u}from"../../../../shared/chunk-yrwsqc6r.js";import"../../../../shared/chunk-6kdkyjbn.js";import"../../../../shared/chunk-p22keb3y.js";import"../../../../shared/chunk-6jnj2pfx.js";import"../../../../shared/chunk-x2d798hg.js";import"../../../../shared/chunk-5ybg5hda.js";import"../../../../shared/chunk-xrqhqgen.js";import{Ha as N,Ia as T,Ja as U}from"../../../../shared/chunk-59vwmfpm.js";import{inject as l}from"@ooneex/container";import{decorator as c}from"@ooneex/repository";class ${database;constructor(x){this.database=x}async open(){return await this.database.open(P)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,...G}=x,F,H=B===0?100:B;if(A&&A>0&&B&&B>0)F=(A-1)*H;let K=await z.find({...G,take:H,...F!==void 0&&{skip:F}}),J=await this.count(G.where),X=Math.ceil(J/B);return{resources:K,total:J,totalPages:X,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}$=N([c.repository(),T(0,l("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],$);import{inject as p}from"@ooneex/container";import{decorator as a}from"@ooneex/repository";class v{database;constructor(x){this.database=x}async open(){return await this.database.open(h)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,...G}=x,F,H=B===0?100:B;if(A&&A>0&&B&&B>0)F=(A-1)*H;let K=await z.find({...G,take:H,...F!==void 0&&{skip:F}}),J=await this.count(G.where),X=Math.ceil(J/B);return{resources:K,total:J,totalPages:X,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}v=N([a.repository(),T(0,p("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],v);import{inject as n}from"@ooneex/container";import{decorator as r}from"@ooneex/repository";class D{database;constructor(x){this.database=x}async open(){return await this.database.open(w)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,...G}=x,F,H=B===0?100:B;if(A&&A>0&&B&&B>0)F=(A-1)*H;let K=await z.find({...G,take:H,...F!==void 0&&{skip:F}}),J=await this.count(G.where),X=Math.ceil(J/B);return{resources:K,total:J,totalPages:X,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}D=N([r.repository(),T(0,n("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],D);import{inject as s}from"@ooneex/container";import{decorator as o}from"@ooneex/repository";class V{database;constructor(x){this.database=x}async open(){return await this.database.open(E)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,...G}=x,F,H=B===0?100:B;if(A&&A>0&&B&&B>0)F=(A-1)*H;let K=await z.find({...G,take:H,...F!==void 0&&{skip:F}}),J=await this.count(G.where),X=Math.ceil(J/B);return{resources:K,total:J,totalPages:X,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}V=N([o.repository(),T(0,s("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],V);import{inject as e}from"@ooneex/container";import{decorator as t}from"@ooneex/repository";class W{database;constructor(x){this.database=x}async open(){return await this.database.open(S)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,...G}=x,F,H=B===0?100:B;if(A&&A>0&&B&&B>0)F=(A-1)*H;let K=await z.find({...G,take:H,...F!==void 0&&{skip:F}}),J=await this.count(G.where),X=Math.ceil(J/B);return{resources:K,total:J,totalPages:X,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}W=N([t.repository(),T(0,e("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],W);import{inject as i}from"@ooneex/container";import{decorator as xx}from"@ooneex/repository";import{ILike as R}from"typeorm";class f{database;constructor(x){this.database=x}async open(){return await this.database.open(Q)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,q:G,...F}=x,H,K=B===0?100:B;if(A&&A>0&&B&&B>0)H=(A-1)*K;let J={...F,take:K,...H!==void 0&&{skip:H}};if(G)J={...J,where:{...F.where,text:R(`%${G}%`)}};let X=await z.find(J),Y=F.where;if(G)Y={...F.where,text:R(`%${G}%`)};let Z=await this.count(Y),_=Math.ceil(Z/B);return{resources:X,total:Z,totalPages:_,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}f=N([xx.repository(),T(0,i("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],f);import{inject as zx}from"@ooneex/container";import{decorator as Ax}from"@ooneex/repository";class O{database;constructor(x){this.database=x}async open(){return await this.database.open(M)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,...G}=x,F,H=B===0?100:B;if(A&&A>0&&B&&B>0)F=(A-1)*H;let K=await z.find({...G,take:H,...F!==void 0&&{skip:F}}),J=await this.count(G.where),X=Math.ceil(J/B);return{resources:K,total:J,totalPages:X,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}O=N([Ax.repository(),T(0,zx("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],O);import{inject as Bx}from"@ooneex/container";import{decorator as Fx}from"@ooneex/repository";class C{database;constructor(x){this.database=x}async open(){return await this.database.open(g)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,...G}=x,F,H=B===0?100:B;if(A&&A>0&&B&&B>0)F=(A-1)*H;let K=await z.find({...G,take:H,...F!==void 0&&{skip:F}}),J=await this.count(G.where),X=Math.ceil(J/B);return{resources:K,total:J,totalPages:X,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}C=N([Fx.repository(),T(0,Bx("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],C);import{inject as Gx}from"@ooneex/container";import{decorator as Hx}from"@ooneex/repository";class I{database;constructor(x){this.database=x}async open(){return await this.database.open(d)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,...G}=x,F,H=B===0?100:B;if(A&&A>0&&B&&B>0)F=(A-1)*H;let K=await z.find({...G,take:H,...F!==void 0&&{skip:F}}),J=await this.count(G.where),X=Math.ceil(J/B);return{resources:K,total:J,totalPages:X,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}I=N([Hx.repository(),T(0,Gx("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],I);import{inject as Jx}from"@ooneex/container";import{decorator as Kx}from"@ooneex/repository";class L{database;constructor(x){this.database=x}async open(){return await this.database.open(k)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,...G}=x,F,H=B===0?100:B;if(A&&A>0&&B&&B>0)F=(A-1)*H;let K=await z.find({...G,take:H,...F!==void 0&&{skip:F}}),J=await this.count(G.where),X=Math.ceil(J/B);return{resources:K,total:J,totalPages:X,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}L=N([Kx.repository(),T(0,Jx("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],L);import{inject as Nx}from"@ooneex/container";import{decorator as Tx}from"@ooneex/repository";import{ILike as q}from"typeorm";class b{database;constructor(x){this.database=x}async open(){return await this.database.open(u)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,q:G,...F}=x,H,K=B===0?100:B;if(A&&A>0&&B&&B>0)H=(A-1)*K;let J={...F,take:K,...H!==void 0&&{skip:H}};if(G)J={...J,where:{...F.where,question:{text:q(`%${G}%`)}}};let X=await z.find(J),Y=F.where;if(G)Y={...F.where,question:{text:q(`%${G}%`)}};let Z=await this.count(Y),_=Math.ceil(Z/B);return{resources:X,total:Z,totalPages:_,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}b=N([Tx.repository(),T(0,Nx("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],b);import{inject as Ux}from"@ooneex/container";import{decorator as Xx}from"@ooneex/repository";import{ILike as m}from"typeorm";class j{database;constructor(x){this.database=x}async open(){return await this.database.open(y)}async close(){await this.database.close()}async find(x){let z=await this.open(),{page:A=1,limit:B=100,q:G,...F}=x,H,K=B===0?100:B;if(A&&A>0&&B&&B>0)H=(A-1)*K;let J={...F,take:K,...H!==void 0&&{skip:H}};if(G)J={...J,where:{...F.where,name:m(`%${G}%`)}};let X=await z.find(J),Y=F.where;if(G)Y={...F.where,name:m(`%${G}%`)};let Z=await this.count(Y),_=Math.ceil(Z/B);return{resources:X,total:Z,totalPages:_,page:A,limit:B}}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,z){return await(await this.open()).save(x,z)}async createMany(x,z){return await(await this.open()).save(x,z)}async update(x,z){return await this.create(x,z)}async updateMany(x,z){return await this.createMany(x,z)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}j=N([Xx.repository(),T(0,Ux("database")),U("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],j);export{j as McqSessionRepository,b as McqSessionQuestionRepository,L as McqQuestionViewedRepository,I as McqQuestionStatRepository,C as McqQuestionSharedRepository,O as McqQuestionSavedRepository,f as McqQuestionRepository,W as McqQuestionReportRepository,V as McqQuestionLikedRepository,D as McqQuestionDislikedRepository,v as McqQuestionCommentRepository,$ as McqQuestionChoiceRepository};export{$ as Ra,v as Sa,D as Ta,V as Ua,W as Va,f as Wa,O as Xa,C as Ya,I as Za,L as _a,b as $a,j as ab};
27
3
 
28
- // src/repositories/gamification/mcq/McqQuestionChoiceRepository.ts
29
- import { inject } from "@ooneex/container";
30
- import { decorator } from "@ooneex/repository";
31
- class McqQuestionChoiceRepository {
32
- database;
33
- constructor(database) {
34
- this.database = database;
35
- }
36
- async open() {
37
- return await this.database.open(McqQuestionChoiceEntity);
38
- }
39
- async close() {
40
- await this.database.close();
41
- }
42
- async find(criteria) {
43
- const repository = await this.open();
44
- const { page = 1, limit = 100, ...rest } = criteria;
45
- let skip;
46
- const take = limit === 0 ? 100 : limit;
47
- if (page && page > 0 && limit && limit > 0) {
48
- skip = (page - 1) * take;
49
- }
50
- const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
51
- const total = await this.count(rest.where);
52
- const totalPages = Math.ceil(total / limit);
53
- return {
54
- resources: result,
55
- total,
56
- totalPages,
57
- page,
58
- limit
59
- };
60
- }
61
- async findOne(id) {
62
- const repository = await this.open();
63
- return await repository.findOne({
64
- where: { id }
65
- });
66
- }
67
- async findOneBy(criteria) {
68
- const repository = await this.open();
69
- return await repository.findOne({
70
- where: criteria
71
- });
72
- }
73
- async findByQuestion(questionId) {
74
- const repository = await this.open();
75
- return await repository.find({
76
- where: { question: { id: questionId } },
77
- order: { letter: "ASC" }
78
- });
79
- }
80
- async findCorrectChoicesByQuestion(questionId) {
81
- const repository = await this.open();
82
- return await repository.find({
83
- where: {
84
- question: { id: questionId },
85
- isCorrect: true
86
- },
87
- order: { letter: "ASC" }
88
- });
89
- }
90
- async create(entity, options) {
91
- const repository = await this.open();
92
- return await repository.save(entity, options);
93
- }
94
- async createMany(entities, options) {
95
- const repository = await this.open();
96
- return await repository.save(entities, options);
97
- }
98
- async update(entity, options) {
99
- return await this.create(entity, options);
100
- }
101
- async updateMany(entities, options) {
102
- return await this.createMany(entities, options);
103
- }
104
- async delete(criteria) {
105
- const repository = await this.open();
106
- return await repository.softDelete(criteria);
107
- }
108
- async count(criteria) {
109
- const repository = await this.open();
110
- return await repository.count(criteria ? { where: criteria } : {});
111
- }
112
- }
113
- McqQuestionChoiceRepository = __legacyDecorateClassTS([
114
- decorator.repository(),
115
- __legacyDecorateParamTS(0, inject("database")),
116
- __legacyMetadataTS("design:paramtypes", [
117
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
118
- ])
119
- ], McqQuestionChoiceRepository);
120
- // src/repositories/gamification/mcq/McqQuestionCommentRepository.ts
121
- import { inject as inject2 } from "@ooneex/container";
122
- import { decorator as decorator2 } from "@ooneex/repository";
123
- class McqQuestionCommentRepository {
124
- database;
125
- constructor(database) {
126
- this.database = database;
127
- }
128
- async open() {
129
- return await this.database.open(McqQuestionCommentEntity);
130
- }
131
- async close() {
132
- await this.database.close();
133
- }
134
- async find(criteria) {
135
- const repository = await this.open();
136
- const { page = 1, limit = 100, ...rest } = criteria;
137
- let skip;
138
- const take = limit === 0 ? 100 : limit;
139
- if (page && page > 0 && limit && limit > 0) {
140
- skip = (page - 1) * take;
141
- }
142
- const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
143
- const total = await this.count(rest.where);
144
- const totalPages = Math.ceil(total / limit);
145
- return {
146
- resources: result,
147
- total,
148
- totalPages,
149
- page,
150
- limit
151
- };
152
- }
153
- async findOne(id) {
154
- const repository = await this.open();
155
- return await repository.findOne({
156
- where: { id }
157
- });
158
- }
159
- async findOneBy(criteria) {
160
- const repository = await this.open();
161
- return await repository.findOne({
162
- where: criteria
163
- });
164
- }
165
- async create(entity, options) {
166
- const repository = await this.open();
167
- return await repository.save(entity, options);
168
- }
169
- async createMany(entities, options) {
170
- const repository = await this.open();
171
- return await repository.save(entities, options);
172
- }
173
- async update(entity, options) {
174
- return await this.create(entity, options);
175
- }
176
- async updateMany(entities, options) {
177
- return await this.createMany(entities, options);
178
- }
179
- async delete(criteria) {
180
- const repository = await this.open();
181
- return await repository.softDelete(criteria);
182
- }
183
- async count(criteria) {
184
- const repository = await this.open();
185
- return await repository.count(criteria ? { where: criteria } : {});
186
- }
187
- }
188
- McqQuestionCommentRepository = __legacyDecorateClassTS([
189
- decorator2.repository(),
190
- __legacyDecorateParamTS(0, inject2("database")),
191
- __legacyMetadataTS("design:paramtypes", [
192
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
193
- ])
194
- ], McqQuestionCommentRepository);
195
- // src/repositories/gamification/mcq/McqQuestionDislikedRepository.ts
196
- import { inject as inject3 } from "@ooneex/container";
197
- import { decorator as decorator3 } from "@ooneex/repository";
198
- class McqQuestionDislikedRepository {
199
- database;
200
- constructor(database) {
201
- this.database = database;
202
- }
203
- async open() {
204
- return await this.database.open(McqQuestionDislikedEntity);
205
- }
206
- async close() {
207
- await this.database.close();
208
- }
209
- async find(criteria) {
210
- const repository = await this.open();
211
- const { page = 1, limit = 100, ...rest } = criteria;
212
- let skip;
213
- const take = limit === 0 ? 100 : limit;
214
- if (page && page > 0 && limit && limit > 0) {
215
- skip = (page - 1) * take;
216
- }
217
- const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
218
- const total = await this.count(rest.where);
219
- const totalPages = Math.ceil(total / limit);
220
- return {
221
- resources: result,
222
- total,
223
- totalPages,
224
- page,
225
- limit
226
- };
227
- }
228
- async findOne(id) {
229
- const repository = await this.open();
230
- return await repository.findOne({
231
- where: { id }
232
- });
233
- }
234
- async findOneBy(criteria) {
235
- const repository = await this.open();
236
- return await repository.findOne({
237
- where: criteria
238
- });
239
- }
240
- async create(entity, options) {
241
- const repository = await this.open();
242
- return await repository.save(entity, options);
243
- }
244
- async createMany(entities, options) {
245
- const repository = await this.open();
246
- return await repository.save(entities, options);
247
- }
248
- async update(entity, options) {
249
- return await this.create(entity, options);
250
- }
251
- async updateMany(entities, options) {
252
- return await this.createMany(entities, options);
253
- }
254
- async delete(criteria) {
255
- const repository = await this.open();
256
- return await repository.softDelete(criteria);
257
- }
258
- async count(criteria) {
259
- const repository = await this.open();
260
- return await repository.count(criteria ? { where: criteria } : {});
261
- }
262
- }
263
- McqQuestionDislikedRepository = __legacyDecorateClassTS([
264
- decorator3.repository(),
265
- __legacyDecorateParamTS(0, inject3("database")),
266
- __legacyMetadataTS("design:paramtypes", [
267
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
268
- ])
269
- ], McqQuestionDislikedRepository);
270
- // src/repositories/gamification/mcq/McqQuestionLikedRepository.ts
271
- import { inject as inject4 } from "@ooneex/container";
272
- import { decorator as decorator4 } from "@ooneex/repository";
273
- class McqQuestionLikedRepository {
274
- database;
275
- constructor(database) {
276
- this.database = database;
277
- }
278
- async open() {
279
- return await this.database.open(McqQuestionLikedEntity);
280
- }
281
- async close() {
282
- await this.database.close();
283
- }
284
- async find(criteria) {
285
- const repository = await this.open();
286
- const { page = 1, limit = 100, ...rest } = criteria;
287
- let skip;
288
- const take = limit === 0 ? 100 : limit;
289
- if (page && page > 0 && limit && limit > 0) {
290
- skip = (page - 1) * take;
291
- }
292
- const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
293
- const total = await this.count(rest.where);
294
- const totalPages = Math.ceil(total / limit);
295
- return {
296
- resources: result,
297
- total,
298
- totalPages,
299
- page,
300
- limit
301
- };
302
- }
303
- async findOne(id) {
304
- const repository = await this.open();
305
- return await repository.findOne({
306
- where: { id }
307
- });
308
- }
309
- async findOneBy(criteria) {
310
- const repository = await this.open();
311
- return await repository.findOne({
312
- where: criteria
313
- });
314
- }
315
- async create(entity, options) {
316
- const repository = await this.open();
317
- return await repository.save(entity, options);
318
- }
319
- async createMany(entities, options) {
320
- const repository = await this.open();
321
- return await repository.save(entities, options);
322
- }
323
- async update(entity, options) {
324
- return await this.create(entity, options);
325
- }
326
- async updateMany(entities, options) {
327
- return await this.createMany(entities, options);
328
- }
329
- async delete(criteria) {
330
- const repository = await this.open();
331
- return await repository.softDelete(criteria);
332
- }
333
- async count(criteria) {
334
- const repository = await this.open();
335
- return await repository.count(criteria ? { where: criteria } : {});
336
- }
337
- }
338
- McqQuestionLikedRepository = __legacyDecorateClassTS([
339
- decorator4.repository(),
340
- __legacyDecorateParamTS(0, inject4("database")),
341
- __legacyMetadataTS("design:paramtypes", [
342
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
343
- ])
344
- ], McqQuestionLikedRepository);
345
- // src/repositories/gamification/mcq/McqQuestionReportRepository.ts
346
- import { inject as inject5 } from "@ooneex/container";
347
- import { decorator as decorator5 } from "@ooneex/repository";
348
- class McqQuestionReportRepository {
349
- database;
350
- constructor(database) {
351
- this.database = database;
352
- }
353
- async open() {
354
- return await this.database.open(McqQuestionReportEntity);
355
- }
356
- async close() {
357
- await this.database.close();
358
- }
359
- async find(criteria) {
360
- const repository = await this.open();
361
- const { page = 1, limit = 100, ...rest } = criteria;
362
- let skip;
363
- const take = limit === 0 ? 100 : limit;
364
- if (page && page > 0 && limit && limit > 0) {
365
- skip = (page - 1) * take;
366
- }
367
- const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
368
- const total = await this.count(rest.where);
369
- const totalPages = Math.ceil(total / limit);
370
- return {
371
- resources: result,
372
- total,
373
- totalPages,
374
- page,
375
- limit
376
- };
377
- }
378
- async findOne(id) {
379
- const repository = await this.open();
380
- return await repository.findOne({
381
- where: { id }
382
- });
383
- }
384
- async findOneBy(criteria) {
385
- const repository = await this.open();
386
- return await repository.findOne({
387
- where: criteria
388
- });
389
- }
390
- async create(entity, options) {
391
- const repository = await this.open();
392
- return await repository.save(entity, options);
393
- }
394
- async createMany(entities, options) {
395
- const repository = await this.open();
396
- return await repository.save(entities, options);
397
- }
398
- async update(entity, options) {
399
- return await this.create(entity, options);
400
- }
401
- async updateMany(entities, options) {
402
- return await this.createMany(entities, options);
403
- }
404
- async delete(criteria) {
405
- const repository = await this.open();
406
- return await repository.softDelete(criteria);
407
- }
408
- async count(criteria) {
409
- const repository = await this.open();
410
- return await repository.count(criteria ? { where: criteria } : {});
411
- }
412
- }
413
- McqQuestionReportRepository = __legacyDecorateClassTS([
414
- decorator5.repository(),
415
- __legacyDecorateParamTS(0, inject5("database")),
416
- __legacyMetadataTS("design:paramtypes", [
417
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
418
- ])
419
- ], McqQuestionReportRepository);
420
- // src/repositories/gamification/mcq/McqQuestionRepository.ts
421
- import { inject as inject6 } from "@ooneex/container";
422
- import { decorator as decorator6 } from "@ooneex/repository";
423
- import { ILike } from "typeorm";
424
- class McqQuestionRepository {
425
- database;
426
- constructor(database) {
427
- this.database = database;
428
- }
429
- async open() {
430
- return await this.database.open(McqQuestionEntity);
431
- }
432
- async close() {
433
- await this.database.close();
434
- }
435
- async find(criteria) {
436
- const repository = await this.open();
437
- const { page = 1, limit = 100, q, ...rest } = criteria;
438
- let skip;
439
- const take = limit === 0 ? 100 : limit;
440
- if (page && page > 0 && limit && limit > 0) {
441
- skip = (page - 1) * take;
442
- }
443
- let findOptions = { ...rest, take, ...skip !== undefined && { skip } };
444
- if (q) {
445
- findOptions = {
446
- ...findOptions,
447
- where: {
448
- ...rest.where,
449
- text: ILike(`%${q}%`)
450
- }
451
- };
452
- }
453
- const result = await repository.find(findOptions);
454
- let countWhere = rest.where;
455
- if (q) {
456
- countWhere = {
457
- ...rest.where,
458
- text: ILike(`%${q}%`)
459
- };
460
- }
461
- const total = await this.count(countWhere);
462
- const totalPages = Math.ceil(total / limit);
463
- return {
464
- resources: result,
465
- total,
466
- totalPages,
467
- page,
468
- limit
469
- };
470
- }
471
- async findOne(id) {
472
- const repository = await this.open();
473
- return await repository.findOne({
474
- where: { id }
475
- });
476
- }
477
- async findOneBy(criteria) {
478
- const repository = await this.open();
479
- return await repository.findOne({
480
- where: criteria
481
- });
482
- }
483
- async create(entity, options) {
484
- const repository = await this.open();
485
- return await repository.save(entity, options);
486
- }
487
- async createMany(entities, options) {
488
- const repository = await this.open();
489
- return await repository.save(entities, options);
490
- }
491
- async update(entity, options) {
492
- return await this.create(entity, options);
493
- }
494
- async updateMany(entities, options) {
495
- return await this.createMany(entities, options);
496
- }
497
- async delete(criteria) {
498
- const repository = await this.open();
499
- return await repository.softDelete(criteria);
500
- }
501
- async count(criteria) {
502
- const repository = await this.open();
503
- return await repository.count(criteria ? { where: criteria } : {});
504
- }
505
- }
506
- McqQuestionRepository = __legacyDecorateClassTS([
507
- decorator6.repository(),
508
- __legacyDecorateParamTS(0, inject6("database")),
509
- __legacyMetadataTS("design:paramtypes", [
510
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
511
- ])
512
- ], McqQuestionRepository);
513
- // src/repositories/gamification/mcq/McqQuestionSavedRepository.ts
514
- import { inject as inject7 } from "@ooneex/container";
515
- import { decorator as decorator7 } from "@ooneex/repository";
516
- class McqQuestionSavedRepository {
517
- database;
518
- constructor(database) {
519
- this.database = database;
520
- }
521
- async open() {
522
- return await this.database.open(McqQuestionSavedEntity);
523
- }
524
- async close() {
525
- await this.database.close();
526
- }
527
- async find(criteria) {
528
- const repository = await this.open();
529
- const { page = 1, limit = 100, ...rest } = criteria;
530
- let skip;
531
- const take = limit === 0 ? 100 : limit;
532
- if (page && page > 0 && limit && limit > 0) {
533
- skip = (page - 1) * take;
534
- }
535
- const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
536
- const total = await this.count(rest.where);
537
- const totalPages = Math.ceil(total / limit);
538
- return {
539
- resources: result,
540
- total,
541
- totalPages,
542
- page,
543
- limit
544
- };
545
- }
546
- async findOne(id) {
547
- const repository = await this.open();
548
- return await repository.findOne({
549
- where: { id }
550
- });
551
- }
552
- async findOneBy(criteria) {
553
- const repository = await this.open();
554
- return await repository.findOne({
555
- where: criteria
556
- });
557
- }
558
- async create(entity, options) {
559
- const repository = await this.open();
560
- return await repository.save(entity, options);
561
- }
562
- async createMany(entities, options) {
563
- const repository = await this.open();
564
- return await repository.save(entities, options);
565
- }
566
- async update(entity, options) {
567
- return await this.create(entity, options);
568
- }
569
- async updateMany(entities, options) {
570
- return await this.createMany(entities, options);
571
- }
572
- async delete(criteria) {
573
- const repository = await this.open();
574
- return await repository.softDelete(criteria);
575
- }
576
- async count(criteria) {
577
- const repository = await this.open();
578
- return await repository.count(criteria ? { where: criteria } : {});
579
- }
580
- }
581
- McqQuestionSavedRepository = __legacyDecorateClassTS([
582
- decorator7.repository(),
583
- __legacyDecorateParamTS(0, inject7("database")),
584
- __legacyMetadataTS("design:paramtypes", [
585
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
586
- ])
587
- ], McqQuestionSavedRepository);
588
- // src/repositories/gamification/mcq/McqQuestionSharedRepository.ts
589
- import { inject as inject8 } from "@ooneex/container";
590
- import { decorator as decorator8 } from "@ooneex/repository";
591
- class McqQuestionSharedRepository {
592
- database;
593
- constructor(database) {
594
- this.database = database;
595
- }
596
- async open() {
597
- return await this.database.open(McqQuestionSharedEntity);
598
- }
599
- async close() {
600
- await this.database.close();
601
- }
602
- async find(criteria) {
603
- const repository = await this.open();
604
- const { page = 1, limit = 100, ...rest } = criteria;
605
- let skip;
606
- const take = limit === 0 ? 100 : limit;
607
- if (page && page > 0 && limit && limit > 0) {
608
- skip = (page - 1) * take;
609
- }
610
- const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
611
- const total = await this.count(rest.where);
612
- const totalPages = Math.ceil(total / limit);
613
- return {
614
- resources: result,
615
- total,
616
- totalPages,
617
- page,
618
- limit
619
- };
620
- }
621
- async findOne(id) {
622
- const repository = await this.open();
623
- return await repository.findOne({
624
- where: { id }
625
- });
626
- }
627
- async findOneBy(criteria) {
628
- const repository = await this.open();
629
- return await repository.findOne({
630
- where: criteria
631
- });
632
- }
633
- async create(entity, options) {
634
- const repository = await this.open();
635
- return await repository.save(entity, options);
636
- }
637
- async createMany(entities, options) {
638
- const repository = await this.open();
639
- return await repository.save(entities, options);
640
- }
641
- async update(entity, options) {
642
- return await this.create(entity, options);
643
- }
644
- async updateMany(entities, options) {
645
- return await this.createMany(entities, options);
646
- }
647
- async delete(criteria) {
648
- const repository = await this.open();
649
- return await repository.softDelete(criteria);
650
- }
651
- async count(criteria) {
652
- const repository = await this.open();
653
- return await repository.count(criteria ? { where: criteria } : {});
654
- }
655
- }
656
- McqQuestionSharedRepository = __legacyDecorateClassTS([
657
- decorator8.repository(),
658
- __legacyDecorateParamTS(0, inject8("database")),
659
- __legacyMetadataTS("design:paramtypes", [
660
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
661
- ])
662
- ], McqQuestionSharedRepository);
663
- // src/repositories/gamification/mcq/McqQuestionStatRepository.ts
664
- import { inject as inject9 } from "@ooneex/container";
665
- import { decorator as decorator9 } from "@ooneex/repository";
666
- class McqQuestionStatRepository {
667
- database;
668
- constructor(database) {
669
- this.database = database;
670
- }
671
- async open() {
672
- return await this.database.open(McqQuestionStatEntity);
673
- }
674
- async close() {
675
- await this.database.close();
676
- }
677
- async find(criteria) {
678
- const repository = await this.open();
679
- const { page = 1, limit = 100, ...rest } = criteria;
680
- let skip;
681
- const take = limit === 0 ? 100 : limit;
682
- if (page && page > 0 && limit && limit > 0) {
683
- skip = (page - 1) * take;
684
- }
685
- const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
686
- const total = await this.count(rest.where);
687
- const totalPages = Math.ceil(total / limit);
688
- return {
689
- resources: result,
690
- total,
691
- totalPages,
692
- page,
693
- limit
694
- };
695
- }
696
- async findOne(id) {
697
- const repository = await this.open();
698
- return await repository.findOne({
699
- where: { id }
700
- });
701
- }
702
- async findOneBy(criteria) {
703
- const repository = await this.open();
704
- return await repository.findOne({
705
- where: criteria
706
- });
707
- }
708
- async create(entity, options) {
709
- const repository = await this.open();
710
- return await repository.save(entity, options);
711
- }
712
- async createMany(entities, options) {
713
- const repository = await this.open();
714
- return await repository.save(entities, options);
715
- }
716
- async update(entity, options) {
717
- return await this.create(entity, options);
718
- }
719
- async updateMany(entities, options) {
720
- return await this.createMany(entities, options);
721
- }
722
- async delete(criteria) {
723
- const repository = await this.open();
724
- return await repository.softDelete(criteria);
725
- }
726
- async count(criteria) {
727
- const repository = await this.open();
728
- return await repository.count(criteria ? { where: criteria } : {});
729
- }
730
- }
731
- McqQuestionStatRepository = __legacyDecorateClassTS([
732
- decorator9.repository(),
733
- __legacyDecorateParamTS(0, inject9("database")),
734
- __legacyMetadataTS("design:paramtypes", [
735
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
736
- ])
737
- ], McqQuestionStatRepository);
738
- // src/repositories/gamification/mcq/McqQuestionViewedRepository.ts
739
- import { inject as inject10 } from "@ooneex/container";
740
- import { decorator as decorator10 } from "@ooneex/repository";
741
- class McqQuestionViewedRepository {
742
- database;
743
- constructor(database) {
744
- this.database = database;
745
- }
746
- async open() {
747
- return await this.database.open(McqQuestionViewedEntity);
748
- }
749
- async close() {
750
- await this.database.close();
751
- }
752
- async find(criteria) {
753
- const repository = await this.open();
754
- const { page = 1, limit = 100, ...rest } = criteria;
755
- let skip;
756
- const take = limit === 0 ? 100 : limit;
757
- if (page && page > 0 && limit && limit > 0) {
758
- skip = (page - 1) * take;
759
- }
760
- const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
761
- const total = await this.count(rest.where);
762
- const totalPages = Math.ceil(total / limit);
763
- return {
764
- resources: result,
765
- total,
766
- totalPages,
767
- page,
768
- limit
769
- };
770
- }
771
- async findOne(id) {
772
- const repository = await this.open();
773
- return await repository.findOne({
774
- where: { id }
775
- });
776
- }
777
- async findOneBy(criteria) {
778
- const repository = await this.open();
779
- return await repository.findOne({
780
- where: criteria
781
- });
782
- }
783
- async create(entity, options) {
784
- const repository = await this.open();
785
- return await repository.save(entity, options);
786
- }
787
- async createMany(entities, options) {
788
- const repository = await this.open();
789
- return await repository.save(entities, options);
790
- }
791
- async update(entity, options) {
792
- return await this.create(entity, options);
793
- }
794
- async updateMany(entities, options) {
795
- return await this.createMany(entities, options);
796
- }
797
- async delete(criteria) {
798
- const repository = await this.open();
799
- return await repository.softDelete(criteria);
800
- }
801
- async count(criteria) {
802
- const repository = await this.open();
803
- return await repository.count(criteria ? { where: criteria } : {});
804
- }
805
- }
806
- McqQuestionViewedRepository = __legacyDecorateClassTS([
807
- decorator10.repository(),
808
- __legacyDecorateParamTS(0, inject10("database")),
809
- __legacyMetadataTS("design:paramtypes", [
810
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
811
- ])
812
- ], McqQuestionViewedRepository);
813
- // src/repositories/gamification/mcq/McqSessionQuestionRepository.ts
814
- import { inject as inject11 } from "@ooneex/container";
815
- import { decorator as decorator11 } from "@ooneex/repository";
816
- import { ILike as ILike2 } from "typeorm";
817
- class McqSessionQuestionRepository {
818
- database;
819
- constructor(database) {
820
- this.database = database;
821
- }
822
- async open() {
823
- return await this.database.open(McqSessionQuestionEntity);
824
- }
825
- async close() {
826
- await this.database.close();
827
- }
828
- async find(criteria) {
829
- const repository = await this.open();
830
- const { page = 1, limit = 100, q, ...rest } = criteria;
831
- let skip;
832
- const take = limit === 0 ? 100 : limit;
833
- if (page && page > 0 && limit && limit > 0) {
834
- skip = (page - 1) * take;
835
- }
836
- let findOptions = { ...rest, take, ...skip !== undefined && { skip } };
837
- if (q) {
838
- findOptions = {
839
- ...findOptions,
840
- where: {
841
- ...rest.where,
842
- question: {
843
- text: ILike2(`%${q}%`)
844
- }
845
- }
846
- };
847
- }
848
- const result = await repository.find(findOptions);
849
- let countWhere = rest.where;
850
- if (q) {
851
- countWhere = {
852
- ...rest.where,
853
- question: {
854
- text: ILike2(`%${q}%`)
855
- }
856
- };
857
- }
858
- const total = await this.count(countWhere);
859
- const totalPages = Math.ceil(total / limit);
860
- return {
861
- resources: result,
862
- total,
863
- totalPages,
864
- page,
865
- limit
866
- };
867
- }
868
- async findOne(id) {
869
- const repository = await this.open();
870
- return await repository.findOne({
871
- where: { id }
872
- });
873
- }
874
- async findOneBy(criteria) {
875
- const repository = await this.open();
876
- return await repository.findOne({
877
- where: criteria
878
- });
879
- }
880
- async create(entity, options) {
881
- const repository = await this.open();
882
- return await repository.save(entity, options);
883
- }
884
- async createMany(entities, options) {
885
- const repository = await this.open();
886
- return await repository.save(entities, options);
887
- }
888
- async update(entity, options) {
889
- return await this.create(entity, options);
890
- }
891
- async updateMany(entities, options) {
892
- return await this.createMany(entities, options);
893
- }
894
- async delete(criteria) {
895
- const repository = await this.open();
896
- return await repository.softDelete(criteria);
897
- }
898
- async count(criteria) {
899
- const repository = await this.open();
900
- return await repository.count(criteria ? { where: criteria } : {});
901
- }
902
- }
903
- McqSessionQuestionRepository = __legacyDecorateClassTS([
904
- decorator11.repository(),
905
- __legacyDecorateParamTS(0, inject11("database")),
906
- __legacyMetadataTS("design:paramtypes", [
907
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
908
- ])
909
- ], McqSessionQuestionRepository);
910
- // src/repositories/gamification/mcq/McqSessionRepository.ts
911
- import { inject as inject12 } from "@ooneex/container";
912
- import { decorator as decorator12 } from "@ooneex/repository";
913
- import { ILike as ILike3 } from "typeorm";
914
- class McqSessionRepository {
915
- database;
916
- constructor(database) {
917
- this.database = database;
918
- }
919
- async open() {
920
- return await this.database.open(McqSessionEntity);
921
- }
922
- async close() {
923
- await this.database.close();
924
- }
925
- async find(criteria) {
926
- const repository = await this.open();
927
- const { page = 1, limit = 100, q, ...rest } = criteria;
928
- let skip;
929
- const take = limit === 0 ? 100 : limit;
930
- if (page && page > 0 && limit && limit > 0) {
931
- skip = (page - 1) * take;
932
- }
933
- let findOptions = { ...rest, take, ...skip !== undefined && { skip } };
934
- if (q) {
935
- findOptions = {
936
- ...findOptions,
937
- where: {
938
- ...rest.where,
939
- name: ILike3(`%${q}%`)
940
- }
941
- };
942
- }
943
- const result = await repository.find(findOptions);
944
- let countWhere = rest.where;
945
- if (q) {
946
- countWhere = {
947
- ...rest.where,
948
- name: ILike3(`%${q}%`)
949
- };
950
- }
951
- const total = await this.count(countWhere);
952
- const totalPages = Math.ceil(total / limit);
953
- return {
954
- resources: result,
955
- total,
956
- totalPages,
957
- page,
958
- limit
959
- };
960
- }
961
- async findOne(id) {
962
- const repository = await this.open();
963
- return await repository.findOne({
964
- where: { id }
965
- });
966
- }
967
- async findOneBy(criteria) {
968
- const repository = await this.open();
969
- return await repository.findOne({
970
- where: criteria
971
- });
972
- }
973
- async create(entity, options) {
974
- const repository = await this.open();
975
- return await repository.save(entity, options);
976
- }
977
- async createMany(entities, options) {
978
- const repository = await this.open();
979
- return await repository.save(entities, options);
980
- }
981
- async update(entity, options) {
982
- return await this.create(entity, options);
983
- }
984
- async updateMany(entities, options) {
985
- return await this.createMany(entities, options);
986
- }
987
- async delete(criteria) {
988
- const repository = await this.open();
989
- return await repository.softDelete(criteria);
990
- }
991
- async count(criteria) {
992
- const repository = await this.open();
993
- return await repository.count(criteria ? { where: criteria } : {});
994
- }
995
- }
996
- McqSessionRepository = __legacyDecorateClassTS([
997
- decorator12.repository(),
998
- __legacyDecorateParamTS(0, inject12("database")),
999
- __legacyMetadataTS("design:paramtypes", [
1000
- typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
1001
- ])
1002
- ], McqSessionRepository);
1003
- export {
1004
- McqSessionRepository,
1005
- McqSessionQuestionRepository,
1006
- McqQuestionViewedRepository,
1007
- McqQuestionStatRepository,
1008
- McqQuestionSharedRepository,
1009
- McqQuestionSavedRepository,
1010
- McqQuestionRepository,
1011
- McqQuestionReportRepository,
1012
- McqQuestionLikedRepository,
1013
- McqQuestionDislikedRepository,
1014
- McqQuestionCommentRepository,
1015
- McqQuestionChoiceRepository
1016
- };
1017
- export { McqQuestionChoiceRepository, McqQuestionCommentRepository, McqQuestionDislikedRepository, McqQuestionLikedRepository, McqQuestionReportRepository, McqQuestionRepository, McqQuestionSavedRepository, McqQuestionSharedRepository, McqQuestionStatRepository, McqQuestionViewedRepository, McqSessionQuestionRepository, McqSessionRepository };
1018
-
1019
- //# debugId=022418FFE1294A7264756E2164756E21
4
+ //# debugId=50535ABDDB62B3FB64756E2164756E21