pl4y-data-library
Version:
This library contains the dtos, enums, schemas, and other data objects needed in the pl4y ecosystem.
61 lines (59 loc) • 1.41 kB
text/typescript
import mongoose from "mongoose";
import { TenantType } from "../enums/tenant-types.enum";
export const TenantSchema = new mongoose.Schema(
{
name: {
type: String,
},
email: {
type: String,
required: true,
unique: true,
},
phone: {
type: String,
},
ownerId: {
type: String,
},
tenantId: {
type: String,
},
tenantType: {
type: String,
enum: [TenantType.STORE, TenantType.TEACHING, TenantType.BLOG],
default: TenantType.STORE,
},
hasShippingAddress: {
type: Boolean,
default: false,
},
membership: {
type: String,
default: "basic",
},
homePageOriginURL: {
// redirect from google oauth to tenant's home page
type: String,
required: true,
},
user: {
type: mongoose.Schema.Types.ObjectId,
ref: "User",
},
supportEmail: {
type: String,
},
businessAddress: {
type: mongoose.Schema.Types.ObjectId,
ref: "Address",
},
},
{
timestamps: true,
toJSON: { virtuals: true },
toObject: {
virtuals: true,
},
},
);