|
|
@@ -0,0 +1,45 @@
|
|
|
+import mongoose, {
|
|
|
+ Document, Schema
|
|
|
+} from "mongoose";
|
|
|
+
|
|
|
+export interface IRecommendedProduct extends Document {
|
|
|
+ userID: mongoose.Types.ObjectId;
|
|
|
+ productID: mongoose.Types.ObjectId;
|
|
|
+ description?: string;
|
|
|
+ isActive: boolean;
|
|
|
+ createdAt: Date;
|
|
|
+ updatedAt: Date;
|
|
|
+ title: string;
|
|
|
+ delay: number;
|
|
|
+}
|
|
|
+
|
|
|
+const recommendedProductSchema = new Schema<IRecommendedProduct>(
|
|
|
+ {
|
|
|
+ userID: {
|
|
|
+ type: Schema.Types.ObjectId,
|
|
|
+ ref: "User", // TODO aggregate fonk kullanılacak ref değil
|
|
|
+ },
|
|
|
+ productID: {
|
|
|
+ type: Schema.Types.ObjectId,
|
|
|
+ ref: "Product", // TODO aggregate fonk kullanılacak ref değil
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ type: String,
|
|
|
+ },
|
|
|
+ description: {
|
|
|
+ type: String,
|
|
|
+ },
|
|
|
+ delay: {
|
|
|
+ type: Number,
|
|
|
+ },
|
|
|
+ isActive: {
|
|
|
+ type: Boolean,
|
|
|
+ default: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ timestamps: true
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
+export const RecommendedProduct = mongoose.model<IRecommendedProduct>("RecommendedProduct", recommendedProductSchema);
|