diff --git a/Common/Types/Icon/IconProp.ts b/Common/Types/Icon/IconProp.ts index b344240f37..cf0a6dbc7d 100644 --- a/Common/Types/Icon/IconProp.ts +++ b/Common/Types/Icon/IconProp.ts @@ -94,6 +94,8 @@ enum IconProp { TransparentCube = 'TransparentCube', Logs = 'Logs', Bolt = 'Bolt', + BarsArrowUp = 'BarsArrowUp', + BarsArrowDown = 'BarsArrowDown', } export default IconProp; diff --git a/CommonUI/src/Components/Icon/Icon.tsx b/CommonUI/src/Components/Icon/Icon.tsx index 60fb3a0e6f..f91382c136 100644 --- a/CommonUI/src/Components/Icon/Icon.tsx +++ b/CommonUI/src/Components/Icon/Icon.tsx @@ -421,6 +421,20 @@ const Icon: FunctionComponent = ({ d="M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418" /> ); + } else if (icon === IconProp.BarsArrowDown) { + return getSvgWrapper( + + + + + ); + } else if (icon === IconProp.BarsArrowUp) { + return getSvgWrapper( + + + + + ); } else if (icon === IconProp.CheckCircle) { return getSvgWrapper( = ( id="on-call-duty-table" isDeleteable={false} name="On Call > Policies" - isEditable={true} + isEditable={false} isCreateable={true} isViewable={true} cardProps={{ diff --git a/Dashboard/src/Pages/OnCallDuty/OnCallDutyPolicy/SideMenu.tsx b/Dashboard/src/Pages/OnCallDuty/OnCallDutyPolicy/SideMenu.tsx index ccf58efe74..c9a4c343f5 100644 --- a/Dashboard/src/Pages/OnCallDuty/OnCallDutyPolicy/SideMenu.tsx +++ b/Dashboard/src/Pages/OnCallDuty/OnCallDutyPolicy/SideMenu.tsx @@ -30,26 +30,40 @@ const DashboardSideMenu: FunctionComponent = ( /> + + + + + + - - - = { ), [PageMap.ON_CALL_DUTY_POLICY_VIEW]: new Route( - `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies${RouteParams.ModelID}` + `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies/${RouteParams.ModelID}` ), [PageMap.ON_CALL_DUTY_POLICY_VIEW_DELETE]: new Route( - `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies${RouteParams.ModelID}/delete` + `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies/${RouteParams.ModelID}/delete` ), [PageMap.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOGS]: new Route( - `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies${RouteParams.ModelID}/execution-logs/${RouteParams.SubModelID}` + `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies/${RouteParams.ModelID}/execution-logs/${RouteParams.SubModelID}` ), [PageMap.ON_CALL_DUTY_POLICY_VIEW_EXECUTION_LOG_VIEW]: new Route( - `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies${RouteParams.ModelID}/execution-logs/` + `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies/${RouteParams.ModelID}/execution-logs/` ), [PageMap.ON_CALL_DUTY_POLICY_VIEW_ESCALATION]: new Route( - `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies${RouteParams.ModelID}/escalations` + `/dashboard/${RouteParams.ProjectID}/on-call-duty/policies/${RouteParams.ModelID}/escalations` ), [PageMap.REPORTS]: new Route( diff --git a/Model/Models/UserCall.ts b/Model/Models/UserCall.ts new file mode 100644 index 0000000000..116a388ba5 --- /dev/null +++ b/Model/Models/UserCall.ts @@ -0,0 +1,306 @@ +import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm'; +import ColumnType from 'Common/Types/Database/ColumnType'; +import ColumnLength from 'Common/Types/Database/ColumnLength'; +import TableColumn from 'Common/Types/Database/TableColumn'; +import CrudApiEndpoint from 'Common/Types/Database/CrudApiEndpoint'; +import Route from 'Common/Types/API/Route'; +import TableColumnType from 'Common/Types/Database/TableColumnType'; +import TableAccessControl from 'Common/Types/Database/AccessControl/TableAccessControl'; +import Permission from 'Common/Types/Permission'; +import ColumnAccessControl from 'Common/Types/Database/AccessControl/ColumnAccessControl'; +import CurrentUserCanAccessRecordBy from 'Common/Types/Database/CurrentUserCanAccessRecordBy'; +import TableMetadata from 'Common/Types/Database/TableMetadata'; +import IconProp from 'Common/Types/Icon/IconProp'; +import AllowAccessIfSubscriptionIsUnpaid from 'Common/Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid'; +import ObjectID from 'Common/Types/ObjectID'; +import BaseModel from 'Common/Models/BaseModel'; +import User from './User'; +import Phone from 'Common/Types/Phone'; +import Project from './Project'; + +@AllowAccessIfSubscriptionIsUnpaid() +@TableAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + delete: [Permission.CurrentUser], + update: [Permission.CurrentUser], +}) +@CrudApiEndpoint(new Route('/user-call')) +@Entity({ + name: 'UserCall', +}) +@TableMetadata({ + tableName: 'UserCall', + singularName: 'User Phone Number for Calls', + pluralName: 'User Phone Numbers for Calls', + icon: IconProp.Call, + tableDescription: 'Phone Number which will be used for call notifications.', +}) +@CurrentUserCanAccessRecordBy('userId') +class UserCall extends BaseModel { + + @ColumnAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'projectId', + type: TableColumnType.Entity, + modelType: Project, + title: 'Project', + description: + 'Relation to Project Resource in which this object belongs', + }) + @ManyToOne( + (_type: string) => { + return Project; + }, + { + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'projectId' }) + public project?: Project = undefined; + + @ColumnAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @Index() + @TableColumn({ + type: TableColumnType.ObjectID, + required: true, + canReadOnRelationQuery: true, + title: 'Project ID', + description: + 'ID of your OneUptime Project in which this object belongs', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: false, + transformer: ObjectID.getDatabaseTransformer(), + }) + public projectId?: ObjectID = undefined; + + @ColumnAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + title: 'Phone', + required: true, + unique: true, + type: TableColumnType.Phone, + canReadOnRelationQuery: true, + }) + @Column({ + type: ColumnType.Phone, + length: ColumnLength.Phone, + unique: true, + nullable: false, + transformer: Phone.getDatabaseTransformer(), + }) + public phone?: Phone = undefined; + + + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'user', + type: TableColumnType.Entity, + modelType: User, + title: 'User', + description: + 'Relation to User who this email belongs to', + }) + @ManyToOne( + (_type: string) => { + return User; + }, + { + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'userId' }) + public user?: User = undefined; + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + type: TableColumnType.ObjectID, + title: 'User ID', + description: + 'User ID who this email belongs to', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: true, + transformer: ObjectID.getDatabaseTransformer(), + }) + @Index() + public userId?: ObjectID = undefined; + + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'createdByUserId', + type: TableColumnType.Entity, + modelType: User, + title: 'Created by User', + description: + 'Relation to User who created this object (if this object was created by a User)', + }) + @ManyToOne( + (_type: string) => { + return User; + }, + { + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'createdByUserId' }) + public createdByUser?: User = undefined; + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + type: TableColumnType.ObjectID, + title: 'Created by User ID', + description: + 'User ID who created this object (if this object was created by a User)', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: true, + transformer: ObjectID.getDatabaseTransformer(), + }) + public createdByUserId?: ObjectID = undefined; + + @ColumnAccessControl({ + create: [], + read: [], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'deletedByUserId', + type: TableColumnType.Entity, + title: 'Deleted by User', + description: + 'Relation to User who deleted this object (if this object was deleted by a User)', + }) + @ManyToOne( + (_type: string) => { + return User; + }, + { + cascade: false, + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'deletedByUserId' }) + public deletedByUser?: User = undefined; + + @ColumnAccessControl({ + create: [], + read: [], + update: [], + }) + @TableColumn({ + type: TableColumnType.ObjectID, + title: 'Deleted by User ID', + description: + 'User ID who deleted this object (if this object was deleted by a User)', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: true, + transformer: ObjectID.getDatabaseTransformer(), + }) + public deletedByUserId?: ObjectID = undefined; + + + @ColumnAccessControl({ + create: [], + read: [Permission.CurrentUser], + update: [], + }) + @TableColumn({ title: 'Is Verified', + description: + 'Is this verified?',isDefaultValueColumn: true, type: TableColumnType.Boolean }) + @Column({ + type: ColumnType.Boolean, + default: false, + }) + public isVerified?: boolean = undefined; + + + @ColumnAccessControl({ + create: [], + read: [], + update: [], + }) + @TableColumn({ title: 'Verification Code', + description: + 'Temporary Verification Code',isDefaultValueColumn: false, type: TableColumnType.ShortText }) + @Column({ + type: ColumnType.ShortText, + nullable: false, + length: ColumnLength.ShortText, + }) + public verificationCode?: boolean = undefined; +} + +export default UserCall; \ No newline at end of file diff --git a/Model/Models/UserEmail.ts b/Model/Models/UserEmail.ts new file mode 100644 index 0000000000..1ac32ab8e4 --- /dev/null +++ b/Model/Models/UserEmail.ts @@ -0,0 +1,310 @@ +import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm'; +import ColumnType from 'Common/Types/Database/ColumnType'; +import ColumnLength from 'Common/Types/Database/ColumnLength'; +import Email from 'Common/Types/Email'; +import TableColumn from 'Common/Types/Database/TableColumn'; +import CrudApiEndpoint from 'Common/Types/Database/CrudApiEndpoint'; +import Route from 'Common/Types/API/Route'; +import TableColumnType from 'Common/Types/Database/TableColumnType'; +import TableAccessControl from 'Common/Types/Database/AccessControl/TableAccessControl'; +import Permission from 'Common/Types/Permission'; +import ColumnAccessControl from 'Common/Types/Database/AccessControl/ColumnAccessControl'; +import CurrentUserCanAccessRecordBy from 'Common/Types/Database/CurrentUserCanAccessRecordBy'; +import TableMetadata from 'Common/Types/Database/TableMetadata'; +import IconProp from 'Common/Types/Icon/IconProp'; +import AllowAccessIfSubscriptionIsUnpaid from 'Common/Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid'; +import ObjectID from 'Common/Types/ObjectID'; +import BaseModel from 'Common/Models/BaseModel'; +import User from './User'; +import Project from './Project'; + +@AllowAccessIfSubscriptionIsUnpaid() +@TableAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + delete: [Permission.CurrentUser], + update: [Permission.CurrentUser], +}) +@CrudApiEndpoint(new Route('/user-email')) +@Entity({ + name: 'UserEmail', +}) +@TableMetadata({ + tableName: 'UserEmail', + singularName: 'User Email', + pluralName: 'User Emails', + icon: IconProp.Email, + tableDescription: 'Emails which will be used for notifications.', +}) +@CurrentUserCanAccessRecordBy('userId') +class UserEmail extends BaseModel { + + @ColumnAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'projectId', + type: TableColumnType.Entity, + modelType: Project, + title: 'Project', + description: + 'Relation to Project Resource in which this object belongs', + }) + @ManyToOne( + (_type: string) => { + return Project; + }, + { + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'projectId' }) + public project?: Project = undefined; + + @ColumnAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @Index() + @TableColumn({ + type: TableColumnType.ObjectID, + required: true, + canReadOnRelationQuery: true, + title: 'Project ID', + description: + 'ID of your OneUptime Project in which this object belongs', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: false, + transformer: ObjectID.getDatabaseTransformer(), + }) + public projectId?: ObjectID = undefined; + + + @ColumnAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + title: 'Email', + required: true, + unique: true, + type: TableColumnType.Email, + canReadOnRelationQuery: true, + }) + @Column({ + type: ColumnType.Email, + length: ColumnLength.Email, + unique: true, + nullable: false, + transformer: Email.getDatabaseTransformer(), + }) + public email?: Email = undefined; + + + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'user', + type: TableColumnType.Entity, + modelType: User, + title: 'User', + description: + 'Relation to User who this email belongs to', + }) + @ManyToOne( + (_type: string) => { + return User; + }, + { + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'userId' }) + public user?: User = undefined; + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + type: TableColumnType.ObjectID, + title: 'User ID', + description: + 'User ID who this email belongs to', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: true, + transformer: ObjectID.getDatabaseTransformer(), + }) + @Index() + public userId?: ObjectID = undefined; + + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'createdByUserId', + type: TableColumnType.Entity, + modelType: User, + title: 'Created by User', + description: + 'Relation to User who created this object (if this object was created by a User)', + }) + @ManyToOne( + (_type: string) => { + return User; + }, + { + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'createdByUserId' }) + public createdByUser?: User = undefined; + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + type: TableColumnType.ObjectID, + title: 'Created by User ID', + description: + 'User ID who created this object (if this object was created by a User)', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: true, + transformer: ObjectID.getDatabaseTransformer(), + }) + public createdByUserId?: ObjectID = undefined; + + @ColumnAccessControl({ + create: [], + read: [], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'deletedByUserId', + type: TableColumnType.Entity, + title: 'Deleted by User', + description: + 'Relation to User who deleted this object (if this object was deleted by a User)', + }) + @ManyToOne( + (_type: string) => { + return User; + }, + { + cascade: false, + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'deletedByUserId' }) + public deletedByUser?: User = undefined; + + @ColumnAccessControl({ + create: [], + read: [], + update: [], + }) + @TableColumn({ + type: TableColumnType.ObjectID, + title: 'Deleted by User ID', + description: + 'User ID who deleted this object (if this object was deleted by a User)', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: true, + transformer: ObjectID.getDatabaseTransformer(), + }) + public deletedByUserId?: ObjectID = undefined; + + + @ColumnAccessControl({ + create: [], + read: [Permission.CurrentUser], + update: [], + }) + @TableColumn({ title: 'Is Verified', + description: + 'Is this verified?',isDefaultValueColumn: true, type: TableColumnType.Boolean }) + @Column({ + type: ColumnType.Boolean, + default: false, + }) + public isVerified?: boolean = undefined; + + + @ColumnAccessControl({ + create: [], + read: [], + update: [], + }) + @TableColumn({ title: 'Verification Code', + description: + 'Temporary Verification Code',isDefaultValueColumn: false, type: TableColumnType.ShortText }) + @Column({ + type: ColumnType.ShortText, + nullable: false, + length: ColumnLength.ShortText, + }) + public verificationCode?: boolean = undefined; + + + +} + +export default UserEmail; \ No newline at end of file diff --git a/Model/Models/UserNotificationRule.ts b/Model/Models/UserNotificationRule.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Model/Models/UserSMS.ts b/Model/Models/UserSMS.ts new file mode 100644 index 0000000000..cfa524d2bf --- /dev/null +++ b/Model/Models/UserSMS.ts @@ -0,0 +1,307 @@ +import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm'; +import ColumnType from 'Common/Types/Database/ColumnType'; +import ColumnLength from 'Common/Types/Database/ColumnLength'; +import TableColumn from 'Common/Types/Database/TableColumn'; +import CrudApiEndpoint from 'Common/Types/Database/CrudApiEndpoint'; +import Route from 'Common/Types/API/Route'; +import TableColumnType from 'Common/Types/Database/TableColumnType'; +import TableAccessControl from 'Common/Types/Database/AccessControl/TableAccessControl'; +import Permission from 'Common/Types/Permission'; +import ColumnAccessControl from 'Common/Types/Database/AccessControl/ColumnAccessControl'; +import CurrentUserCanAccessRecordBy from 'Common/Types/Database/CurrentUserCanAccessRecordBy'; +import TableMetadata from 'Common/Types/Database/TableMetadata'; +import IconProp from 'Common/Types/Icon/IconProp'; +import AllowAccessIfSubscriptionIsUnpaid from 'Common/Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid'; +import ObjectID from 'Common/Types/ObjectID'; +import BaseModel from 'Common/Models/BaseModel'; +import User from './User'; +import Phone from 'Common/Types/Phone'; +import Project from './Project'; + +@AllowAccessIfSubscriptionIsUnpaid() +@TableAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + delete: [Permission.CurrentUser], + update: [Permission.CurrentUser], +}) +@CrudApiEndpoint(new Route('/user-sms')) +@Entity({ + name: 'UserSMS', +}) +@TableMetadata({ + tableName: 'UserSMS', + singularName: 'User Phone Number for SMS', + pluralName: 'User Phone Number for SMS', + icon: IconProp.SMS, + tableDescription: 'Phone Number which will be used for SMS notifications.', +}) +@CurrentUserCanAccessRecordBy('userId') +class UserSMS extends BaseModel { + + + @ColumnAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'projectId', + type: TableColumnType.Entity, + modelType: Project, + title: 'Project', + description: + 'Relation to Project Resource in which this object belongs', + }) + @ManyToOne( + (_type: string) => { + return Project; + }, + { + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'projectId' }) + public project?: Project = undefined; + + @ColumnAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @Index() + @TableColumn({ + type: TableColumnType.ObjectID, + required: true, + canReadOnRelationQuery: true, + title: 'Project ID', + description: + 'ID of your OneUptime Project in which this object belongs', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: false, + transformer: ObjectID.getDatabaseTransformer(), + }) + public projectId?: ObjectID = undefined; + + @ColumnAccessControl({ + create: [Permission.CurrentUser], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + title: 'Phone', + required: true, + unique: true, + type: TableColumnType.Phone, + canReadOnRelationQuery: true, + }) + @Column({ + type: ColumnType.Phone, + length: ColumnLength.Phone, + unique: true, + nullable: false, + transformer: Phone.getDatabaseTransformer(), + }) + public phone?: Phone = undefined; + + + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'user', + type: TableColumnType.Entity, + modelType: User, + title: 'User', + description: + 'Relation to User who this email belongs to', + }) + @ManyToOne( + (_type: string) => { + return User; + }, + { + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'userId' }) + public user?: User = undefined; + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + type: TableColumnType.ObjectID, + title: 'User ID', + description: + 'User ID who this email belongs to', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: true, + transformer: ObjectID.getDatabaseTransformer(), + }) + @Index() + public userId?: ObjectID = undefined; + + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'createdByUserId', + type: TableColumnType.Entity, + modelType: User, + title: 'Created by User', + description: + 'Relation to User who created this object (if this object was created by a User)', + }) + @ManyToOne( + (_type: string) => { + return User; + }, + { + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'createdByUserId' }) + public createdByUser?: User = undefined; + + @ColumnAccessControl({ + create: [ + Permission.CurrentUser + ], + read: [ + Permission.CurrentUser + ], + update: [], + }) + @TableColumn({ + type: TableColumnType.ObjectID, + title: 'Created by User ID', + description: + 'User ID who created this object (if this object was created by a User)', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: true, + transformer: ObjectID.getDatabaseTransformer(), + }) + public createdByUserId?: ObjectID = undefined; + + @ColumnAccessControl({ + create: [], + read: [], + update: [], + }) + @TableColumn({ + manyToOneRelationColumn: 'deletedByUserId', + type: TableColumnType.Entity, + title: 'Deleted by User', + description: + 'Relation to User who deleted this object (if this object was deleted by a User)', + }) + @ManyToOne( + (_type: string) => { + return User; + }, + { + cascade: false, + eager: false, + nullable: true, + onDelete: 'CASCADE', + orphanedRowAction: 'nullify', + } + ) + @JoinColumn({ name: 'deletedByUserId' }) + public deletedByUser?: User = undefined; + + @ColumnAccessControl({ + create: [], + read: [], + update: [], + }) + @TableColumn({ + type: TableColumnType.ObjectID, + title: 'Deleted by User ID', + description: + 'User ID who deleted this object (if this object was deleted by a User)', + }) + @Column({ + type: ColumnType.ObjectID, + nullable: true, + transformer: ObjectID.getDatabaseTransformer(), + }) + public deletedByUserId?: ObjectID = undefined; + + + @ColumnAccessControl({ + create: [], + read: [Permission.CurrentUser], + update: [], + }) + @TableColumn({ title: 'Is Verified', + description: + 'Is this verified?',isDefaultValueColumn: true, type: TableColumnType.Boolean }) + @Column({ + type: ColumnType.Boolean, + default: false, + }) + public isVerified?: boolean = undefined; + + + @ColumnAccessControl({ + create: [], + read: [], + update: [], + }) + @TableColumn({ title: 'Verification Code', + description: + 'Temporary Verification Code',isDefaultValueColumn: false, type: TableColumnType.ShortText }) + @Column({ + type: ColumnType.ShortText, + nullable: false, + length: ColumnLength.ShortText, + }) + public verificationCode?: boolean = undefined; +} + +export default UserSMS; \ No newline at end of file