mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
new selfhosted version
This commit is contained in:
26
shared_global/schema/PremiumSchema.ts
Normal file
26
shared_global/schema/PremiumSchema.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { model, Schema, Types } from 'mongoose';
|
||||
|
||||
export type TPremium = {
|
||||
user_id: Schema.Types.ObjectId,
|
||||
premium_type: number,
|
||||
customer_id: string,
|
||||
subscription_id: string,
|
||||
expire_at: number,
|
||||
payment_failed?: boolean,
|
||||
plan_cancelled?: boolean,
|
||||
created_at: Date,
|
||||
}
|
||||
|
||||
const PremiumSchema = new Schema<TPremium>({
|
||||
user_id: { type: Types.ObjectId, unique: true, index: 1 },
|
||||
customer_id: { type: String },
|
||||
premium_type: { type: Number },
|
||||
subscription_id: { type: String },
|
||||
expire_at: { type: Number },
|
||||
payment_failed: { type: Boolean },
|
||||
plan_cancelled: { type: Boolean },
|
||||
created_at: { type: Date, default: () => Date.now() }
|
||||
})
|
||||
|
||||
export const PremiumModel = model<TPremium>('premiums', PremiumSchema);
|
||||
|
||||
Reference in New Issue
Block a user