Adding features
This commit is contained in:
parent
600fef2b7c
commit
2b55ca4104
75 changed files with 9796 additions and 2759 deletions
|
|
@ -1,46 +1,125 @@
|
|||
// server/models/member.js
|
||||
import mongoose from 'mongoose'
|
||||
import { resolve } from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
import mongoose from "mongoose";
|
||||
import { resolve } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
// Import configs using dynamic imports to avoid build issues
|
||||
const getValidCircleValues = () => ['community', 'founder', 'practitioner']
|
||||
const getValidContributionValues = () => ['0', '5', '15', '30', '50']
|
||||
const getValidCircleValues = () => ["community", "founder", "practitioner"];
|
||||
const getValidContributionValues = () => ["0", "5", "15", "30", "50"];
|
||||
|
||||
const memberSchema = new mongoose.Schema({
|
||||
email: { type: String, required: true, unique: true },
|
||||
name: { type: String, required: true },
|
||||
circle: {
|
||||
type: String,
|
||||
circle: {
|
||||
type: String,
|
||||
enum: getValidCircleValues(),
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
contributionTier: {
|
||||
type: String,
|
||||
enum: getValidContributionValues(),
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
status: {
|
||||
type: String,
|
||||
enum: ['pending_payment', 'active', 'suspended', 'cancelled'],
|
||||
default: 'pending_payment'
|
||||
enum: ["pending_payment", "active", "suspended", "cancelled"],
|
||||
default: "pending_payment",
|
||||
},
|
||||
helcimCustomerId: String,
|
||||
helcimSubscriptionId: String,
|
||||
paymentMethod: {
|
||||
type: String,
|
||||
enum: ['card', 'bank', 'none'],
|
||||
default: 'none'
|
||||
enum: ["card", "bank", "none"],
|
||||
default: "none",
|
||||
},
|
||||
subscriptionStartDate: Date,
|
||||
subscriptionEndDate: Date,
|
||||
nextBillingDate: Date,
|
||||
slackInvited: { type: Boolean, default: false },
|
||||
slackInviteStatus: {
|
||||
type: String,
|
||||
enum: ["pending", "sent", "failed", "accepted"],
|
||||
default: "pending",
|
||||
},
|
||||
slackUserId: String,
|
||||
|
||||
// Profile fields
|
||||
pronouns: String,
|
||||
timeZone: String,
|
||||
avatar: String,
|
||||
studio: String,
|
||||
bio: String,
|
||||
skills: [String],
|
||||
location: String,
|
||||
socialLinks: {
|
||||
mastodon: String,
|
||||
linkedin: String,
|
||||
website: String,
|
||||
other: String,
|
||||
},
|
||||
offering: String,
|
||||
lookingFor: String,
|
||||
showInDirectory: { type: Boolean, default: true },
|
||||
|
||||
// Privacy settings for profile fields
|
||||
privacy: {
|
||||
pronouns: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "members",
|
||||
},
|
||||
timeZone: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "members",
|
||||
},
|
||||
avatar: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "public",
|
||||
},
|
||||
studio: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "members",
|
||||
},
|
||||
bio: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "members",
|
||||
},
|
||||
skills: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "members",
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "members",
|
||||
},
|
||||
socialLinks: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "members",
|
||||
},
|
||||
offering: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "members",
|
||||
},
|
||||
lookingFor: {
|
||||
type: String,
|
||||
enum: ["public", "members", "private"],
|
||||
default: "members",
|
||||
},
|
||||
},
|
||||
|
||||
createdAt: { type: Date, default: Date.now },
|
||||
lastLogin: Date
|
||||
})
|
||||
lastLogin: Date,
|
||||
});
|
||||
|
||||
// Check if model already exists to prevent re-compilation in development
|
||||
export default mongoose.models.Member || mongoose.model('Member', memberSchema)
|
||||
export default mongoose.models.Member || mongoose.model("Member", memberSchema);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue