diff --git a/server/src/modules/hublots/schema/hublot-image.schema.ts b/server/src/modules/hublots/schema/hublot-image.schema.ts new file mode 100644 index 0000000..8e7a3fe --- /dev/null +++ b/server/src/modules/hublots/schema/hublot-image.schema.ts @@ -0,0 +1,69 @@ +import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; +import { Document } from "mongoose"; +import { v4 as uuidv4 } from "uuid"; + +@Schema({ + autoCreate: true, + collection: "hublot_images", +}) +export class HublotImage extends Document { + @Prop({ + type: String, + required: true, + default: uuidv4, + }) + id: string; + + @Prop({ + type: String, + required: true, + index: true, + }) + hublotId: string; + + @Prop({ + type: String, + required: true, + }) + caption: string; + + @Prop({ + type: String, + required: true, + }) + imageRef: string; + + @Prop({ + type: Boolean, + required: true, + }) + isProfile: boolean; + + @Prop({ + type: Date, + required: true, + }) + createdAt: Date; + + @Prop({ + type: String, + required: true, + index: true, + }) + createdBy: string; + + toJSON() { + const user = this.toObject(); + user.id = user._id; + delete user._id; + delete user.__v; + return user; + } + + constructor(hublotImage: HublotImage) { + super(); + Object.assign(this, hublotImage); + } +} + +export const HublotImageSchema = SchemaFactory.createForClass(HublotImage); diff --git a/server/src/modules/hublots/schema/hublot-package-item.schema.ts b/server/src/modules/hublots/schema/hublot-package-item.schema.ts new file mode 100644 index 0000000..3d6aa5c --- /dev/null +++ b/server/src/modules/hublots/schema/hublot-package-item.schema.ts @@ -0,0 +1,72 @@ +import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; +import { v4 as uuidv4 } from "uuid"; +import { Document } from "mongoose"; + +@Schema({ + autoCreate: true, + collection: "hublot_package_items", +}) +export class HublotPackageItem extends Document { + @Prop({ + type: String, + required: true, + default: uuidv4, + unique: true, + }) + id: string; + + @Prop({ + type: String, + required: true, + index: true, + }) + hublotId: string; + + @Prop({ + type: String, + required: true, + index: true, + }) + hublotPackageId: string; + + @Prop({ + type: String, + required: true, + }) + value: string; + + @Prop({ + type: String, + required: true, + }) + name: string; + + @Prop({ + type: Date, + required: true, + }) + createdAt: Date; + + @Prop({ + type: String, + required: true, + index: true, + }) + createdBy: string; + + toJSON() { + const user = this.toObject(); + user.id = user._id; + delete user._id; + delete user.__v; + return user; + } + + constructor(hublotPackageItem: HublotPackageItem) { + super(); + Object.assign(this, hublotPackageItem); + } +} + +export const HublotPackageItemSchema = + SchemaFactory.createForClass(HublotPackageItem); diff --git a/server/src/modules/hublots/schema/hublot-package.schema.ts b/server/src/modules/hublots/schema/hublot-package.schema.ts new file mode 100644 index 0000000..bee2689 --- /dev/null +++ b/server/src/modules/hublots/schema/hublot-package.schema.ts @@ -0,0 +1,64 @@ +import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; +import { v4 as uuidv4 } from "uuid"; +import { Document } from "mongoose"; + +@Schema({ + autoCreate: true, + collection: "hublot_packages", +}) +export class HublotPackage extends Document { + @Prop({ + type: String, + required: true, + default: uuidv4, + unique: true, + }) + id: string; + + @Prop({ + type: String, + required: true, + index: true, + }) + hublotId: string; + + @Prop({ + type: Number, + required: true, + }) + price: number; + + @Prop({ + type: String, + required: true, + }) + name: string; + + @Prop({ + type: Date, + required: true, + }) + createdAt: Date; + + @Prop({ + type: String, + required: true, + index: true, + }) + createdBy: string; + + toJSON() { + const user = this.toObject(); + user.id = user._id; + delete user._id; + delete user.__v; + return user; + } + + constructor(hublotPackage: HublotPackage) { + super(); + Object.assign(this, hublotPackage); + } +} + +export const HublotPackageSchema = SchemaFactory.createForClass(HublotPackage); diff --git a/server/src/modules/hublots/schema/hublot.schema.ts b/server/src/modules/hublots/schema/hublot.schema.ts new file mode 100644 index 0000000..4885dcd --- /dev/null +++ b/server/src/modules/hublots/schema/hublot.schema.ts @@ -0,0 +1,55 @@ +import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; +import { Document } from "mongoose"; +import { v4 as uuidv4 } from "uuid"; + +@Schema({ + autoCreate: true, + collection: "hublots", +}) +export class Hublot extends Document { + @Prop({ + type: String, + unique: true, + default: uuidv4, + required: true, + }) + id: string; + + @Prop({ type: String, required: true }) + name: string; + + @Prop({ type: String, required: true }) + location: string; + + @Prop({ + type: Boolean, + default: false, + required: true, + }) + isVerified: boolean; + + @Prop({ + type: Date, + default: new Date(), + required: true, + }) + createdAt: Date; + + @Prop({ type: String, required: true }) + createdBy: string; + + toJSON() { + const user = this.toObject(); + user.id = user._id; + delete user._id; + delete user.__v; + return user; + } + + constructor(hublot: Hublot) { + super(); + Object.assign(this, hublot); + } +} + +export const HublotSchema = SchemaFactory.createForClass(Hublot);