| 1 | import { Document, model, Schema } from "mongoose"; |
| 2 | |
| 3 | export interface IUser extends Document { |
| 4 | googleId: string; |
| 5 | email: string; |
| 6 | displayName: string; |
| 7 | profilePicture: string; |
| 8 | isPremium: boolean; |
| 9 | } |
| 10 | |
| 11 | const UserSchema: Schema = new Schema({ |
| 12 | googleId: { type: String, required: true, unique: true }, |
| 13 | email: { type: String, required: true, unique: true }, |
| 14 | displayName: { type: String, required: true }, |
| 15 | profilePicture: { type: String }, |
| 16 | isPremium: { type: Boolean, default: false }, |
| 17 | }); |
| 18 | |
| 19 | export default model<IUser>("User", UserSchema); |