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