This commit is contained in:
root 2020-07-14 21:58:55 +00:00
parent 0f50ac2947
commit 666943d4f1
15 changed files with 3330 additions and 158 deletions

View file

@ -29,40 +29,48 @@ class AllowedString extends mongoose.SchemaType {
// @ts-ignore
mongoose.Schema.Types['AllowedString'] = AllowedString
const ScheduleIntervalBoundary = new Schema({
const ScheduleIntervalBoundary = {
hour: { type: Number },
minute: { type: Number }
})
}
const Media = new Schema({
location: { type: String, required: true },
bucket: { type: String },
key: { type: String },
const Media = {
location: { type: String },
type: {
type: AllowedString,
name: 'MediaType',
allowedValues: ['cover', 'thumbnail', 'video', 'image']
}
})
},
key: { type: String },
contentType: { type: String }
}
const OrganizationVersion = new Schema({
name: { type: String, required: true },
descriptionShort: { type: String, required: true },
descriptionLong: { type: String, required: true },
thumbnail: { type: Media, required: true },
gallery: [{ type: Media }],
cover: { type: Media },
contacts: [{
name: { type: String, required: true },
type: { type: String, required: true }, // (facebook,twitter,instagram,website,address,person,email,phone)
content: { type: String, required: true },
}],
const OrganizationVersion = {
name: { type: String },
descriptionShort: { type: String },
descriptionLong: { type: String },
thumbnail: Media,
gallery: [Media],
cover: Media,
// (facebook,twitter,instagram,website,address,person,email,phone)
contacts: {
facebook: { type: String },
twitter: { type: String },
instagram: { type: String },
website: { type: String },
address: { type: String },
person: { type: String },
email: { type: String },
phone: { type: String }
},
schedule: [{
name: { type: String, required: true },
description: { type: String },
day: { type: String }, // (Mon,Tue,Wed,Thu,Fri,Sat,Sun)
from: { type: ScheduleIntervalBoundary, required: true },
to: { type: ScheduleIntervalBoundary, required: true }
when: [{
day: { type: String }, // (Lundi,Mardi,Mercredi,Jeudi,Vendredi,Samedi,Dimanche)
from: ScheduleIntervalBoundary,
to: ScheduleIntervalBoundary
}]
}],
pricing: [{
name: { type: String, required: true },
@ -70,12 +78,13 @@ const OrganizationVersion = new Schema({
description: { type: String }
}],
tag: { type: Tag }
})
}
const Organization = new Schema({
adminName: { type: String, required: true },
email: { type: String, required: true },
token: { type: String, required: true },
slug: { type: String, required: true },
validationState: {
type: AllowedString,
required: true,
@ -84,8 +93,8 @@ const Organization = new Schema({
allowedValues: ['none', 'pending', 'rejected', 'published']
},
rejectionDescription: { type: String },
proposedVersion: { type: OrganizationVersion },
publishedVersion: { type: OrganizationVersion },
proposedVersion: OrganizationVersion,
publishedVersion: OrganizationVersion,
createdAt: { type: Date },
updatedAt: { type: Date },
publishedAt: { type: Date },