fix subscriber

This commit is contained in:
Simon Larsen
2022-12-14 14:47:23 +00:00
parent 1f2c9871f5
commit c49235bafb
2 changed files with 49 additions and 0 deletions

View File

@@ -15,6 +15,8 @@ import FieldType from 'CommonUI/src/Components/Types/FieldType';
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
import NotNull from 'Common/Types/Database/NotNull';
import StatusPagePreviewLink from './StatusPagePreviewLink';
import { JSONObject } from 'Common/Types/JSON';
import Pill from 'CommonUI/src/Components/Pill/Pill';
// import NotNull from 'Common/Types/Database/NotNull';
const StatusPageDelete: FunctionComponent<PageComponentProps> = (
@@ -119,6 +121,40 @@ const StatusPageDelete: FunctionComponent<PageComponentProps> = (
title: 'Email',
type: FieldType.Email,
},
{
field: {
isUnsubscribed: true,
},
title: 'Status',
type: FieldType.Text,
getElement: (item: JSONObject): ReactElement => {
if (item['isUnsubscribed']) {
return (
<Pill
color={
Red
}
text={
"Unsubscribed"
}
/>
);
} else {
return (
<Pill
color={
Green
}
text={
"Subscribed"
}
/>
);
}
return <></>;
},
},
{
field: {
createdAt: true,

View File

@@ -256,4 +256,17 @@ export default class StatusPageSubscriber extends BaseModel {
)
@JoinColumn({ name: 'deletedByUserId' })
public deletedByUser?: User = undefined;
@ColumnAccessControl({
create: [],
read: [Permission.CurrentUser],
update: [],
})
@TableColumn({ isDefaultValueColumn: true, type: TableColumnType.Boolean })
@Column({
type: ColumnType.Boolean,
default: false,
})
public isUnsubscribed?: boolean = undefined;
}