tg_stat_bot/apps/bot/src/model/user.ts

24 lines
617 B
TypeScript

import mongoose from 'mongoose';
export type IUser = {
id: number;
username: string | undefined;
firstName: string;
lastName: string | undefined;
isBot: boolean;
isPremium: boolean;
role: string; // 'member' | 'administrator' | 'creator';
}
export const UserSchema = new mongoose.Schema<IUser>(
{
id: { type: Number, required: true },
username: { type: String, required: true },
firstName: { type: String },
lastName: { type: String },
isBot: { type: Boolean, required: true },
isPremium: { type: Boolean, required: true },
role: { type: String, required: true },
}
);