mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 15:24:55 +00:00
fix note
This commit is contained in:
parent
eb11563c08
commit
dacd659307
@ -24,6 +24,7 @@ enum ColumnType {
|
||||
SmallNumber = 'smallint',
|
||||
Number = 'integer',
|
||||
BigNumber = 'bigint',
|
||||
Markdown = 'text',
|
||||
}
|
||||
|
||||
export default ColumnType;
|
||||
|
@ -92,10 +92,10 @@ enum Permission {
|
||||
CanDeleteIncidentInternalNote = 'CanDeleteIncidentInternalNote',
|
||||
CanReadIncidentInternalNote = 'CanReadIncidentInternalNote',
|
||||
|
||||
CanCreateIncidentStatusPageNote = 'CanCreateIncidentStatusPageNote',
|
||||
CanEditIncidentStatusPageNote = 'CanEditIncidentStatusPageNote',
|
||||
CanDeleteIncidentStatusPageNote = 'CanDeleteIncidentStatusPageNote',
|
||||
CanReadIncidentStatusPageNote = 'CanReadIncidentStatusPageNote',
|
||||
CanCreateIncidentPublicNote = 'CanCreateIncidentPublicNote',
|
||||
CanEditIncidentPublicNote = 'CanEditIncidentPublicNote',
|
||||
CanDeleteIncidentPublicNote = 'CanDeleteIncidentPublicNote',
|
||||
CanReadIncidentPublicNote = 'CanReadIncidentPublicNote',
|
||||
|
||||
CanCreateProjectMonitor = 'CanCreateProjectMonitor',
|
||||
CanEditProjectMonitor = 'CanEditProjectMonitor',
|
||||
@ -561,28 +561,28 @@ export class PermissionHelper {
|
||||
|
||||
|
||||
{
|
||||
permission: Permission.CanCreateIncidentStatusPageNote,
|
||||
permission: Permission.CanCreateIncidentPublicNote,
|
||||
title: 'Can Create Incident Status Page Note',
|
||||
description:
|
||||
'A user assigned this permission can create Incident Status Page Note this project.',
|
||||
isAssignableToProject: true,
|
||||
},
|
||||
{
|
||||
permission: Permission.CanDeleteIncidentStatusPageNote,
|
||||
permission: Permission.CanDeleteIncidentPublicNote,
|
||||
title: 'Can Delete Incident Status Page Note',
|
||||
description:
|
||||
'A user assigned this permission can delete Incident Status Page Note of this project.',
|
||||
isAssignableToProject: true,
|
||||
},
|
||||
{
|
||||
permission: Permission.CanEditIncidentStatusPageNote,
|
||||
permission: Permission.CanEditIncidentPublicNote,
|
||||
title: 'Can Edit Incident Status Page Note',
|
||||
description:
|
||||
'A user assigned this permission can edit Incident Status Page Note of this project.',
|
||||
isAssignableToProject: true,
|
||||
},
|
||||
{
|
||||
permission: Permission.CanReadIncidentStatusPageNote,
|
||||
permission: Permission.CanReadIncidentPublicNote,
|
||||
title: 'Can Read Incident Status Page Note',
|
||||
description:
|
||||
'A user assigned this permission can read Incident Status Page Note of this project.',
|
||||
|
227
Model/Models/IncidentInternalNote.ts
Normal file
227
Model/Models/IncidentInternalNote.ts
Normal file
@ -0,0 +1,227 @@
|
||||
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
||||
import BaseModel from 'Common/Models/BaseModel';
|
||||
import User from './User';
|
||||
import Project from './Project';
|
||||
import CrudApiEndpoint from 'Common/Types/Database/CrudApiEndpoint';
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import TableColumnType from 'Common/Types/Database/TableColumnType';
|
||||
import TableColumn from 'Common/Types/Database/TableColumn';
|
||||
import ColumnType from 'Common/Types/Database/ColumnType';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import TableAccessControl from 'Common/Types/Database/AccessControl/TableAccessControl';
|
||||
import Permission from 'Common/Types/Permission';
|
||||
import ColumnAccessControl from 'Common/Types/Database/AccessControl/ColumnAccessControl';
|
||||
import TenantColumn from 'Common/Types/Database/TenantColumn';
|
||||
import SingularPluralName from 'Common/Types/Database/SingularPluralName';
|
||||
import Incident from './Incident';
|
||||
|
||||
@TenantColumn('projectId')
|
||||
@TableAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentInternalNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentInternalNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
delete: [Permission.ProjectOwner, Permission.CanDeleteIncidentInternalNote],
|
||||
update: [Permission.ProjectOwner, Permission.CanEditIncidentInternalNote],
|
||||
})
|
||||
@CrudApiEndpoint(new Route('/incident-internal-note'))
|
||||
@Entity({
|
||||
name: 'IncidentInternalNote',
|
||||
})
|
||||
@SingularPluralName('Internal Note', 'Internal Notes')
|
||||
export default class IncidentInternalNote extends BaseModel {
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentInternalNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentInternalNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({
|
||||
manyToOneRelationColumn: 'projectId',
|
||||
type: TableColumnType.Entity,
|
||||
modelType: Project,
|
||||
})
|
||||
@ManyToOne(
|
||||
(_type: string) => {
|
||||
return Project;
|
||||
},
|
||||
{
|
||||
eager: false,
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
orphanedRowAction: 'nullify',
|
||||
}
|
||||
)
|
||||
@JoinColumn({ name: 'projectId' })
|
||||
public project?: Project = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentInternalNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentInternalNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@Index()
|
||||
@TableColumn({ type: TableColumnType.ObjectID, required: true })
|
||||
@Column({
|
||||
type: ColumnType.ObjectID,
|
||||
nullable: false,
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public projectId?: ObjectID = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentInternalNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentInternalNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({
|
||||
manyToOneRelationColumn: 'incidentId',
|
||||
type: TableColumnType.Entity,
|
||||
modelType: Incident,
|
||||
})
|
||||
@ManyToOne(
|
||||
(_type: string) => {
|
||||
return Incident;
|
||||
},
|
||||
{
|
||||
eager: false,
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
orphanedRowAction: 'nullify',
|
||||
}
|
||||
)
|
||||
@JoinColumn({ name: 'incidentId' })
|
||||
public incident?: Incident = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentInternalNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentInternalNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@Index()
|
||||
@TableColumn({ type: TableColumnType.ObjectID, required: true })
|
||||
@Column({
|
||||
type: ColumnType.ObjectID,
|
||||
nullable: false,
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public incidentId?: ObjectID = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentInternalNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentInternalNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({
|
||||
manyToOneRelationColumn: 'createdByUserId',
|
||||
type: TableColumnType.Entity,
|
||||
modelType: Project,
|
||||
})
|
||||
@ManyToOne(
|
||||
(_type: string) => {
|
||||
return User;
|
||||
},
|
||||
{
|
||||
eager: false,
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
orphanedRowAction: 'nullify',
|
||||
}
|
||||
)
|
||||
@JoinColumn({ name: 'createdByUserId' })
|
||||
public createdByUser?: User = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentInternalNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentInternalNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({ type: TableColumnType.ObjectID })
|
||||
@Column({
|
||||
type: ColumnType.ObjectID,
|
||||
nullable: true,
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public createdByUserId?: ObjectID = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [],
|
||||
read: [],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({
|
||||
manyToOneRelationColumn: 'deletedByUserId',
|
||||
type: TableColumnType.ObjectID,
|
||||
})
|
||||
@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: [Permission.ProjectMember],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({ type: TableColumnType.ObjectID })
|
||||
@Column({
|
||||
type: ColumnType.ObjectID,
|
||||
nullable: true,
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public deletedByUserId?: ObjectID = undefined;
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentInternalNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentInternalNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [ Permission.ProjectOwner, Permission.CanEditIncidentInternalNote,],
|
||||
})
|
||||
@TableColumn({ type: TableColumnType.ShortText })
|
||||
@Column({
|
||||
type: ColumnType.Markdown,
|
||||
nullable: false,
|
||||
unique: false,
|
||||
})
|
||||
public note?: string = undefined;
|
||||
|
||||
}
|
227
Model/Models/IncidentPublicNote.ts
Normal file
227
Model/Models/IncidentPublicNote.ts
Normal file
@ -0,0 +1,227 @@
|
||||
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
||||
import BaseModel from 'Common/Models/BaseModel';
|
||||
import User from './User';
|
||||
import Project from './Project';
|
||||
import CrudApiEndpoint from 'Common/Types/Database/CrudApiEndpoint';
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import TableColumnType from 'Common/Types/Database/TableColumnType';
|
||||
import TableColumn from 'Common/Types/Database/TableColumn';
|
||||
import ColumnType from 'Common/Types/Database/ColumnType';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import TableAccessControl from 'Common/Types/Database/AccessControl/TableAccessControl';
|
||||
import Permission from 'Common/Types/Permission';
|
||||
import ColumnAccessControl from 'Common/Types/Database/AccessControl/ColumnAccessControl';
|
||||
import TenantColumn from 'Common/Types/Database/TenantColumn';
|
||||
import SingularPluralName from 'Common/Types/Database/SingularPluralName';
|
||||
import Incident from './Incident';
|
||||
|
||||
@TenantColumn('projectId')
|
||||
@TableAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentPublicNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentPublicNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
delete: [Permission.ProjectOwner, Permission.CanDeleteIncidentPublicNote],
|
||||
update: [Permission.ProjectOwner, Permission.CanEditIncidentPublicNote],
|
||||
})
|
||||
@CrudApiEndpoint(new Route('/incident-public-note'))
|
||||
@Entity({
|
||||
name: 'IncidentPublicNote',
|
||||
})
|
||||
@SingularPluralName('Public Note', 'Public Notes')
|
||||
export default class IncidentPublicNote extends BaseModel {
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentPublicNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentPublicNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({
|
||||
manyToOneRelationColumn: 'projectId',
|
||||
type: TableColumnType.Entity,
|
||||
modelType: Project,
|
||||
})
|
||||
@ManyToOne(
|
||||
(_type: string) => {
|
||||
return Project;
|
||||
},
|
||||
{
|
||||
eager: false,
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
orphanedRowAction: 'nullify',
|
||||
}
|
||||
)
|
||||
@JoinColumn({ name: 'projectId' })
|
||||
public project?: Project = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentPublicNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentPublicNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@Index()
|
||||
@TableColumn({ type: TableColumnType.ObjectID, required: true })
|
||||
@Column({
|
||||
type: ColumnType.ObjectID,
|
||||
nullable: false,
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public projectId?: ObjectID = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentPublicNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentPublicNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({
|
||||
manyToOneRelationColumn: 'incidentId',
|
||||
type: TableColumnType.Entity,
|
||||
modelType: Incident,
|
||||
})
|
||||
@ManyToOne(
|
||||
(_type: string) => {
|
||||
return Incident;
|
||||
},
|
||||
{
|
||||
eager: false,
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
orphanedRowAction: 'nullify',
|
||||
}
|
||||
)
|
||||
@JoinColumn({ name: 'incidentId' })
|
||||
public incident?: Incident = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentPublicNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentPublicNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@Index()
|
||||
@TableColumn({ type: TableColumnType.ObjectID, required: true })
|
||||
@Column({
|
||||
type: ColumnType.ObjectID,
|
||||
nullable: false,
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public incidentId?: ObjectID = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentPublicNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentPublicNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({
|
||||
manyToOneRelationColumn: 'createdByUserId',
|
||||
type: TableColumnType.Entity,
|
||||
modelType: Project,
|
||||
})
|
||||
@ManyToOne(
|
||||
(_type: string) => {
|
||||
return User;
|
||||
},
|
||||
{
|
||||
eager: false,
|
||||
nullable: true,
|
||||
onDelete: 'CASCADE',
|
||||
orphanedRowAction: 'nullify',
|
||||
}
|
||||
)
|
||||
@JoinColumn({ name: 'createdByUserId' })
|
||||
public createdByUser?: User = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentPublicNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentPublicNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({ type: TableColumnType.ObjectID })
|
||||
@Column({
|
||||
type: ColumnType.ObjectID,
|
||||
nullable: true,
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public createdByUserId?: ObjectID = undefined;
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [],
|
||||
read: [],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({
|
||||
manyToOneRelationColumn: 'deletedByUserId',
|
||||
type: TableColumnType.ObjectID,
|
||||
})
|
||||
@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: [Permission.ProjectMember],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({ type: TableColumnType.ObjectID })
|
||||
@Column({
|
||||
type: ColumnType.ObjectID,
|
||||
nullable: true,
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public deletedByUserId?: ObjectID = undefined;
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [Permission.ProjectOwner, Permission.CanCreateIncidentPublicNote],
|
||||
read: [
|
||||
Permission.ProjectOwner,
|
||||
Permission.CanReadIncidentPublicNote,
|
||||
Permission.ProjectMember,
|
||||
],
|
||||
update: [ Permission.ProjectOwner, Permission.CanEditIncidentPublicNote,],
|
||||
})
|
||||
@TableColumn({ type: TableColumnType.ShortText })
|
||||
@Column({
|
||||
type: ColumnType.Markdown,
|
||||
nullable: false,
|
||||
unique: false,
|
||||
})
|
||||
public note?: string = undefined;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user