mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
- Updated TelemetryException model with example values for Project, Telemetry Service, Exception Message, Stack Trace, Exception Type, Finger Print, Created by User, and more. - Enhanced TelemetryIngestionKey model with example values for Project, Name, Description, Created by User, and more. - Improved TelemetryUsageBilling model with example values for Project, Day, Product Type, Data Ingested, Total Cost, and more. - Added example values to UserCall model for Project ID, Phone, User ID, Created by User ID, and more. - Included example values in UserEmail model for Project ID, Email, User ID, Created by User ID, and more. - Updated UserNotificationRule model with example values for Project ID, User ID, Created by User ID, and various notification types. - Enhanced UserNotificationSetting model with example values for Project ID, User ID, and various notification settings. - Improved UserOnCallLog model with example values for User ID, Project ID, On-Call Policy ID, and more. - Added example values to UserSMS model for Project ID, Phone, User ID, Created by User ID, and more.
125 lines
3.3 KiB
TypeScript
125 lines
3.3 KiB
TypeScript
import User from "./User";
|
|
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
import Route from "../../Types/API/Route";
|
|
import URL from "../../Types/API/URL";
|
|
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
import ColumnType from "../../Types/Database/ColumnType";
|
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
import TableColumn from "../../Types/Database/TableColumn";
|
|
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
import IconProp from "../../Types/Icon/IconProp";
|
|
import ObjectID from "../../Types/ObjectID";
|
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
|
|
@TableAccessControl({
|
|
create: [],
|
|
read: [],
|
|
delete: [],
|
|
update: [],
|
|
})
|
|
@CrudApiEndpoint(new Route("/short-link"))
|
|
@Entity({
|
|
name: "ShortLink",
|
|
})
|
|
@TableMetadata({
|
|
tableName: "ShortLink",
|
|
singularName: "Short Link",
|
|
pluralName: "Short Links",
|
|
icon: IconProp.Link,
|
|
tableDescription:
|
|
"Short links are used to redirect users to a specific long link in OneUptime.",
|
|
})
|
|
export default class ShortLink extends BaseModel {
|
|
@ColumnAccessControl({
|
|
create: [],
|
|
read: [],
|
|
update: [],
|
|
})
|
|
@Index()
|
|
@TableColumn({
|
|
required: true,
|
|
type: TableColumnType.ShortText,
|
|
title: "Short Link ID",
|
|
description: "Random ID for the short link",
|
|
canReadOnRelationQuery: false,
|
|
example: "abc123xyz",
|
|
})
|
|
@Column({
|
|
nullable: false,
|
|
type: ColumnType.ShortText,
|
|
length: ColumnLength.ShortText,
|
|
})
|
|
public shortId?: string = undefined;
|
|
|
|
@ColumnAccessControl({
|
|
create: [],
|
|
read: [],
|
|
update: [],
|
|
})
|
|
@TableColumn({
|
|
required: true,
|
|
type: TableColumnType.LongURL,
|
|
title: "Long URL",
|
|
description: "Long URL to redirect to",
|
|
canReadOnRelationQuery: false,
|
|
example: "https://example.com/redirect/to/this/long/url",
|
|
})
|
|
@Column({
|
|
nullable: false,
|
|
type: ColumnType.LongURL,
|
|
transformer: URL.getDatabaseTransformer(),
|
|
})
|
|
public link?: URL = undefined;
|
|
|
|
@ColumnAccessControl({
|
|
create: [],
|
|
read: [],
|
|
update: [],
|
|
})
|
|
@TableColumn({
|
|
manyToOneRelationColumn: "deletedByUserId",
|
|
type: TableColumnType.Entity,
|
|
title: "Deleted by User",
|
|
modelType: User,
|
|
description:
|
|
"Relation to User who deleted this object (if this object was deleted by a User)",
|
|
example: "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
|
|
})
|
|
@ManyToOne(
|
|
() => {
|
|
return User;
|
|
},
|
|
{
|
|
cascade: false,
|
|
eager: false,
|
|
nullable: true,
|
|
onDelete: "SET NULL",
|
|
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)",
|
|
example: "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
|
|
})
|
|
@Column({
|
|
type: ColumnType.ObjectID,
|
|
nullable: true,
|
|
transformer: ObjectID.getDatabaseTransformer(),
|
|
})
|
|
public deletedByUserId?: ObjectID = undefined;
|
|
}
|