Untitled
unknown
plain_text
9 months ago
6.5 kB
6
Indexable
import mongoose, { Schema, Document, Model } from 'mongoose';
import mongoosePaginate from 'mongoose-paginate-v2';
import { Constant } from '../../../constants/dependency_constants';
interface Location {
latitude?: number;
longitude?: number;
}
export interface EventDocument extends Document {
creator?: string;
organization: string;
collectorWallet?: string;
collectorWalletSigners?: string[];
name: string;
description?: string;
currency?: string;
eventType?: string[];
location?: Location;
address?: string;
address2?: string;
countryCode?: string;
maxVisitors?: number;
expectedVisitors?: number;
currentVisitors?: number;
totalTickets?: number;
city?: string;
state?: string;
country?: string;
street?: string;
venue?: string;
tags?: string[];
logoUrl?: string;
imageUrls?: string[];
supportEmail?: string;
supportNumber?: string;
postalCode?: string;
requireCovidHealthForm?: boolean;
enableStripeTerminal?: boolean;
startDate: Date;
endDate: Date;
topupOptions?: number[];
status?: string;
website?: string;
crews?: mongoose.Types.ObjectId[];
teams?: mongoose.Types.ObjectId[];
ticketProvider?: string;
placeId?: string;
url?: string;
url2?: string;
tagline?: string;
registerStep?: number;
activeTicket?: boolean;
activePayment?: boolean;
activeCoupon?: boolean;
activeVip?: boolean;
cancellationMailContent?: string;
cancellationReason?: string;
postponeMailContent?: string;
postponeReason?: string;
scriptDesign?: string;
streetNumber?: string;
coverBgUrl?: string;
activeQrPayment?: boolean;
activeQrPaymentAcceptCash?: boolean;
activeQrPaymentTerminalOnsite?: boolean;
activeWearablePayment?: boolean;
activeWearablePaymentAcceptCash?: boolean;
activeWearablePaymentTerminalOnsite?: boolean;
activeTerminalPayment?: boolean;
activeTerminalPaymentAcceptCash?: boolean;
activeTerminalPaymentTerminalOnsite?: boolean;
vat?: number;
includeVatToPrice?: boolean;
vatOfTicket?: number;
includeVatToTicketPrice?: boolean;
ticketPageId?: string;
}
const LocationSchema = new Schema<Location>({
latitude: { type: Number },
longitude: { type: Number },
});
export const EventSchema = new Schema<EventDocument>(
{
creator: { type: String, index: true, minlength: 56, maxlength: 56 },
organization: { type: String, index: true, required: true },
collectorWallet: { type: String, index: true, maxlength: 56 },
collectorWalletSigners: [{ type: String, index: true, maxlength: 56 }],
name: { type: String, index: true, required: true, trim: true },
description: String,
currency: { type: String, enum: Constant.currencyIsoList },
eventType: [{ type: String, enum: ['Indoor', 'Outdoor', 'Digital', 'Indoor & Outdoor'] }],
location: { type: LocationSchema },
address: String,
address2: String,
countryCode: String,
maxVisitors: Number,
expectedVisitors: Number,
currentVisitors: Number,
totalTickets: Number,
city: String,
state: String,
country: String,
street: String,
venue: { type: String, default: 'Crania' },
tags: [
{
type: String,
enum: [
'music festival', 'concert', 'club night', 'afterparty', 'food festival', 'themed party',
'reunion', 'wedding', 'birthday', 'gaming event', 'sports event', 'corporate', 'seminar',
'conference', 'networking event', 'trade shows', 'workshop', 'auction', 'school party',
'art show', 'dinner show', 'contests and competition', 'exhibitions', 'film festivals',
'private party', 'private event', 'after party',
],
},
],
logoUrl: String,
imageUrls: [String],
supportEmail: String,
supportNumber: String,
postalCode: String,
requireCovidHealthForm: Boolean,
enableStripeTerminal: Boolean,
startDate: { type: Date, required: true },
endDate: { type: Date, required: true },
topupOptions: [Number],
status: { type: String, enum: Object.values(Constant.eventStatuses), default: Constant.eventStatuses.draft },
website: String,
crews: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Crew' }],
teams: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Team' }],
ticketProvider: { type: String, enum: ['EventCHI Ticket', 'External Ticket'] },
placeId: String,
url: { type: String, index: true, unique: true },
url2: { type: String, index: true },
tagline: String,
registerStep: { type: Number, enum: Constant.eventRegisterSteps },
activeTicket: { type: Boolean, default: false },
activePayment: { type: Boolean, default: false },
activeCoupon: { type: Boolean, default: false },
activeVip: { type: Boolean, default: false },
cancellationMailContent: String,
cancellationReason: String,
postponeMailContent: String,
postponeReason: String,
scriptDesign: String,
streetNumber: String,
coverBgUrl: String,
activeQrPayment: { type: Boolean, default: true },
activeQrPaymentAcceptCash: { type: Boolean, default: true },
activeQrPaymentTerminalOnsite: { type: Boolean, default: true },
activeWearablePayment: { type: Boolean, default: true },
activeWearablePaymentAcceptCash: { type: Boolean, default: true },
activeWearablePaymentTerminalOnsite: { type: Boolean, default: true },
activeTerminalPayment: { type: Boolean, default: false },
activeTerminalPaymentAcceptCash: { type: Boolean, default: false },
activeTerminalPaymentTerminalOnsite: { type: Boolean, default: false },
vat: Number,
includeVatToPrice: { type: Boolean, default: false },
vatOfTicket: Number,
includeVatToTicketPrice: { type: Boolean, default: false },
ticketPageId: String,
},
{
timestamps: true,
minimize: false,
}
);
EventSchema.plugin(mongoosePaginate);
// export const Event: Model<EventDocument> = mongoose.model('Event', EventSchema);
Editor is loading...
Leave a Comment