feat: add permanent option context var (unit tests fail)

This commit is contained in:
medtaher
2024-09-23 00:27:15 +01:00
parent 7115426432
commit 6e8a2a3d48
4 changed files with 50 additions and 3 deletions

View File

@@ -28,6 +28,12 @@ export class ContextVar extends BaseSchema {
match: /^[a-z_0-9]+$/,
})
name: string;
@Prop({
type: Boolean,
default: false,
})
permanent?: boolean;
}
export const ContextVarModel: ModelDefinition = {

View File

@@ -19,6 +19,7 @@ import { TFilterPopulateFields } from '@/utils/types/filter.types';
import { Label } from './label.schema';
import { ChannelData } from './types/channel';
import { SubscriberContext } from './types/subscriberContext';
@Schema({ timestamps: true })
export class SubscriberStub extends BaseSchema {
@@ -107,6 +108,12 @@ export class SubscriberStub extends BaseSchema {
default: null,
})
avatar?: unknown;
@Prop({
type: Object,
default: { vars: {} }, //TODO: add this to the migration
})
context?: SubscriberContext;
}
@Schema({ timestamps: true })

View File

@@ -0,0 +1,3 @@
export interface SubscriberContext {
[key: string]: any;
}