diff --git a/server/src/api/models/record.ts b/server/src/api/models/record.ts index 3590209..80afede 100644 --- a/server/src/api/models/record.ts +++ b/server/src/api/models/record.ts @@ -1,4 +1,5 @@ import mongoose, { Document, Schema } from "mongoose"; +import { TRecordType } from "../../utils/types"; interface IRecord extends Document { cloudflareID: string; @@ -8,7 +9,7 @@ interface IRecord extends Document { ownerID: string; name: string; content: string; - type: string; + type: TRecordType; created_at: Date; updated_at: Date; } diff --git a/server/src/api/models/user.ts b/server/src/api/models/user.ts index 3e31947..553b26c 100644 --- a/server/src/api/models/user.ts +++ b/server/src/api/models/user.ts @@ -4,7 +4,8 @@ interface IUser extends Document { phoneNumber: string; firebaseUID: string; email: string; - stripeCustomerId: string; + stripeCustomerID: string; + razorpayCustomerID: string; onWaitlist: boolean; } @@ -19,7 +20,8 @@ const userScheme: Schema = new mongoose.Schema({ }, firebaseUID: { type: String, required: true, unique: true }, email: { type: String, required: false }, - stripeCustomerId: { type: String, required: false }, + stripeCustomerID: { type: String, required: false }, + razorpayCustomerID: { type: String, required: false }, onWaitlist: { type: Boolean, required: true, default: false }, }); diff --git a/server/src/api/routes/plan.ts b/server/src/api/routes/plan.ts index ba5cfad..b0e8493 100644 --- a/server/src/api/routes/plan.ts +++ b/server/src/api/routes/plan.ts @@ -104,7 +104,10 @@ router.get( ); router.post("/webhook", (req: Request, res: Response) => { - console.log(req.body); + if (req.body.event === "subscription.charged") { + const subscriptionEntity = req.body.payload.subscription.entity; + console.log({ ...subscriptionEntity }); + } res.status(200).send("ok"); });