@ooneex/typeorm 0.11.0 → 0.12.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-0swb1h0m.js +51 -0
  2. package/dist/shared/{chunk-xwe8m6av.js.map → chunk-0swb1h0m.js.map} +2 -2
  3. package/dist/shared/chunk-2wdazj26.js +371 -0
  4. package/dist/shared/{chunk-5tnqjb3n.js.map → chunk-2wdazj26.js.map} +2 -2
  5. package/dist/shared/chunk-6m3p1ht9.js +606 -0
  6. package/dist/shared/{chunk-yrwsqc6r.js.map → chunk-6m3p1ht9.js.map} +2 -2
  7. package/dist/shared/{chunk-qrs0g3m9.js → chunk-6vmvyg0q.js} +58 -17
  8. package/dist/shared/{chunk-qrs0g3m9.js.map → chunk-6vmvyg0q.js.map} +2 -2
  9. package/dist/shared/chunk-bkdccdhn.js +105 -0
  10. package/dist/shared/{chunk-p22keb3y.js.map → chunk-bkdccdhn.js.map} +2 -2
  11. package/dist/shared/chunk-chan1evn.js +72 -0
  12. package/dist/shared/{chunk-xrqhqgen.js.map → chunk-chan1evn.js.map} +2 -2
  13. package/dist/shared/chunk-cv6xa6qy.js +621 -0
  14. package/dist/shared/{chunk-t1jad451.js.map → chunk-cv6xa6qy.js.map} +2 -2
  15. package/dist/shared/chunk-cwxhwya1.js +548 -0
  16. package/dist/shared/{chunk-x3pmm3na.js.map → chunk-cwxhwya1.js.map} +2 -2
  17. package/dist/shared/{chunk-qyf32qsz.js → chunk-eets3mef.js} +75 -22
  18. package/dist/shared/{chunk-qyf32qsz.js.map → chunk-eets3mef.js.map} +2 -2
  19. package/dist/shared/chunk-efmap3y3.js +345 -0
  20. package/dist/shared/{chunk-e51ktjsq.js.map → chunk-efmap3y3.js.map} +2 -2
  21. package/dist/shared/chunk-hkfj9j6w.js +30 -0
  22. package/dist/shared/{chunk-pbns711f.js.map → chunk-hkfj9j6w.js.map} +2 -2
  23. package/dist/shared/{chunk-aj0aak90.js → chunk-jap9t59k.js} +52 -14
  24. package/dist/shared/{chunk-aj0aak90.js.map → chunk-jap9t59k.js.map} +2 -2
  25. package/dist/shared/chunk-m4mpkr4n.js +34 -0
  26. package/dist/shared/{chunk-5ybg5hda.js.map → chunk-m4mpkr4n.js.map} +2 -2
  27. package/dist/shared/chunk-m9wkjs7v.js +639 -0
  28. package/dist/shared/{chunk-kw4t1san.js.map → chunk-m9wkjs7v.js.map} +2 -2
  29. package/dist/shared/chunk-mssxq87m.js +195 -0
  30. package/dist/shared/{chunk-6kdkyjbn.js.map → chunk-mssxq87m.js.map} +2 -2
  31. package/dist/shared/chunk-p12g6e7b.js +38 -0
  32. package/dist/shared/{chunk-6jnj2pfx.js.map → chunk-p12g6e7b.js.map} +2 -2
  33. package/dist/shared/chunk-qbn9p4vj.js +835 -0
  34. package/dist/shared/{chunk-nfv9ce7v.js.map → chunk-qbn9p4vj.js.map} +2 -2
  35. package/dist/shared/chunk-r9hsk9fk.js +20 -0
  36. package/dist/shared/{chunk-59vwmfpm.js.map → chunk-r9hsk9fk.js.map} +1 -1
  37. package/dist/shared/chunk-sk8z5zmk.js +112 -0
  38. package/dist/shared/{chunk-x2d798hg.js.map → chunk-sk8z5zmk.js.map} +2 -2
  39. package/dist/shared/chunk-tqd6ek7s.js +86 -0
  40. package/dist/shared/{chunk-19qhst35.js.map → chunk-tqd6ek7s.js.map} +2 -2
  41. package/dist/shared/{chunk-31y260d6.js → chunk-trhrh4e1.js} +89 -24
  42. package/dist/shared/{chunk-31y260d6.js.map → chunk-trhrh4e1.js.map} +2 -2
  43. package/dist/shared/chunk-wg7xcq50.js +38 -0
  44. package/dist/shared/{chunk-t5cy307m.js.map → chunk-wg7xcq50.js.map} +2 -2
  45. package/dist/shared/{chunk-jr0xys18.js → chunk-yszvxhf3.js} +41 -11
  46. package/dist/shared/{chunk-jr0xys18.js.map → chunk-yszvxhf3.js.map} +2 -2
  47. package/dist/src/entities/book/index.js +34 -2
  48. package/dist/src/entities/book/index.js.map +1 -1
  49. package/dist/src/entities/common/index.js +26 -2
  50. package/dist/src/entities/common/index.js.map +1 -1
  51. package/dist/src/entities/country/index.js +9 -2
  52. package/dist/src/entities/country/index.js.map +1 -1
  53. package/dist/src/entities/currency/index.js +9 -2
  54. package/dist/src/entities/currency/index.js.map +1 -1
  55. package/dist/src/entities/folder/index.js +394 -2
  56. package/dist/src/entities/folder/index.js.map +2 -2
  57. package/dist/src/entities/gamification/flashcard/index.js +26 -2
  58. package/dist/src/entities/gamification/flashcard/index.js.map +1 -1
  59. package/dist/src/entities/gamification/index.js +9 -2
  60. package/dist/src/entities/gamification/index.js.map +1 -1
  61. package/dist/src/entities/gamification/mcq/index.js +36 -2
  62. package/dist/src/entities/gamification/mcq/index.js.map +1 -1
  63. package/dist/src/entities/image/index.js +31 -2
  64. package/dist/src/entities/image/index.js.map +1 -1
  65. package/dist/src/entities/medecine/index.js +13 -2
  66. package/dist/src/entities/medecine/index.js.map +1 -1
  67. package/dist/src/entities/payment/index.js +23 -2
  68. package/dist/src/entities/payment/index.js.map +1 -1
  69. package/dist/src/entities/user/index.js +30 -2
  70. package/dist/src/entities/user/index.js.map +1 -1
  71. package/dist/src/entities/video/index.js +34 -2
  72. package/dist/src/entities/video/index.js.map +1 -1
  73. package/dist/src/migrations/book/index.js +541 -137
  74. package/dist/src/migrations/book/index.js.map +2 -2
  75. package/dist/src/migrations/common/index.js +63 -14
  76. package/dist/src/migrations/common/index.js.map +2 -2
  77. package/dist/src/migrations/country/index.js +48 -13
  78. package/dist/src/migrations/country/index.js.map +2 -2
  79. package/dist/src/migrations/currency/index.js +50 -14
  80. package/dist/src/migrations/currency/index.js.map +2 -2
  81. package/dist/src/migrations/folder/index.js +426 -104
  82. package/dist/src/migrations/folder/index.js.map +2 -2
  83. package/dist/src/migrations/gamification/flashcard/index.js +356 -96
  84. package/dist/src/migrations/gamification/flashcard/index.js.map +2 -2
  85. package/dist/src/migrations/gamification/index.js +8 -2
  86. package/dist/src/migrations/gamification/index.js.map +1 -1
  87. package/dist/src/migrations/gamification/mcq/index.js +553 -139
  88. package/dist/src/migrations/gamification/mcq/index.js.map +2 -2
  89. package/dist/src/migrations/image/index.js +353 -85
  90. package/dist/src/migrations/image/index.js.map +2 -2
  91. package/dist/src/migrations/medecine/index.js +132 -36
  92. package/dist/src/migrations/medecine/index.js.map +2 -2
  93. package/dist/src/migrations/payment/index.js +339 -94
  94. package/dist/src/migrations/payment/index.js.map +2 -2
  95. package/dist/src/migrations/user/index.js +331 -39
  96. package/dist/src/migrations/user/index.js.map +2 -2
  97. package/dist/src/migrations/video/index.js +345 -17
  98. package/dist/src/migrations/video/index.js.map +2 -2
  99. package/dist/src/repositories/book/index.js +997 -2
  100. package/dist/src/repositories/book/index.js.map +2 -2
  101. package/dist/src/repositories/common/index.js +439 -2
  102. package/dist/src/repositories/common/index.js.map +2 -2
  103. package/dist/src/repositories/country/index.js +89 -2
  104. package/dist/src/repositories/country/index.js.map +2 -2
  105. package/dist/src/repositories/currency/index.js +89 -2
  106. package/dist/src/repositories/currency/index.js.map +2 -2
  107. package/dist/src/repositories/gamification/flashcard/index.js +632 -2
  108. package/dist/src/repositories/gamification/flashcard/index.js.map +2 -2
  109. package/dist/src/repositories/gamification/index.js +160 -2
  110. package/dist/src/repositories/gamification/index.js.map +2 -2
  111. package/dist/src/repositories/gamification/mcq/index.js +1017 -2
  112. package/dist/src/repositories/gamification/mcq/index.js.map +2 -2
  113. package/dist/src/repositories/image/index.js +800 -2
  114. package/dist/src/repositories/image/index.js.map +2 -2
  115. package/dist/src/repositories/medecine/index.js +243 -2
  116. package/dist/src/repositories/medecine/index.js.map +2 -2
  117. package/dist/src/repositories/payment/index.js +560 -2
  118. package/dist/src/repositories/payment/index.js.map +2 -2
  119. package/dist/src/repositories/user/index.js +999 -2
  120. package/dist/src/repositories/user/index.js.map +2 -2
  121. package/dist/src/repositories/video/index.js +975 -2
  122. package/dist/src/repositories/video/index.js.map +2 -2
  123. package/package.json +1 -1
  124. package/dist/shared/chunk-19qhst35.js +0 -5
  125. package/dist/shared/chunk-59vwmfpm.js +0 -5
  126. package/dist/shared/chunk-5tnqjb3n.js +0 -5
  127. package/dist/shared/chunk-5ybg5hda.js +0 -5
  128. package/dist/shared/chunk-6jnj2pfx.js +0 -5
  129. package/dist/shared/chunk-6kdkyjbn.js +0 -5
  130. package/dist/shared/chunk-e51ktjsq.js +0 -5
  131. package/dist/shared/chunk-kw4t1san.js +0 -5
  132. package/dist/shared/chunk-nfv9ce7v.js +0 -5
  133. package/dist/shared/chunk-p22keb3y.js +0 -5
  134. package/dist/shared/chunk-pbns711f.js +0 -5
  135. package/dist/shared/chunk-t1jad451.js +0 -5
  136. package/dist/shared/chunk-t5cy307m.js +0 -5
  137. package/dist/shared/chunk-x2d798hg.js +0 -5
  138. package/dist/shared/chunk-x3pmm3na.js +0 -5
  139. package/dist/shared/chunk-xrqhqgen.js +0 -5
  140. package/dist/shared/chunk-xwe8m6av.js +0 -5
  141. package/dist/shared/chunk-yrwsqc6r.js +0 -5
@@ -1,4 +1,802 @@
1
1
  // @bun
2
- import{R as j,S as D,T as P,U as h,V as S,W as E,X as u,Y as R,Z as I}from"../../../shared/chunk-e51ktjsq.js";import{Ba as w}from"../../../shared/chunk-p22keb3y.js";import"../../../shared/chunk-6jnj2pfx.js";import"../../../shared/chunk-x2d798hg.js";import"../../../shared/chunk-xrqhqgen.js";import{Ha as K,Ia as M,Ja as N}from"../../../shared/chunk-59vwmfpm.js";import{inject as d}from"@ooneex/container";import{decorator as y}from"@ooneex/repository";class U{database;constructor(x){this.database=x}async open(){return await this.database.open(j)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,...F}=x,B,G=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*G;let J=await f.find({...F,take:G,...B!==void 0&&{skip:B}}),H=await this.count(F.where),Q=Math.ceil(H/A);return{resources:J,total:H,totalPages:Q,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}U=K([y.repository(),M(0,d("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],U);import{inject as g}from"@ooneex/container";import{decorator as l}from"@ooneex/repository";class X{database;constructor(x){this.database=x}async open(){return await this.database.open(D)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,...F}=x,B,G=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*G;let J=await f.find({...F,take:G,...B!==void 0&&{skip:B}}),H=await this.count(F.where),Q=Math.ceil(H/A);return{resources:J,total:H,totalPages:Q,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}X=K([l.repository(),M(0,g("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],X);import{inject as m}from"@ooneex/container";import{decorator as c}from"@ooneex/repository";class Y{database;constructor(x){this.database=x}async open(){return await this.database.open(P)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,...F}=x,B,G=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*G;let J=await f.find({...F,take:G,...B!==void 0&&{skip:B}}),H=await this.count(F.where),Q=Math.ceil(H/A);return{resources:J,total:H,totalPages:Q,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}Y=K([c.repository(),M(0,m("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],Y);import{inject as p}from"@ooneex/container";import{decorator as n}from"@ooneex/repository";class Z{database;constructor(x){this.database=x}async open(){return await this.database.open(h)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,...F}=x,B,G=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*G;let J=await f.find({...F,take:G,...B!==void 0&&{skip:B}}),H=await this.count(F.where),Q=Math.ceil(H/A);return{resources:J,total:H,totalPages:Q,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}Z=K([n.repository(),M(0,p("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],Z);import{inject as s}from"@ooneex/container";import{decorator as a}from"@ooneex/repository";class _{database;constructor(x){this.database=x}async open(){return await this.database.open(S)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,...F}=x,B,G=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*G;let J=await f.find({...F,take:G,...B!==void 0&&{skip:B}}),H=await this.count(F.where),Q=Math.ceil(H/A);return{resources:J,total:H,totalPages:Q,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}_=K([a.repository(),M(0,s("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],_);import{inject as r}from"@ooneex/container";import{decorator as o}from"@ooneex/repository";import{ILike as $}from"typeorm";class W{database;constructor(x){this.database=x}async open(){return await this.database.open(w)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,q:F,...B}=x,G,J=A===0?100:A;if(z&&z>0&&A&&A>0)G=(z-1)*J;let H={...B,take:J,...G!==void 0&&{skip:G}};if(F){let T=[{alt:$(`%${F}%`)},{title:$(`%${F}%`)}];H={...H,where:B.where?[...T.map((C)=>({...B.where,...C}))]:T}}let Q=await f.find(H),L=B.where;if(F){let T=[{alt:$(`%${F}%`)},{title:$(`%${F}%`)}];L=B.where?[...T.map((C)=>({...B.where,...C}))]:T}let b=await this.count(L),k=Math.ceil(b/A);return{resources:Q,total:b,totalPages:k,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}W=K([o.repository(),M(0,r("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],W);import{inject as e}from"@ooneex/container";import{decorator as t}from"@ooneex/repository";class O{database;constructor(x){this.database=x}async open(){return await this.database.open(E)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,...F}=x,B,G=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*G;let J=await f.find({...F,take:G,...B!==void 0&&{skip:B}}),H=await this.count(F.where),Q=Math.ceil(H/A);return{resources:J,total:H,totalPages:Q,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}O=K([t.repository(),M(0,e("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],O);import{inject as i}from"@ooneex/container";import{decorator as xx}from"@ooneex/repository";class v{database;constructor(x){this.database=x}async open(){return await this.database.open(u)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,...F}=x,B,G=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*G;let J=await f.find({...F,take:G,...B!==void 0&&{skip:B}}),H=await this.count(F.where),Q=Math.ceil(H/A);return{resources:J,total:H,totalPages:Q,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}v=K([xx.repository(),M(0,i("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],v);import{inject as fx}from"@ooneex/container";import{decorator as zx}from"@ooneex/repository";class V{database;constructor(x){this.database=x}async open(){return await this.database.open(R)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,...F}=x,B,G=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*G;let J=await f.find({...F,take:G,...B!==void 0&&{skip:B}}),H=await this.count(F.where),Q=Math.ceil(H/A);return{resources:J,total:H,totalPages:Q,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}V=K([zx.repository(),M(0,fx("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],V);import{inject as Ax}from"@ooneex/container";import{decorator as Bx}from"@ooneex/repository";class q{database;constructor(x){this.database=x}async open(){return await this.database.open(I)}async close(){await this.database.close()}async find(x){let f=await this.open(),{page:z=1,limit:A=100,...F}=x,B,G=A===0?100:A;if(z&&z>0&&A&&A>0)B=(z-1)*G;let J=await f.find({...F,take:G,...B!==void 0&&{skip:B}}),H=await this.count(F.where),Q=Math.ceil(H/A);return{resources:J,total:H,totalPages:Q,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,f){return await(await this.open()).save(x,f)}async createMany(x,f){return await(await this.open()).save(x,f)}async update(x,f){return await this.create(x,f)}async updateMany(x,f){return await this.createMany(x,f)}async delete(x){return await(await this.open()).softDelete(x)}async count(x){return await(await this.open()).count(x?{where:x}:{})}}q=K([Bx.repository(),M(0,Ax("database")),N("design:paramtypes",[typeof ITypeormDatabase==="undefined"?Object:ITypeormDatabase])],q);export{q as ImageViewedRepository,V as ImageStatRepository,v as ImageSharedRepository,O as ImageSavedRepository,W as ImageRepository,_ as ImageReportRepository,Z as ImageLikedRepository,Y as ImageDownloadedRepository,X as ImageDislikedRepository,U as ImageCommentRepository};
2
+ import {
3
+ ImageCommentEntity,
4
+ ImageDislikedEntity,
5
+ ImageDownloadedEntity,
6
+ ImageLikedEntity,
7
+ ImageReportEntity,
8
+ ImageSavedEntity,
9
+ ImageSharedEntity,
10
+ ImageStatEntity,
11
+ ImageViewedEntity
12
+ } from "../../../shared/chunk-efmap3y3.js";
13
+ import {
14
+ ImageEntity
15
+ } from "../../../shared/chunk-bkdccdhn.js";
16
+ import"../../../shared/chunk-p12g6e7b.js";
17
+ import"../../../shared/chunk-sk8z5zmk.js";
18
+ import"../../../shared/chunk-chan1evn.js";
19
+ import {
20
+ __legacyDecorateClassTS,
21
+ __legacyDecorateParamTS,
22
+ __legacyMetadataTS
23
+ } from "../../../shared/chunk-r9hsk9fk.js";
3
24
 
4
- //# debugId=D3F9549926F8AD1364756E2164756E21
25
+ // src/repositories/image/ImageCommentRepository.ts
26
+ import { inject } from "@ooneex/container";
27
+ import { decorator } from "@ooneex/repository";
28
+ class ImageCommentRepository {
29
+ database;
30
+ constructor(database) {
31
+ this.database = database;
32
+ }
33
+ async open() {
34
+ return await this.database.open(ImageCommentEntity);
35
+ }
36
+ async close() {
37
+ await this.database.close();
38
+ }
39
+ async find(criteria) {
40
+ const repository = await this.open();
41
+ const { page = 1, limit = 100, ...rest } = criteria;
42
+ let skip;
43
+ const take = limit === 0 ? 100 : limit;
44
+ if (page && page > 0 && limit && limit > 0) {
45
+ skip = (page - 1) * take;
46
+ }
47
+ const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
48
+ const total = await this.count(rest.where);
49
+ const totalPages = Math.ceil(total / limit);
50
+ return {
51
+ resources: result,
52
+ total,
53
+ totalPages,
54
+ page,
55
+ limit
56
+ };
57
+ }
58
+ async findOne(id) {
59
+ const repository = await this.open();
60
+ return await repository.findOne({
61
+ where: { id }
62
+ });
63
+ }
64
+ async findOneBy(criteria) {
65
+ const repository = await this.open();
66
+ return await repository.findOne({
67
+ where: criteria
68
+ });
69
+ }
70
+ async create(entity, options) {
71
+ const repository = await this.open();
72
+ return await repository.save(entity, options);
73
+ }
74
+ async createMany(entities, options) {
75
+ const repository = await this.open();
76
+ return await repository.save(entities, options);
77
+ }
78
+ async update(entity, options) {
79
+ return await this.create(entity, options);
80
+ }
81
+ async updateMany(entities, options) {
82
+ return await this.createMany(entities, options);
83
+ }
84
+ async delete(criteria) {
85
+ const repository = await this.open();
86
+ return await repository.softDelete(criteria);
87
+ }
88
+ async count(criteria) {
89
+ const repository = await this.open();
90
+ return await repository.count(criteria ? { where: criteria } : {});
91
+ }
92
+ }
93
+ ImageCommentRepository = __legacyDecorateClassTS([
94
+ decorator.repository(),
95
+ __legacyDecorateParamTS(0, inject("database")),
96
+ __legacyMetadataTS("design:paramtypes", [
97
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
98
+ ])
99
+ ], ImageCommentRepository);
100
+ // src/repositories/image/ImageDislikedRepository.ts
101
+ import { inject as inject2 } from "@ooneex/container";
102
+ import { decorator as decorator2 } from "@ooneex/repository";
103
+ class ImageDislikedRepository {
104
+ database;
105
+ constructor(database) {
106
+ this.database = database;
107
+ }
108
+ async open() {
109
+ return await this.database.open(ImageDislikedEntity);
110
+ }
111
+ async close() {
112
+ await this.database.close();
113
+ }
114
+ async find(criteria) {
115
+ const repository = await this.open();
116
+ const { page = 1, limit = 100, ...rest } = criteria;
117
+ let skip;
118
+ const take = limit === 0 ? 100 : limit;
119
+ if (page && page > 0 && limit && limit > 0) {
120
+ skip = (page - 1) * take;
121
+ }
122
+ const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
123
+ const total = await this.count(rest.where);
124
+ const totalPages = Math.ceil(total / limit);
125
+ return {
126
+ resources: result,
127
+ total,
128
+ totalPages,
129
+ page,
130
+ limit
131
+ };
132
+ }
133
+ async findOne(id) {
134
+ const repository = await this.open();
135
+ return await repository.findOne({
136
+ where: { id }
137
+ });
138
+ }
139
+ async findOneBy(criteria) {
140
+ const repository = await this.open();
141
+ return await repository.findOne({
142
+ where: criteria
143
+ });
144
+ }
145
+ async create(entity, options) {
146
+ const repository = await this.open();
147
+ return await repository.save(entity, options);
148
+ }
149
+ async createMany(entities, options) {
150
+ const repository = await this.open();
151
+ return await repository.save(entities, options);
152
+ }
153
+ async update(entity, options) {
154
+ return await this.create(entity, options);
155
+ }
156
+ async updateMany(entities, options) {
157
+ return await this.createMany(entities, options);
158
+ }
159
+ async delete(criteria) {
160
+ const repository = await this.open();
161
+ return await repository.softDelete(criteria);
162
+ }
163
+ async count(criteria) {
164
+ const repository = await this.open();
165
+ return await repository.count(criteria ? { where: criteria } : {});
166
+ }
167
+ }
168
+ ImageDislikedRepository = __legacyDecorateClassTS([
169
+ decorator2.repository(),
170
+ __legacyDecorateParamTS(0, inject2("database")),
171
+ __legacyMetadataTS("design:paramtypes", [
172
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
173
+ ])
174
+ ], ImageDislikedRepository);
175
+ // src/repositories/image/ImageDownloadedRepository.ts
176
+ import { inject as inject3 } from "@ooneex/container";
177
+ import { decorator as decorator3 } from "@ooneex/repository";
178
+ class ImageDownloadedRepository {
179
+ database;
180
+ constructor(database) {
181
+ this.database = database;
182
+ }
183
+ async open() {
184
+ return await this.database.open(ImageDownloadedEntity);
185
+ }
186
+ async close() {
187
+ await this.database.close();
188
+ }
189
+ async find(criteria) {
190
+ const repository = await this.open();
191
+ const { page = 1, limit = 100, ...rest } = criteria;
192
+ let skip;
193
+ const take = limit === 0 ? 100 : limit;
194
+ if (page && page > 0 && limit && limit > 0) {
195
+ skip = (page - 1) * take;
196
+ }
197
+ const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
198
+ const total = await this.count(rest.where);
199
+ const totalPages = Math.ceil(total / limit);
200
+ return {
201
+ resources: result,
202
+ total,
203
+ totalPages,
204
+ page,
205
+ limit
206
+ };
207
+ }
208
+ async findOne(id) {
209
+ const repository = await this.open();
210
+ return await repository.findOne({
211
+ where: { id }
212
+ });
213
+ }
214
+ async findOneBy(criteria) {
215
+ const repository = await this.open();
216
+ return await repository.findOne({
217
+ where: criteria
218
+ });
219
+ }
220
+ async create(entity, options) {
221
+ const repository = await this.open();
222
+ return await repository.save(entity, options);
223
+ }
224
+ async createMany(entities, options) {
225
+ const repository = await this.open();
226
+ return await repository.save(entities, options);
227
+ }
228
+ async update(entity, options) {
229
+ return await this.create(entity, options);
230
+ }
231
+ async updateMany(entities, options) {
232
+ return await this.createMany(entities, options);
233
+ }
234
+ async delete(criteria) {
235
+ const repository = await this.open();
236
+ return await repository.softDelete(criteria);
237
+ }
238
+ async count(criteria) {
239
+ const repository = await this.open();
240
+ return await repository.count(criteria ? { where: criteria } : {});
241
+ }
242
+ }
243
+ ImageDownloadedRepository = __legacyDecorateClassTS([
244
+ decorator3.repository(),
245
+ __legacyDecorateParamTS(0, inject3("database")),
246
+ __legacyMetadataTS("design:paramtypes", [
247
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
248
+ ])
249
+ ], ImageDownloadedRepository);
250
+ // src/repositories/image/ImageLikedRepository.ts
251
+ import { inject as inject4 } from "@ooneex/container";
252
+ import { decorator as decorator4 } from "@ooneex/repository";
253
+ class ImageLikedRepository {
254
+ database;
255
+ constructor(database) {
256
+ this.database = database;
257
+ }
258
+ async open() {
259
+ return await this.database.open(ImageLikedEntity);
260
+ }
261
+ async close() {
262
+ await this.database.close();
263
+ }
264
+ async find(criteria) {
265
+ const repository = await this.open();
266
+ const { page = 1, limit = 100, ...rest } = criteria;
267
+ let skip;
268
+ const take = limit === 0 ? 100 : limit;
269
+ if (page && page > 0 && limit && limit > 0) {
270
+ skip = (page - 1) * take;
271
+ }
272
+ const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
273
+ const total = await this.count(rest.where);
274
+ const totalPages = Math.ceil(total / limit);
275
+ return {
276
+ resources: result,
277
+ total,
278
+ totalPages,
279
+ page,
280
+ limit
281
+ };
282
+ }
283
+ async findOne(id) {
284
+ const repository = await this.open();
285
+ return await repository.findOne({
286
+ where: { id }
287
+ });
288
+ }
289
+ async findOneBy(criteria) {
290
+ const repository = await this.open();
291
+ return await repository.findOne({
292
+ where: criteria
293
+ });
294
+ }
295
+ async create(entity, options) {
296
+ const repository = await this.open();
297
+ return await repository.save(entity, options);
298
+ }
299
+ async createMany(entities, options) {
300
+ const repository = await this.open();
301
+ return await repository.save(entities, options);
302
+ }
303
+ async update(entity, options) {
304
+ return await this.create(entity, options);
305
+ }
306
+ async updateMany(entities, options) {
307
+ return await this.createMany(entities, options);
308
+ }
309
+ async delete(criteria) {
310
+ const repository = await this.open();
311
+ return await repository.softDelete(criteria);
312
+ }
313
+ async count(criteria) {
314
+ const repository = await this.open();
315
+ return await repository.count(criteria ? { where: criteria } : {});
316
+ }
317
+ }
318
+ ImageLikedRepository = __legacyDecorateClassTS([
319
+ decorator4.repository(),
320
+ __legacyDecorateParamTS(0, inject4("database")),
321
+ __legacyMetadataTS("design:paramtypes", [
322
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
323
+ ])
324
+ ], ImageLikedRepository);
325
+ // src/repositories/image/ImageReportRepository.ts
326
+ import { inject as inject5 } from "@ooneex/container";
327
+ import { decorator as decorator5 } from "@ooneex/repository";
328
+ class ImageReportRepository {
329
+ database;
330
+ constructor(database) {
331
+ this.database = database;
332
+ }
333
+ async open() {
334
+ return await this.database.open(ImageReportEntity);
335
+ }
336
+ async close() {
337
+ await this.database.close();
338
+ }
339
+ async find(criteria) {
340
+ const repository = await this.open();
341
+ const { page = 1, limit = 100, ...rest } = criteria;
342
+ let skip;
343
+ const take = limit === 0 ? 100 : limit;
344
+ if (page && page > 0 && limit && limit > 0) {
345
+ skip = (page - 1) * take;
346
+ }
347
+ const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
348
+ const total = await this.count(rest.where);
349
+ const totalPages = Math.ceil(total / limit);
350
+ return {
351
+ resources: result,
352
+ total,
353
+ totalPages,
354
+ page,
355
+ limit
356
+ };
357
+ }
358
+ async findOne(id) {
359
+ const repository = await this.open();
360
+ return await repository.findOne({
361
+ where: { id }
362
+ });
363
+ }
364
+ async findOneBy(criteria) {
365
+ const repository = await this.open();
366
+ return await repository.findOne({
367
+ where: criteria
368
+ });
369
+ }
370
+ async create(entity, options) {
371
+ const repository = await this.open();
372
+ return await repository.save(entity, options);
373
+ }
374
+ async createMany(entities, options) {
375
+ const repository = await this.open();
376
+ return await repository.save(entities, options);
377
+ }
378
+ async update(entity, options) {
379
+ return await this.create(entity, options);
380
+ }
381
+ async updateMany(entities, options) {
382
+ return await this.createMany(entities, options);
383
+ }
384
+ async delete(criteria) {
385
+ const repository = await this.open();
386
+ return await repository.softDelete(criteria);
387
+ }
388
+ async count(criteria) {
389
+ const repository = await this.open();
390
+ return await repository.count(criteria ? { where: criteria } : {});
391
+ }
392
+ }
393
+ ImageReportRepository = __legacyDecorateClassTS([
394
+ decorator5.repository(),
395
+ __legacyDecorateParamTS(0, inject5("database")),
396
+ __legacyMetadataTS("design:paramtypes", [
397
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
398
+ ])
399
+ ], ImageReportRepository);
400
+ // src/repositories/image/ImageRepository.ts
401
+ import { inject as inject6 } from "@ooneex/container";
402
+ import { decorator as decorator6 } from "@ooneex/repository";
403
+ import { ILike } from "typeorm";
404
+ class ImageRepository {
405
+ database;
406
+ constructor(database) {
407
+ this.database = database;
408
+ }
409
+ async open() {
410
+ return await this.database.open(ImageEntity);
411
+ }
412
+ async close() {
413
+ await this.database.close();
414
+ }
415
+ async find(criteria) {
416
+ const repository = await this.open();
417
+ const { page = 1, limit = 100, q, ...rest } = criteria;
418
+ let skip;
419
+ const take = limit === 0 ? 100 : limit;
420
+ if (page && page > 0 && limit && limit > 0) {
421
+ skip = (page - 1) * take;
422
+ }
423
+ let findOptions = { ...rest, take, ...skip !== undefined && { skip } };
424
+ if (q) {
425
+ const searchConditions = [{ alt: ILike(`%${q}%`) }, { title: ILike(`%${q}%`) }];
426
+ findOptions = {
427
+ ...findOptions,
428
+ where: rest.where ? [...searchConditions.map((condition) => ({ ...rest.where, ...condition }))] : searchConditions
429
+ };
430
+ }
431
+ const result = await repository.find(findOptions);
432
+ let countWhere = rest.where;
433
+ if (q) {
434
+ const searchConditions = [{ alt: ILike(`%${q}%`) }, { title: ILike(`%${q}%`) }];
435
+ countWhere = rest.where ? [...searchConditions.map((condition) => ({ ...rest.where, ...condition }))] : searchConditions;
436
+ }
437
+ const total = await this.count(countWhere);
438
+ const totalPages = Math.ceil(total / limit);
439
+ return {
440
+ resources: result,
441
+ total,
442
+ totalPages,
443
+ page,
444
+ limit
445
+ };
446
+ }
447
+ async findOne(id) {
448
+ const repository = await this.open();
449
+ return await repository.findOne({
450
+ where: { id }
451
+ });
452
+ }
453
+ async findOneBy(criteria) {
454
+ const repository = await this.open();
455
+ return await repository.findOne({
456
+ where: criteria
457
+ });
458
+ }
459
+ async create(entity, options) {
460
+ const repository = await this.open();
461
+ return await repository.save(entity, options);
462
+ }
463
+ async createMany(entities, options) {
464
+ const repository = await this.open();
465
+ return await repository.save(entities, options);
466
+ }
467
+ async update(entity, options) {
468
+ return await this.create(entity, options);
469
+ }
470
+ async updateMany(entities, options) {
471
+ return await this.createMany(entities, options);
472
+ }
473
+ async delete(criteria) {
474
+ const repository = await this.open();
475
+ return await repository.softDelete(criteria);
476
+ }
477
+ async count(criteria) {
478
+ const repository = await this.open();
479
+ return await repository.count(criteria ? { where: criteria } : {});
480
+ }
481
+ }
482
+ ImageRepository = __legacyDecorateClassTS([
483
+ decorator6.repository(),
484
+ __legacyDecorateParamTS(0, inject6("database")),
485
+ __legacyMetadataTS("design:paramtypes", [
486
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
487
+ ])
488
+ ], ImageRepository);
489
+ // src/repositories/image/ImageSavedRepository.ts
490
+ import { inject as inject7 } from "@ooneex/container";
491
+ import { decorator as decorator7 } from "@ooneex/repository";
492
+ class ImageSavedRepository {
493
+ database;
494
+ constructor(database) {
495
+ this.database = database;
496
+ }
497
+ async open() {
498
+ return await this.database.open(ImageSavedEntity);
499
+ }
500
+ async close() {
501
+ await this.database.close();
502
+ }
503
+ async find(criteria) {
504
+ const repository = await this.open();
505
+ const { page = 1, limit = 100, ...rest } = criteria;
506
+ let skip;
507
+ const take = limit === 0 ? 100 : limit;
508
+ if (page && page > 0 && limit && limit > 0) {
509
+ skip = (page - 1) * take;
510
+ }
511
+ const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
512
+ const total = await this.count(rest.where);
513
+ const totalPages = Math.ceil(total / limit);
514
+ return {
515
+ resources: result,
516
+ total,
517
+ totalPages,
518
+ page,
519
+ limit
520
+ };
521
+ }
522
+ async findOne(id) {
523
+ const repository = await this.open();
524
+ return await repository.findOne({
525
+ where: { id }
526
+ });
527
+ }
528
+ async findOneBy(criteria) {
529
+ const repository = await this.open();
530
+ return await repository.findOne({
531
+ where: criteria
532
+ });
533
+ }
534
+ async create(entity, options) {
535
+ const repository = await this.open();
536
+ return await repository.save(entity, options);
537
+ }
538
+ async createMany(entities, options) {
539
+ const repository = await this.open();
540
+ return await repository.save(entities, options);
541
+ }
542
+ async update(entity, options) {
543
+ return await this.create(entity, options);
544
+ }
545
+ async updateMany(entities, options) {
546
+ return await this.createMany(entities, options);
547
+ }
548
+ async delete(criteria) {
549
+ const repository = await this.open();
550
+ return await repository.softDelete(criteria);
551
+ }
552
+ async count(criteria) {
553
+ const repository = await this.open();
554
+ return await repository.count(criteria ? { where: criteria } : {});
555
+ }
556
+ }
557
+ ImageSavedRepository = __legacyDecorateClassTS([
558
+ decorator7.repository(),
559
+ __legacyDecorateParamTS(0, inject7("database")),
560
+ __legacyMetadataTS("design:paramtypes", [
561
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
562
+ ])
563
+ ], ImageSavedRepository);
564
+ // src/repositories/image/ImageSharedRepository.ts
565
+ import { inject as inject8 } from "@ooneex/container";
566
+ import { decorator as decorator8 } from "@ooneex/repository";
567
+ class ImageSharedRepository {
568
+ database;
569
+ constructor(database) {
570
+ this.database = database;
571
+ }
572
+ async open() {
573
+ return await this.database.open(ImageSharedEntity);
574
+ }
575
+ async close() {
576
+ await this.database.close();
577
+ }
578
+ async find(criteria) {
579
+ const repository = await this.open();
580
+ const { page = 1, limit = 100, ...rest } = criteria;
581
+ let skip;
582
+ const take = limit === 0 ? 100 : limit;
583
+ if (page && page > 0 && limit && limit > 0) {
584
+ skip = (page - 1) * take;
585
+ }
586
+ const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
587
+ const total = await this.count(rest.where);
588
+ const totalPages = Math.ceil(total / limit);
589
+ return {
590
+ resources: result,
591
+ total,
592
+ totalPages,
593
+ page,
594
+ limit
595
+ };
596
+ }
597
+ async findOne(id) {
598
+ const repository = await this.open();
599
+ return await repository.findOne({
600
+ where: { id }
601
+ });
602
+ }
603
+ async findOneBy(criteria) {
604
+ const repository = await this.open();
605
+ return await repository.findOne({
606
+ where: criteria
607
+ });
608
+ }
609
+ async create(entity, options) {
610
+ const repository = await this.open();
611
+ return await repository.save(entity, options);
612
+ }
613
+ async createMany(entities, options) {
614
+ const repository = await this.open();
615
+ return await repository.save(entities, options);
616
+ }
617
+ async update(entity, options) {
618
+ return await this.create(entity, options);
619
+ }
620
+ async updateMany(entities, options) {
621
+ return await this.createMany(entities, options);
622
+ }
623
+ async delete(criteria) {
624
+ const repository = await this.open();
625
+ return await repository.softDelete(criteria);
626
+ }
627
+ async count(criteria) {
628
+ const repository = await this.open();
629
+ return await repository.count(criteria ? { where: criteria } : {});
630
+ }
631
+ }
632
+ ImageSharedRepository = __legacyDecorateClassTS([
633
+ decorator8.repository(),
634
+ __legacyDecorateParamTS(0, inject8("database")),
635
+ __legacyMetadataTS("design:paramtypes", [
636
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
637
+ ])
638
+ ], ImageSharedRepository);
639
+ // src/repositories/image/ImageStatRepository.ts
640
+ import { inject as inject9 } from "@ooneex/container";
641
+ import { decorator as decorator9 } from "@ooneex/repository";
642
+ class ImageStatRepository {
643
+ database;
644
+ constructor(database) {
645
+ this.database = database;
646
+ }
647
+ async open() {
648
+ return await this.database.open(ImageStatEntity);
649
+ }
650
+ async close() {
651
+ await this.database.close();
652
+ }
653
+ async find(criteria) {
654
+ const repository = await this.open();
655
+ const { page = 1, limit = 100, ...rest } = criteria;
656
+ let skip;
657
+ const take = limit === 0 ? 100 : limit;
658
+ if (page && page > 0 && limit && limit > 0) {
659
+ skip = (page - 1) * take;
660
+ }
661
+ const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
662
+ const total = await this.count(rest.where);
663
+ const totalPages = Math.ceil(total / limit);
664
+ return {
665
+ resources: result,
666
+ total,
667
+ totalPages,
668
+ page,
669
+ limit
670
+ };
671
+ }
672
+ async findOne(id) {
673
+ const repository = await this.open();
674
+ return await repository.findOne({
675
+ where: { id }
676
+ });
677
+ }
678
+ async findOneBy(criteria) {
679
+ const repository = await this.open();
680
+ return await repository.findOne({
681
+ where: criteria
682
+ });
683
+ }
684
+ async create(entity, options) {
685
+ const repository = await this.open();
686
+ return await repository.save(entity, options);
687
+ }
688
+ async createMany(entities, options) {
689
+ const repository = await this.open();
690
+ return await repository.save(entities, options);
691
+ }
692
+ async update(entity, options) {
693
+ return await this.create(entity, options);
694
+ }
695
+ async updateMany(entities, options) {
696
+ return await this.createMany(entities, options);
697
+ }
698
+ async delete(criteria) {
699
+ const repository = await this.open();
700
+ return await repository.softDelete(criteria);
701
+ }
702
+ async count(criteria) {
703
+ const repository = await this.open();
704
+ return await repository.count(criteria ? { where: criteria } : {});
705
+ }
706
+ }
707
+ ImageStatRepository = __legacyDecorateClassTS([
708
+ decorator9.repository(),
709
+ __legacyDecorateParamTS(0, inject9("database")),
710
+ __legacyMetadataTS("design:paramtypes", [
711
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
712
+ ])
713
+ ], ImageStatRepository);
714
+ // src/repositories/image/ImageViewedRepository.ts
715
+ import { inject as inject10 } from "@ooneex/container";
716
+ import { decorator as decorator10 } from "@ooneex/repository";
717
+ class ImageViewedRepository {
718
+ database;
719
+ constructor(database) {
720
+ this.database = database;
721
+ }
722
+ async open() {
723
+ return await this.database.open(ImageViewedEntity);
724
+ }
725
+ async close() {
726
+ await this.database.close();
727
+ }
728
+ async find(criteria) {
729
+ const repository = await this.open();
730
+ const { page = 1, limit = 100, ...rest } = criteria;
731
+ let skip;
732
+ const take = limit === 0 ? 100 : limit;
733
+ if (page && page > 0 && limit && limit > 0) {
734
+ skip = (page - 1) * take;
735
+ }
736
+ const result = await repository.find({ ...rest, take, ...skip !== undefined && { skip } });
737
+ const total = await this.count(rest.where);
738
+ const totalPages = Math.ceil(total / limit);
739
+ return {
740
+ resources: result,
741
+ total,
742
+ totalPages,
743
+ page,
744
+ limit
745
+ };
746
+ }
747
+ async findOne(id) {
748
+ const repository = await this.open();
749
+ return await repository.findOne({
750
+ where: { id }
751
+ });
752
+ }
753
+ async findOneBy(criteria) {
754
+ const repository = await this.open();
755
+ return await repository.findOne({
756
+ where: criteria
757
+ });
758
+ }
759
+ async create(entity, options) {
760
+ const repository = await this.open();
761
+ return await repository.save(entity, options);
762
+ }
763
+ async createMany(entities, options) {
764
+ const repository = await this.open();
765
+ return await repository.save(entities, options);
766
+ }
767
+ async update(entity, options) {
768
+ return await this.create(entity, options);
769
+ }
770
+ async updateMany(entities, options) {
771
+ return await this.createMany(entities, options);
772
+ }
773
+ async delete(criteria) {
774
+ const repository = await this.open();
775
+ return await repository.softDelete(criteria);
776
+ }
777
+ async count(criteria) {
778
+ const repository = await this.open();
779
+ return await repository.count(criteria ? { where: criteria } : {});
780
+ }
781
+ }
782
+ ImageViewedRepository = __legacyDecorateClassTS([
783
+ decorator10.repository(),
784
+ __legacyDecorateParamTS(0, inject10("database")),
785
+ __legacyMetadataTS("design:paramtypes", [
786
+ typeof ITypeormDatabase === "undefined" ? Object : ITypeormDatabase
787
+ ])
788
+ ], ImageViewedRepository);
789
+ export {
790
+ ImageViewedRepository,
791
+ ImageStatRepository,
792
+ ImageSharedRepository,
793
+ ImageSavedRepository,
794
+ ImageRepository,
795
+ ImageReportRepository,
796
+ ImageLikedRepository,
797
+ ImageDownloadedRepository,
798
+ ImageDislikedRepository,
799
+ ImageCommentRepository
800
+ };
801
+
802
+ //# debugId=EC6FEFA50277B65E64756E2164756E21