Files
2026-07-26 18:25:37 +09:00

241 lines
7.1 KiB
JavaScript

function _ts_decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function _ts_metadata(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
}
import { Entity, Index, JoinColumn, ManyToOne, Column, PrimaryColumn } from "typeorm";
import { User } from "./user.js";
import { id } from "../id.js";
import { Note } from "./note.js";
import { FollowRequest } from "./follow-request.js";
import { UserGroupInvitation } from "./user-group-invitation.js";
import { AccessToken } from "./access-token.js";
import { notificationTypes } from "../../types.js";
import { Bite } from "./bite.js";
export let Notification = class Notification {
id;
createdAt;
/**
* Notification Recipient ID
*/ notifieeId;
notifiee;
/**
* Notification sender (initiator)
*/ notifierId;
notifier;
/**
* Notification types:
* follow - Follow request
* mention - User was referenced in a post.
* reply - A post that a user made (or was watching) has been replied to.
* renote - A post that a user made (or was watching) has been renoted.
* quote - A post that a user made (or was watching) has been quoted and renoted.
* reaction - (自分または自分がWatchしている)投稿にリアクションされた
* pollVote - (自分または自分がWatchしている)投稿のアンケートに投票された
* pollEnded - 自分のアンケートもしくは自分が投票したアンケートが終了した
* receiveFollowRequest - フォローリクエストされた
* followRequestAccepted - A follow request has been accepted.
* groupInvited - グループに招待された
* app - App notifications.
*/ type;
/**
* Whether the notification was read.
*/ isRead;
noteId;
note;
followRequestId;
followRequest;
userGroupInvitationId;
userGroupInvitation;
reaction;
choice;
/**
* App notification body
*/ customBody;
/**
* App notification header
* (If omitted, it is expected to be displayed with the app name)
*/ customHeader;
/**
* App notification icon (URL)
* (If omitted, it is expected to be displayed as an app icon)
*/ customIcon;
/**
* App notification app (token for)
*/ appAccessTokenId;
appAccessToken;
biteId;
bite;
};
_ts_decorate([
PrimaryColumn(id()),
_ts_metadata("design:type", String)
], Notification.prototype, "id", void 0);
_ts_decorate([
Index(),
Column("timestamp with time zone", {
comment: "The created date of the Notification."
}),
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
], Notification.prototype, "createdAt", void 0);
_ts_decorate([
Index(),
Column({
...id(),
comment: "The ID of recipient user of the Notification."
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "notifieeId", void 0);
_ts_decorate([
ManyToOne((type)=>User, {
onDelete: "CASCADE"
}),
JoinColumn(),
_ts_metadata("design:type", Object)
], Notification.prototype, "notifiee", void 0);
_ts_decorate([
Index(),
Column({
...id(),
nullable: true,
comment: "The ID of sender user of the Notification."
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "notifierId", void 0);
_ts_decorate([
ManyToOne((type)=>User, {
onDelete: "CASCADE"
}),
JoinColumn(),
_ts_metadata("design:type", Object)
], Notification.prototype, "notifier", void 0);
_ts_decorate([
Index(),
Column("enum", {
enum: notificationTypes,
comment: "The type of the Notification."
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "type", void 0);
_ts_decorate([
Index(),
Column("boolean", {
default: false,
comment: "Whether the notification was read."
}),
_ts_metadata("design:type", Boolean)
], Notification.prototype, "isRead", void 0);
_ts_decorate([
Column({
...id(),
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "noteId", void 0);
_ts_decorate([
ManyToOne((type)=>Note, {
onDelete: "CASCADE"
}),
JoinColumn(),
_ts_metadata("design:type", Object)
], Notification.prototype, "note", void 0);
_ts_decorate([
Column({
...id(),
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "followRequestId", void 0);
_ts_decorate([
ManyToOne((type)=>FollowRequest, {
onDelete: "CASCADE"
}),
JoinColumn(),
_ts_metadata("design:type", Object)
], Notification.prototype, "followRequest", void 0);
_ts_decorate([
Column({
...id(),
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "userGroupInvitationId", void 0);
_ts_decorate([
ManyToOne((type)=>UserGroupInvitation, {
onDelete: "CASCADE"
}),
JoinColumn(),
_ts_metadata("design:type", Object)
], Notification.prototype, "userGroupInvitation", void 0);
_ts_decorate([
Column("varchar", {
length: 128,
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "reaction", void 0);
_ts_decorate([
Column("integer", {
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "choice", void 0);
_ts_decorate([
Column("varchar", {
length: 2048,
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "customBody", void 0);
_ts_decorate([
Column("varchar", {
length: 256,
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "customHeader", void 0);
_ts_decorate([
Column("varchar", {
length: 1024,
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "customIcon", void 0);
_ts_decorate([
Index(),
Column({
...id(),
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "appAccessTokenId", void 0);
_ts_decorate([
ManyToOne((type)=>AccessToken, {
onDelete: "CASCADE"
}),
JoinColumn(),
_ts_metadata("design:type", Object)
], Notification.prototype, "appAccessToken", void 0);
_ts_decorate([
Index(),
Column({
...id(),
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "biteId", void 0);
_ts_decorate([
ManyToOne((type)=>Bite, {
onDelete: "CASCADE",
nullable: true
}),
_ts_metadata("design:type", Object)
], Notification.prototype, "bite", void 0);
Notification = _ts_decorate([
Entity()
], Notification);