mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
refactoring dashboard
This commit is contained in:
20
shared_global/schema/ApiSettingsSchema.ts
Normal file
20
shared_global/schema/ApiSettingsSchema.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { model, Schema, Types } from 'mongoose';
|
||||
|
||||
export type TApiSettings = {
|
||||
_id: Schema.Types.ObjectId,
|
||||
project_id: Schema.Types.ObjectId,
|
||||
apiKey: string,
|
||||
apiName: string,
|
||||
usage: number,
|
||||
created_at: Date
|
||||
}
|
||||
|
||||
const ApiSettingsSchema = new Schema<TApiSettings>({
|
||||
project_id: { type: Types.ObjectId, index: 1 },
|
||||
apiKey: { type: String, required: true },
|
||||
apiName: { type: String, required: true },
|
||||
usage: { type: Number, default: 0, required: true, },
|
||||
created_at: { type: Date, default: () => Date.now() },
|
||||
});
|
||||
|
||||
export const ApiSettingsModel = model<TApiSettings>('api_settings', ApiSettingsSchema);
|
||||
Reference in New Issue
Block a user