mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-11 12:05:33 +08:00
Revise landing messaging and add news feed
This commit is contained in:
25
server/models/RoadmapSuggestion.ts
Normal file
25
server/models/RoadmapSuggestion.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import mongoose from 'mongoose'
|
||||
|
||||
export interface RoadmapSuggestionDocument extends mongoose.Document {
|
||||
title: string
|
||||
details: string
|
||||
email?: string
|
||||
allowContact: boolean
|
||||
consentPrivacy: boolean
|
||||
submittedAt: Date
|
||||
}
|
||||
|
||||
const roadmapSuggestionSchema = new mongoose.Schema<RoadmapSuggestionDocument>({
|
||||
title: { type: String, required: true, trim: true, maxlength: 160 },
|
||||
details: { type: String, required: true, trim: true, maxlength: 4000 },
|
||||
email: { type: String, trim: true, lowercase: true },
|
||||
allowContact: { type: Boolean, default: false },
|
||||
consentPrivacy: { type: Boolean, default: false },
|
||||
submittedAt: { type: Date, default: () => new Date() },
|
||||
})
|
||||
|
||||
roadmapSuggestionSchema.index({ submittedAt: -1 })
|
||||
|
||||
export const RoadmapSuggestion =
|
||||
(mongoose.models.RoadmapSuggestion as mongoose.Model<RoadmapSuggestionDocument> | undefined) ||
|
||||
mongoose.model<RoadmapSuggestionDocument>('RoadmapSuggestion', roadmapSuggestionSchema)
|
||||
32
server/models/UpdateSubscriber.ts
Normal file
32
server/models/UpdateSubscriber.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import mongoose from 'mongoose'
|
||||
|
||||
export interface UpdateSubscriberDocument extends mongoose.Document {
|
||||
email: string
|
||||
name?: string
|
||||
source: string
|
||||
consentPrivacy: boolean
|
||||
consentMarketing: boolean
|
||||
subscribedAt: Date
|
||||
lastUpdatedAt: Date
|
||||
}
|
||||
|
||||
const updateSubscriberSchema = new mongoose.Schema<UpdateSubscriberDocument>({
|
||||
email: { type: String, required: true, lowercase: true, trim: true, unique: true },
|
||||
name: { type: String, trim: true },
|
||||
source: { type: String, default: 'landing-updates' },
|
||||
consentPrivacy: { type: Boolean, default: false },
|
||||
consentMarketing: { type: Boolean, default: false },
|
||||
subscribedAt: { type: Date, default: () => new Date() },
|
||||
lastUpdatedAt: { type: Date, default: () => new Date() },
|
||||
})
|
||||
|
||||
updateSubscriberSchema.pre('save', function updateTimestamp(this: UpdateSubscriberDocument, next) {
|
||||
if (this.isModified()) {
|
||||
this.set('lastUpdatedAt', new Date())
|
||||
}
|
||||
next()
|
||||
})
|
||||
|
||||
export const UpdateSubscriber =
|
||||
(mongoose.models.UpdateSubscriber as mongoose.Model<UpdateSubscriberDocument> | undefined) ||
|
||||
mongoose.model<UpdateSubscriberDocument>('UpdateSubscriber', updateSubscriberSchema)
|
||||
@@ -9,6 +9,8 @@ export interface WaitlistEntryDocument extends mongoose.Document {
|
||||
consentTerms: boolean
|
||||
joinedAt: Date
|
||||
activatedAt?: Date
|
||||
wantsProductUpdates?: boolean
|
||||
updatesOptedInAt?: Date
|
||||
}
|
||||
|
||||
const waitlistSchema = new mongoose.Schema<WaitlistEntryDocument>({
|
||||
@@ -20,6 +22,8 @@ const waitlistSchema = new mongoose.Schema<WaitlistEntryDocument>({
|
||||
consentTerms: { type: Boolean, default: false },
|
||||
joinedAt: { type: Date, default: () => new Date() },
|
||||
activatedAt: { type: Date },
|
||||
wantsProductUpdates: { type: Boolean, default: false },
|
||||
updatesOptedInAt: { type: Date },
|
||||
})
|
||||
|
||||
export const WaitlistEntry =
|
||||
|
||||
Reference in New Issue
Block a user