@openneuro/server 4.20.5 → 4.20.6-alpha.3

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 (185) hide show
  1. package/package.json +4 -6
  2. package/src/__mocks__/{config.js → config.ts} +5 -5
  3. package/src/app.ts +32 -31
  4. package/src/cache/item.ts +6 -7
  5. package/src/cache/types.ts +8 -8
  6. package/src/{config.js → config.ts} +6 -6
  7. package/src/datalad/__tests__/changelog.spec.ts +83 -0
  8. package/src/datalad/__tests__/dataset.spec.ts +109 -0
  9. package/src/datalad/__tests__/description.spec.ts +141 -0
  10. package/src/datalad/__tests__/files.spec.ts +77 -0
  11. package/src/datalad/__tests__/pagination.spec.ts +136 -0
  12. package/src/datalad/__tests__/{snapshots.spec.js → snapshots.spec.ts} +17 -17
  13. package/src/datalad/{analytics.js → analytics.ts} +4 -4
  14. package/src/datalad/{changelog.js → changelog.ts} +17 -14
  15. package/src/datalad/{dataset.js → dataset.ts} +95 -93
  16. package/src/datalad/{description.js → description.ts} +37 -37
  17. package/src/datalad/draft.ts +38 -0
  18. package/src/datalad/files.ts +26 -20
  19. package/src/datalad/{pagination.js → pagination.ts} +47 -47
  20. package/src/datalad/{readme.js → readme.ts} +13 -11
  21. package/src/datalad/{reexporter.js → reexporter.ts} +4 -4
  22. package/src/datalad/{snapshots.js → snapshots.ts} +56 -62
  23. package/src/datalad/{upload.js → upload.ts} +7 -5
  24. package/src/elasticsearch/elastic-client.ts +11 -0
  25. package/src/elasticsearch/reindex-dataset.ts +7 -7
  26. package/src/graphql/__tests__/__snapshots__/permissions.spec.ts.snap +5 -0
  27. package/src/graphql/__tests__/{comment.spec.js → comment.spec.ts} +17 -17
  28. package/src/graphql/__tests__/permissions.spec.ts +113 -0
  29. package/src/graphql/{permissions.js → permissions.ts} +14 -14
  30. package/src/graphql/resolvers/__tests__/brainlife.spec.ts +11 -11
  31. package/src/graphql/resolvers/__tests__/{dataset-search.spec.js → dataset-search.spec.ts} +25 -23
  32. package/src/graphql/resolvers/__tests__/dataset.spec.ts +175 -0
  33. package/src/graphql/resolvers/__tests__/derivatives.spec.ts +19 -19
  34. package/src/graphql/resolvers/__tests__/importRemoteDataset.spec.ts +20 -20
  35. package/src/graphql/resolvers/__tests__/permssions.spec.ts +35 -0
  36. package/src/graphql/resolvers/__tests__/snapshots.spec.ts +59 -0
  37. package/src/graphql/resolvers/__tests__/user.spec.ts +18 -0
  38. package/src/graphql/resolvers/brainlife.ts +4 -4
  39. package/src/graphql/resolvers/cache.ts +4 -4
  40. package/src/graphql/resolvers/{comment.js → comment.ts} +16 -16
  41. package/src/graphql/resolvers/{dataset-search.js → dataset-search.ts} +45 -43
  42. package/src/graphql/resolvers/{dataset.js → dataset.ts} +38 -52
  43. package/src/graphql/resolvers/datasetType.ts +3 -3
  44. package/src/graphql/resolvers/derivatives.ts +11 -11
  45. package/src/graphql/resolvers/description.ts +18 -0
  46. package/src/graphql/resolvers/{draft.js → draft.ts} +13 -13
  47. package/src/graphql/resolvers/{flaggedFiles.js → flaggedFiles.ts} +4 -4
  48. package/src/graphql/resolvers/{follow.js → follow.ts} +1 -1
  49. package/src/graphql/resolvers/git.ts +3 -3
  50. package/src/graphql/resolvers/history.ts +13 -0
  51. package/src/graphql/resolvers/importRemoteDataset.ts +12 -11
  52. package/src/graphql/resolvers/index.ts +25 -0
  53. package/src/graphql/resolvers/{issues.js → issues.ts} +9 -9
  54. package/src/graphql/resolvers/metadata.ts +8 -8
  55. package/src/graphql/resolvers/{mutation.js → mutation.ts} +26 -26
  56. package/src/graphql/resolvers/{newsletter.js → newsletter.ts} +2 -2
  57. package/src/graphql/resolvers/permissions.ts +15 -21
  58. package/src/graphql/resolvers/publish.ts +17 -0
  59. package/src/graphql/resolvers/query.ts +21 -0
  60. package/src/graphql/resolvers/{readme.js → readme.ts} +3 -3
  61. package/src/graphql/resolvers/{reexporter.js → reexporter.ts} +2 -2
  62. package/src/graphql/resolvers/relation.ts +5 -5
  63. package/src/graphql/resolvers/{reset.js → reset.ts} +2 -2
  64. package/src/graphql/resolvers/reviewer.ts +4 -4
  65. package/src/graphql/resolvers/{snapshots.js → snapshots.ts} +49 -49
  66. package/src/graphql/resolvers/{stars.js → stars.ts} +1 -1
  67. package/src/graphql/resolvers/summary.ts +3 -3
  68. package/src/graphql/resolvers/{upload.js → upload.ts} +5 -5
  69. package/src/graphql/resolvers/{user.js → user.ts} +16 -18
  70. package/src/graphql/resolvers/{validation.js → validation.ts} +12 -14
  71. package/src/graphql/{schema.js → schema.ts} +4 -6
  72. package/src/graphql/utils/{file.js → file.ts} +2 -2
  73. package/src/handlers/{comments.js → comments.ts} +11 -11
  74. package/src/handlers/{config.js → config.ts} +1 -1
  75. package/src/handlers/{datalad.js → datalad.ts} +22 -22
  76. package/src/handlers/{doi.js → doi.ts} +6 -6
  77. package/src/handlers/reviewer.ts +6 -6
  78. package/src/handlers/{sitemap.js → sitemap.ts} +19 -19
  79. package/src/handlers/stars.ts +11 -10
  80. package/src/handlers/{subscriptions.js → subscriptions.ts} +17 -16
  81. package/src/handlers/{users.js → users.ts} +3 -3
  82. package/src/libs/__tests__/apikey.spec.ts +25 -0
  83. package/src/libs/__tests__/datalad-service.spec.ts +27 -0
  84. package/src/libs/__tests__/{dataset.spec.js → dataset.spec.ts} +9 -9
  85. package/src/libs/{apikey.js → apikey.ts} +5 -5
  86. package/src/libs/authentication/__tests__/jwt.spec.ts +59 -0
  87. package/src/libs/authentication/{crypto.js → crypto.ts} +16 -16
  88. package/src/libs/authentication/google.ts +18 -0
  89. package/src/libs/authentication/jwt.ts +40 -33
  90. package/src/libs/authentication/{orcid.js → orcid.ts} +11 -11
  91. package/src/libs/authentication/{passport.js → passport.ts} +45 -30
  92. package/src/libs/authentication/{states.js → states.ts} +17 -20
  93. package/src/libs/{counter.js → counter.ts} +1 -1
  94. package/src/libs/{datalad-service.js → datalad-service.ts} +4 -4
  95. package/src/libs/dataset.ts +9 -0
  96. package/src/libs/doi/__tests__/__snapshots__/doi.spec.ts.snap +17 -0
  97. package/src/libs/doi/__tests__/doi.spec.ts +25 -0
  98. package/src/libs/doi/__tests__/normalize.spec.ts +19 -19
  99. package/src/libs/doi/{index.js → index.ts} +27 -21
  100. package/src/libs/doi/normalize.ts +2 -2
  101. package/src/libs/email/__tests__/index.spec.ts +14 -14
  102. package/src/libs/email/index.ts +4 -4
  103. package/src/libs/email/templates/__tests__/comment-created.spec.ts +12 -12
  104. package/src/libs/email/templates/__tests__/dataset-deleted.spec.ts +6 -6
  105. package/src/libs/email/templates/__tests__/owner-unsubscribed.spec.ts +6 -6
  106. package/src/libs/email/templates/__tests__/snapshot-created.spec.ts +9 -9
  107. package/src/libs/email/templates/__tests__/snapshot-reminder.spec.ts +7 -7
  108. package/src/libs/email/templates/comment-created.ts +2 -1
  109. package/src/libs/email/templates/dataset-deleted.ts +2 -1
  110. package/src/libs/email/templates/dataset-import-failed.ts +2 -1
  111. package/src/libs/email/templates/dataset-imported.ts +2 -1
  112. package/src/libs/email/templates/owner-unsubscribed.ts +2 -1
  113. package/src/libs/email/templates/snapshot-created.ts +2 -1
  114. package/src/libs/email/templates/snapshot-reminder.ts +2 -1
  115. package/src/libs/{notifications.js → notifications.ts} +100 -113
  116. package/src/libs/{orcid.js → orcid.ts} +20 -20
  117. package/src/libs/{redis.js → redis.ts} +6 -6
  118. package/src/models/__tests__/ingestDataset.spec.ts +15 -15
  119. package/src/models/analytics.ts +2 -2
  120. package/src/models/badAnnexObject.ts +6 -6
  121. package/src/models/comment.ts +10 -10
  122. package/src/models/counter.ts +2 -2
  123. package/src/models/dataset.ts +16 -16
  124. package/src/models/deletion.ts +3 -3
  125. package/src/models/deprecatedSnapshot.ts +2 -2
  126. package/src/models/doi.ts +2 -2
  127. package/src/models/file.ts +2 -2
  128. package/src/models/ingestDataset.ts +4 -4
  129. package/src/models/issue.ts +2 -2
  130. package/src/models/key.ts +2 -2
  131. package/src/models/mailgunIdentifier.ts +2 -2
  132. package/src/models/metadata.ts +3 -3
  133. package/src/models/newsletter.ts +3 -3
  134. package/src/models/notification.ts +2 -2
  135. package/src/models/permission.ts +4 -4
  136. package/src/models/reviewer.ts +7 -7
  137. package/src/models/snapshot.ts +2 -2
  138. package/src/models/stars.ts +6 -6
  139. package/src/models/subscription.ts +2 -2
  140. package/src/models/summary.ts +2 -2
  141. package/src/models/upload.ts +3 -3
  142. package/src/models/user.ts +4 -4
  143. package/src/{routes.js → routes.ts} +62 -62
  144. package/src/server.ts +9 -9
  145. package/src/utils/__tests__/datasetOrSnapshot.spec.ts +25 -25
  146. package/src/utils/__tests__/validateUrl.spec.ts +10 -10
  147. package/src/utils/datasetOrSnapshot.ts +2 -2
  148. package/src/utils/validateUrl.ts +1 -1
  149. package/src/datalad/__tests__/changelog.spec.js +0 -82
  150. package/src/datalad/__tests__/dataset.spec.js +0 -109
  151. package/src/datalad/__tests__/description.spec.js +0 -137
  152. package/src/datalad/__tests__/files.spec.js +0 -75
  153. package/src/datalad/__tests__/pagination.spec.js +0 -136
  154. package/src/datalad/draft.js +0 -37
  155. package/src/elasticsearch/elastic-client.js +0 -11
  156. package/src/graphql/__tests__/permissions.spec.js +0 -107
  157. package/src/graphql/pubsub.js +0 -5
  158. package/src/graphql/resolvers/__tests__/dataset.spec.js +0 -175
  159. package/src/graphql/resolvers/__tests__/permssions.spec.js +0 -34
  160. package/src/graphql/resolvers/__tests__/snapshots.spec.js +0 -58
  161. package/src/graphql/resolvers/__tests__/user.spec.js +0 -17
  162. package/src/graphql/resolvers/description.js +0 -29
  163. package/src/graphql/resolvers/history.js +0 -11
  164. package/src/graphql/resolvers/index.js +0 -25
  165. package/src/graphql/resolvers/publish.js +0 -17
  166. package/src/graphql/resolvers/query.js +0 -21
  167. package/src/graphql/resolvers/subscriptions.js +0 -81
  168. package/src/graphql/utils/publish-draft-update.js +0 -13
  169. package/src/libs/__tests__/apikey.spec.js +0 -24
  170. package/src/libs/__tests__/datalad-service.spec.js +0 -26
  171. package/src/libs/authentication/__tests__/jwt.spec.js +0 -23
  172. package/src/libs/authentication/globus.js +0 -11
  173. package/src/libs/authentication/google.js +0 -19
  174. package/src/libs/bidsId.js +0 -68
  175. package/src/libs/dataset.js +0 -9
  176. package/src/libs/doi/__tests__/doi.spec.js +0 -24
  177. package/src/libs/redis-pubsub.js +0 -5
  178. package/src/libs/request.js +0 -155
  179. package/src/libs/scitran.js +0 -25
  180. package/src/libs/subscription-server.js +0 -20
  181. package/src/libs/testing-utils.js +0 -17
  182. package/src/persistent/datasets/.gitignore +0 -3
  183. package/src/persistent/temp/.gitignore +0 -3
  184. /package/src/libs/__mocks__/{notifications.js → notifications.ts} +0 -0
  185. /package/src/libs/authentication/{verifyUser.js → verifyUser.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface CounterDocument extends Document {
@@ -10,6 +10,6 @@ const countersSchema = new Schema({
10
10
  sequence_value: { type: Number, default: 0 },
11
11
  })
12
12
 
13
- const Counter = model<CounterDocument>('Counter', countersSchema)
13
+ const Counter = model<CounterDocument>("Counter", countersSchema)
14
14
 
15
15
  export default Counter
@@ -1,11 +1,11 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  // External relations annotating the whole dataset
5
5
  export interface DatasetRelationDocument extends Document {
6
6
  id: string // DOI
7
- relation: 'sameAs' | 'source' | 'derivative'
8
- kind: 'Dataset' | 'Article'
7
+ relation: "sameAs" | "source" | "derivative"
8
+ kind: "Dataset" | "Article"
9
9
  description: string
10
10
  }
11
11
 
@@ -50,29 +50,29 @@ datasetSchema.index({ public: 1 }, { sparse: true })
50
50
 
51
51
  // Foreign key virtuals for sorting
52
52
 
53
- datasetSchema.virtual('uploadUser', {
54
- ref: 'User',
55
- localField: 'uploader',
56
- foreignField: 'id',
53
+ datasetSchema.virtual("uploadUser", {
54
+ ref: "User",
55
+ localField: "uploader",
56
+ foreignField: "id",
57
57
  justOne: true,
58
58
  })
59
59
 
60
- datasetSchema.virtual('stars', {
61
- ref: 'Star',
62
- localField: 'id',
63
- foreignField: 'datasetId',
60
+ datasetSchema.virtual("stars", {
61
+ ref: "Star",
62
+ localField: "id",
63
+ foreignField: "datasetId",
64
64
  count: true,
65
65
  justOne: true,
66
66
  })
67
67
 
68
- datasetSchema.virtual('subscriptions', {
69
- ref: 'Subscription',
70
- localField: 'id',
71
- foreignField: 'datasetId',
68
+ datasetSchema.virtual("subscriptions", {
69
+ ref: "Subscription",
70
+ localField: "id",
71
+ foreignField: "datasetId",
72
72
  count: true,
73
73
  justOne: true,
74
74
  })
75
75
 
76
- const Dataset = model<DatasetDocument>('Dataset', datasetSchema)
76
+ const Dataset = model<DatasetDocument>("Dataset", datasetSchema)
77
77
 
78
78
  export default Dataset
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface DeletionDocument extends Document {
@@ -18,9 +18,9 @@ const deletion = new Schema(
18
18
  reason: String,
19
19
  redirect: String,
20
20
  },
21
- { timestamps: { createdAt: 'created_at' } },
21
+ { timestamps: { createdAt: "created_at" } },
22
22
  )
23
23
 
24
- const Deletion = model<DeletionDocument>('Deletion', deletion)
24
+ const Deletion = model<DeletionDocument>("Deletion", deletion)
25
25
 
26
26
  export default Deletion
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface DeprecatedSnapshotDocument extends Document {
@@ -27,7 +27,7 @@ const deprecatedSnapshotSchema = new Schema({
27
27
  deprecatedSnapshotSchema.index({ datasetId: 1 })
28
28
 
29
29
  const Snapshot = model<DeprecatedSnapshotDocument>(
30
- 'DeprecatedSnapshot',
30
+ "DeprecatedSnapshot",
31
31
  deprecatedSnapshotSchema,
32
32
  )
33
33
 
package/src/models/doi.ts CHANGED
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface DoiDocument extends Document {
@@ -13,6 +13,6 @@ const doiSchema = new Schema({
13
13
  doi: String,
14
14
  })
15
15
 
16
- const Doi = model<DoiDocument>('Doi', doiSchema)
16
+ const Doi = model<DoiDocument>("Doi", doiSchema)
17
17
 
18
18
  export default Doi
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface FileDocument extends Document {
@@ -13,6 +13,6 @@ const fileSchema = new Schema({
13
13
  files: Array,
14
14
  })
15
15
 
16
- const File = model<FileDocument>('File', fileSchema)
16
+ const File = model<FileDocument>("File", fileSchema)
17
17
 
18
18
  export default File
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Model for ingest of new datasets from a remote URL (zip/tarball)
3
3
  */
4
- import mongoose, { Document, ObjectId } from 'mongoose'
4
+ import mongoose, { Document, ObjectId } from "mongoose"
5
5
  const { Schema, model } = mongoose
6
- import { validateUrl } from '../utils/validateUrl'
6
+ import { validateUrl } from "../utils/validateUrl"
7
7
 
8
8
  export interface IngestDatasetDocument extends Document {
9
9
  _id: ObjectId
@@ -21,14 +21,14 @@ const ingestDatasetSchema = new Schema({
21
21
  required: true,
22
22
  validate: {
23
23
  validator: validateUrl,
24
- message: 'Must be a valid HTTPS URL',
24
+ message: "Must be a valid HTTPS URL",
25
25
  },
26
26
  },
27
27
  imported: { type: Boolean, required: true, default: false },
28
28
  })
29
29
 
30
30
  const IngestDataset = model<IngestDatasetDocument>(
31
- 'IngestDataset',
31
+ "IngestDataset",
32
32
  ingestDatasetSchema,
33
33
  )
34
34
 
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface IssueDocument extends Document {
@@ -21,6 +21,6 @@ const issueSchema = new Schema({
21
21
  },
22
22
  })
23
23
 
24
- const Issue = model<IssueDocument>('Issue', issueSchema)
24
+ const Issue = model<IssueDocument>("Issue", issueSchema)
25
25
 
26
26
  export default Issue
package/src/models/key.ts CHANGED
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface KeyDocument extends Document {
@@ -11,6 +11,6 @@ const keySchema = new Schema({
11
11
  hash: String,
12
12
  })
13
13
 
14
- const Key = model<KeyDocument>('Key', keySchema)
14
+ const Key = model<KeyDocument>("Key", keySchema)
15
15
 
16
16
  export default Key
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface MailgunIdentifierDocument extends Document {
@@ -10,7 +10,7 @@ const mailgunIdentifierSchema = new Schema({
10
10
  })
11
11
 
12
12
  const MailgunIdentifier = model<MailgunIdentifierDocument>(
13
- 'MailgunIdentifier',
13
+ "MailgunIdentifier",
14
14
  mailgunIdentifierSchema,
15
15
  )
16
16
 
@@ -1,5 +1,5 @@
1
- import uuid from 'uuid'
2
- import mongoose, { Document } from 'mongoose'
1
+ import uuid from "uuid"
2
+ import mongoose, { Document } from "mongoose"
3
3
  const { Schema, model } = mongoose
4
4
 
5
5
  export interface MetadataDocument extends Document {
@@ -56,6 +56,6 @@ const metadataSchema = new Schema({
56
56
 
57
57
  metadataSchema.index({ datasetId: 1 }, { unique: true })
58
58
 
59
- const Metadata = model<MetadataDocument>('Metadata', metadataSchema)
59
+ const Metadata = model<MetadataDocument>("Metadata", metadataSchema)
60
60
 
61
61
  export default Metadata
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface NewsletterDocument extends Document {
@@ -10,12 +10,12 @@ export interface NewsletterDocument extends Document {
10
10
  const newsletterSchema = new Schema({
11
11
  created: { type: Date, default: Date.now },
12
12
  email: {
13
- type: 'string',
13
+ type: "string",
14
14
  required: true,
15
15
  unique: true,
16
16
  },
17
17
  })
18
18
 
19
- const Newsletter = model<NewsletterDocument>('Newsletter', newsletterSchema)
19
+ const Newsletter = model<NewsletterDocument>("Newsletter", newsletterSchema)
20
20
 
21
21
  export default Newsletter
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface NotificationDocument extends Document {
@@ -72,7 +72,7 @@ const notificationSchema = new Schema({
72
72
  })
73
73
 
74
74
  const Notification = model<NotificationDocument>(
75
- 'Notification',
75
+ "Notification",
76
76
  notificationSchema,
77
77
  )
78
78
 
@@ -1,18 +1,18 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface PermissionDocument extends Document {
5
5
  datasetId: string
6
6
  userId: string
7
- level: 'ro' | 'rw' | 'admin'
7
+ level: "ro" | "rw" | "admin"
8
8
  }
9
9
 
10
10
  const permissionSchema = new Schema({
11
11
  datasetId: { type: String, required: true },
12
12
  userId: { type: String, required: true },
13
- level: { type: String, required: true, enum: ['ro', 'rw', 'admin'] },
13
+ level: { type: String, required: true, enum: ["ro", "rw", "admin"] },
14
14
  })
15
15
 
16
- const Permission = model<PermissionDocument>('Permission', permissionSchema)
16
+ const Permission = model<PermissionDocument>("Permission", permissionSchema)
17
17
 
18
18
  export default Permission
@@ -1,5 +1,5 @@
1
- import uuid from 'uuid'
2
- import mongoose, { Document } from 'mongoose'
1
+ import uuid from "uuid"
2
+ import mongoose, { Document } from "mongoose"
3
3
  const { Schema, model } = mongoose
4
4
 
5
5
  export interface ReviewerDocument extends Document {
@@ -19,13 +19,13 @@ const reviewerSchema = new Schema({
19
19
  creator: { type: String },
20
20
  })
21
21
 
22
- reviewerSchema.virtual('creatorUser', {
23
- ref: 'User',
24
- localField: 'creator',
25
- foreignField: 'id',
22
+ reviewerSchema.virtual("creatorUser", {
23
+ ref: "User",
24
+ localField: "creator",
25
+ foreignField: "id",
26
26
  justOne: true,
27
27
  })
28
28
 
29
- const Reviewer = model<ReviewerDocument>('Reviewer', reviewerSchema)
29
+ const Reviewer = model<ReviewerDocument>("Reviewer", reviewerSchema)
30
30
 
31
31
  export default Reviewer
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface SnapshotDocument extends Document {
@@ -19,6 +19,6 @@ const snapshotSchema = new Schema({
19
19
  snapshotSchema.index({ datasetId: 1, tag: 1 }, { unique: true })
20
20
  snapshotSchema.index({ datasetId: 1 })
21
21
 
22
- const Snapshot = model<SnapshotDocument>('Snapshot', snapshotSchema)
22
+ const Snapshot = model<SnapshotDocument>("Snapshot", snapshotSchema)
23
23
 
24
24
  export default Snapshot
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface StarDocument extends Document {
@@ -11,13 +11,13 @@ const starSchema = new Schema({
11
11
  userId: { type: String, required: true },
12
12
  })
13
13
 
14
- starSchema.virtual('user', {
15
- ref: 'User',
16
- localField: 'userId',
17
- foreignField: 'id',
14
+ starSchema.virtual("user", {
15
+ ref: "User",
16
+ localField: "userId",
17
+ foreignField: "id",
18
18
  justOne: true,
19
19
  })
20
20
 
21
- const Star = model<StarDocument>('Star', starSchema)
21
+ const Star = model<StarDocument>("Star", starSchema)
22
22
 
23
23
  export default Star
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface SubscriptionDocument extends Document {
@@ -12,7 +12,7 @@ const subscriptionSchema = new Schema({
12
12
  })
13
13
 
14
14
  const Subscription = model<SubscriptionDocument>(
15
- 'Subscription',
15
+ "Subscription",
16
16
  subscriptionSchema,
17
17
  )
18
18
 
@@ -1,4 +1,4 @@
1
- import mongoose, { Document } from 'mongoose'
1
+ import mongoose, { Document } from "mongoose"
2
2
  const { Schema, model } = mongoose
3
3
 
4
4
  export interface SummaryPetField {
@@ -59,6 +59,6 @@ const summarySchema = new Schema({
59
59
 
60
60
  summarySchema.index({ id: 1 })
61
61
 
62
- const Summary = model<SummaryDocument>('Summary', summarySchema)
62
+ const Summary = model<SummaryDocument>("Summary", summarySchema)
63
63
 
64
64
  export default Summary
@@ -1,5 +1,5 @@
1
- import uuid from 'uuid'
2
- import mongoose, { Document } from 'mongoose'
1
+ import uuid from "uuid"
2
+ import mongoose, { Document } from "mongoose"
3
3
  const { Schema, model } = mongoose
4
4
 
5
5
  export interface UploadDocument extends Document {
@@ -21,6 +21,6 @@ const uploadSchema = new Schema({
21
21
  complete: { type: Boolean, default: false, required: true },
22
22
  })
23
23
 
24
- const Upload = model<UploadDocument>('Upload', uploadSchema)
24
+ const Upload = model<UploadDocument>("Upload", uploadSchema)
25
25
 
26
26
  export default Upload
@@ -1,5 +1,5 @@
1
- import uuid from 'uuid'
2
- import mongoose, { Document } from 'mongoose'
1
+ import uuid from "uuid"
2
+ import mongoose, { Document } from "mongoose"
3
3
  const { Schema, model } = mongoose
4
4
 
5
5
  export interface UserDocument extends Document {
@@ -36,12 +36,12 @@ userSchema.index(
36
36
  { email: 1 },
37
37
  {
38
38
  collation: {
39
- locale: 'en',
39
+ locale: "en",
40
40
  strength: 2,
41
41
  },
42
42
  },
43
43
  )
44
44
 
45
- const User = model<UserDocument>('User', userSchema)
45
+ const User = model<UserDocument>("User", userSchema)
46
46
 
47
47
  export default User