SpaceNinjaServer/src/models/friendModel.ts
Sainan 8c0ff5d150
All checks were successful
Build / build (push) Successful in 58s
Build / build (pull_request) Successful in 1m48s
feat: friends
2025-05-07 10:59:22 +02:00

16 lines
538 B
TypeScript

import { IFriendship } from "@/src/types/friendTypes";
import { model, Schema } from "mongoose";
const friendshipSchema = new Schema<IFriendship>({
owner: { type: Schema.Types.ObjectId, required: true },
friend: { type: Schema.Types.ObjectId, required: true },
Note: String,
Favorite: Boolean
});
friendshipSchema.index({ owner: 1 });
friendshipSchema.index({ friend: 1 });
friendshipSchema.index({ owner: 1, friend: 1 }, { unique: true });
export const Friendship = model<IFriendship>("Friendship", friendshipSchema);