Initial reader-api backend extracted from reader

This commit is contained in:
2026-03-24 13:55:10 +07:00
parent 56f8f5ccfc
commit 24f070d14e
69 changed files with 12167 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
import mongoose, { Document, Schema } from "mongoose"
export interface IUserRecommendation extends Document {
userId: string
novelId: string
createdAt: Date
updatedAt: Date
}
const UserRecommendationSchema: Schema = new Schema(
{
userId: { type: String, required: true, index: true },
novelId: { type: String, required: true, index: true },
},
{
timestamps: true,
}
)
UserRecommendationSchema.index({ userId: 1, novelId: 1 }, { unique: true })
UserRecommendationSchema.index({ createdAt: -1 })
export const UserRecommendation =
mongoose.models.UserRecommendation ||
mongoose.model<IUserRecommendation>("UserRecommendation", UserRecommendationSchema)