feat: add terms acceptance timestamp tracking and migration script

This commit is contained in:
Marco Beretta 2025-11-30 23:53:23 +01:00
parent 299efc2ccb
commit 7b2ebe4bdd
No known key found for this signature in database
GPG key ID: D918033D8E74CC11
10 changed files with 134 additions and 4 deletions

View file

@ -26,6 +26,7 @@ const ALLOWED_USER_FIELDS = [
'emailVerified',
'twoFactorEnabled',
'termsAccepted',
'termsAcceptedAt',
] as const;
type AllowedUserField = (typeof ALLOWED_USER_FIELDS)[number];

View file

@ -655,6 +655,7 @@ export type TCustomConfigSpeechResponse = { [key: string]: string };
export type TUserTermsResponse = {
termsAccepted: boolean;
termsAcceptedAt: Date | string | null;
};
export type TAcceptTermsResponse = {

View file

@ -132,6 +132,10 @@ const userSchema = new Schema<IUser>(
type: Boolean,
default: false,
},
termsAcceptedAt: {
type: Date,
default: null,
},
personalization: {
type: {
memories: {

View file

@ -31,6 +31,7 @@ export interface IUser extends Document {
}>;
expiresAt?: Date;
termsAccepted?: boolean;
termsAcceptedAt?: Date | null;
personalization?: {
memories?: boolean;
};
@ -68,6 +69,7 @@ export interface UpdateUserRequest {
plugins?: string[];
twoFactorEnabled?: boolean;
termsAccepted?: boolean;
termsAcceptedAt?: Date | null;
personalization?: {
memories?: boolean;
};