app.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. const mongoose = require('mongoose');
  2. var appicaptorSchema = new mongoose.Schema({
  3. overprivilegedPermission: {
  4. type: mongoose.Schema.Types.Mixed
  5. },
  6. dangerousPermission: {
  7. type: mongoose.Schema.Types.Mixed
  8. },
  9. extensiveTrackingFrameworkUsage: {
  10. type: mongoose.Schema.Types.Mixed
  11. },
  12. outdatedCryptographicPrimitives: {
  13. type: mongoose.Schema.Types.Mixed
  14. },
  15. unprotectedCommunication: {
  16. type: mongoose.Schema.Types.Mixed
  17. }
  18. });
  19. var permissionSchema = new mongoose.Schema({
  20. permission: {
  21. type: String,
  22. required: true
  23. },
  24. description: {
  25. type: String
  26. }
  27. });
  28. var appSchema = new mongoose.Schema({
  29. title: {
  30. type: String,
  31. required: true
  32. },
  33. summary: {
  34. type: String,
  35. required: true
  36. },
  37. price: {
  38. type: Number,
  39. required: true
  40. },
  41. free: {
  42. type: Boolean,
  43. required: true
  44. },
  45. minInstalls: {
  46. type: Number,
  47. required: true
  48. },
  49. maxInstalls: {
  50. type: Number,
  51. required: true
  52. },
  53. score: {
  54. type: Number,
  55. required: true
  56. },
  57. reviews: [{ type: mongoose.Schema.Types.ObjectId, ref: 'review' }],
  58. developer: {
  59. type: mongoose.Schema.Types.Mixed
  60. },
  61. developerEmail: {
  62. type: String
  63. },
  64. developerWebsite: {
  65. type: String
  66. },
  67. updated: {
  68. type: Date,
  69. default: Date.now
  70. },
  71. version: {
  72. type: String
  73. },
  74. genre: {
  75. type: String,
  76. required: true
  77. },
  78. genreId: {
  79. type: String,
  80. required: true
  81. },
  82. description: {
  83. type: String,
  84. required: true
  85. },
  86. histogram: {
  87. type: mongoose.Schema.Types.Mixed
  88. },
  89. offersIAP: {
  90. type: Boolean,
  91. required: true
  92. },
  93. adSupported: {
  94. type: Boolean,
  95. required: true
  96. },
  97. androidVersionText: {
  98. type: String,
  99. required: true
  100. },
  101. androidVersion: {
  102. type: String,
  103. required: true
  104. },
  105. contentRating: {
  106. type: String,
  107. required: true
  108. },
  109. screenshots: [
  110. {
  111. type: String
  112. }
  113. ],
  114. comments: [
  115. {
  116. type: String
  117. }
  118. ],
  119. recentChanges: [
  120. {
  121. type: String
  122. }
  123. ],
  124. preregister: {
  125. type: Boolean,
  126. required: true
  127. },
  128. url: {
  129. type: String,
  130. required: true
  131. },
  132. appId: {
  133. type: String,
  134. required: true,
  135. unique: true
  136. },
  137. playstoreUrl: {
  138. type: String,
  139. required: true
  140. },
  141. reviewsCount: {//rename to ratingscount
  142. type: Number
  143. },
  144. permissions: [permissionSchema],
  145. //appicaptor: appicaptorSchema
  146. appicaptor: {
  147. type: mongoose.Schema.Types.Mixed
  148. }
  149. });
  150. // Export the model.
  151. module.exports = mongoose.model('app', appSchema);