fix: News now display author

This commit is contained in:
2025-06-13 16:07:11 +02:00
parent 9e420e548e
commit 8fc171b874
3 changed files with 20 additions and 15 deletions

View File

@@ -1,11 +1,12 @@
import mongoose, { Schema } from "mongoose"
import mongoose, { Schema, Types } from "mongoose"
interface INews {
content: string;
title: string;
date: Date;
visible?: boolean;
pinned?: boolean
pinned?: boolean;
author: Types.ObjectId
}
const newsSchema = new Schema<INews>({
@@ -13,7 +14,8 @@ const newsSchema = new Schema<INews>({
title: {type: String, required: true},
date: {type: Date, requred: true, default: Date.now},
visible: {type: Boolean, default: false},
pinned: {type: Boolean, default: false}
pinned: {type: Boolean, default: false},
author: {type: "ObjectId", ref: "logins", required: true}
})
export default mongoose.model("news", newsSchema)