Skip to content

Commit

Permalink
Add Plan Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
yash22arora committed May 19, 2024
1 parent 65faca7 commit d65f85c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 16 additions & 0 deletions server/api/models/plan.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const mongoose = require("mongoose");

const planSchema = mongoose.Schema({
_id: mongoose.Schema.Types.ObjectId,
ownerID: { type: String, required: true, ref: "User" },
domainID: { type: String, required: true, ref: "Domain" },
planType: { type: String, required: true },
expiry: { type: Date, required: true },
stripeSubscriptionId: { type: String, required: true, default: "x" },
records: { type: Array, default: [] },
created_at: { type: Date, default: Date.now },
});

const Plan = mongoose.model("Plan", planSchema);

module.exports = { Plan };
7 changes: 4 additions & 3 deletions server/api/models/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ const recordSchema = mongoose.Schema({
cloudflareId: { type: String, required: true, default: "x" },
cloudflareZoneId: { type: String, required: true, default: "x" },
domainID: { type: String, required: true, ref: "Domain" },
stripeSubscriptionId: { type: String, required: true, default: "x" },
planId: { type: String, required: true, ref: "Plan" },
stripeSubscriptionId: { type: String, required: true, default: "x" }, //TODO: remove this
ownerID: { type: String, required: true, ref: "User" },
name: { type: String, required: true, unique: true },
content: { type: String, required: true },
type: { type: String, required: true },
plan: { type: String, required: true },
expiry: { type: Date, required: true },
plan: { type: String, required: true }, // TODO: remove this
expiry: { type: Date, required: true }, // TODO: remove this
status: { type: String, default: "processing" },
created_at: { type: Date, default: Date.now },
updated_at: { type: Date, default: Date.now },
Expand Down

0 comments on commit d65f85c

Please sign in to comment.