Files
FrozenFriendsYume/packages/backend/built/models/entities/user.js
T
2026-07-26 18:25:37 +09:00

426 lines
12 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, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from "typeorm";
import { id } from "../id.js";
import { DriveFile } from "./drive-file.js";
export let User = class User {
id;
createdAt;
updatedAt;
lastFetchedAt;
lastActiveDate;
hideOnlineStatus;
username;
usernameLower;
name;
followersCount;
followingCount;
movedToUri;
alsoKnownAs;
notesCount;
avatarId;
avatarUrl;
avatarBlurhash;
avatar;
bannerId;
bannerUrl;
bannerBlurhash;
banner;
tags;
isSuspended;
isSilenced;
isLocked;
isBot;
isCat;
speakAsCat;
isAdmin;
isModerator;
isVerified;
minorBadges;
isExplorable;
// アカウントが削除されたかどうかのフラグだが、完全に削除される際は物理削除なので実質削除されるまでの「削除が進行しているかどうか」のフラグ
isDeleted;
emojis;
host;
inbox;
sharedInbox;
featured;
uri;
followersUri;
token;
driveCapacityOverrideMb;
canBite;
constructor(data){
if (data == null) return;
for (const [k, v] of Object.entries(data)){
this[k] = v;
}
}
};
_ts_decorate([
PrimaryColumn(id()),
_ts_metadata("design:type", String)
], User.prototype, "id", void 0);
_ts_decorate([
Index(),
Column("timestamp with time zone", {
comment: "The created date of the User."
}),
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
], User.prototype, "createdAt", void 0);
_ts_decorate([
Index(),
Column("timestamp with time zone", {
nullable: true,
comment: "The updated date of the User."
}),
_ts_metadata("design:type", Object)
], User.prototype, "updatedAt", void 0);
_ts_decorate([
Column("timestamp with time zone", {
nullable: true
}),
_ts_metadata("design:type", Object)
], User.prototype, "lastFetchedAt", void 0);
_ts_decorate([
Index(),
Column("timestamp with time zone", {
nullable: true
}),
_ts_metadata("design:type", Object)
], User.prototype, "lastActiveDate", void 0);
_ts_decorate([
Column("boolean", {
default: false
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "hideOnlineStatus", void 0);
_ts_decorate([
Column("varchar", {
length: 128,
comment: "The username of the User."
}),
_ts_metadata("design:type", String)
], User.prototype, "username", void 0);
_ts_decorate([
Index(),
Column("varchar", {
length: 128,
select: false,
comment: "The username (lowercased) of the User."
}),
_ts_metadata("design:type", String)
], User.prototype, "usernameLower", void 0);
_ts_decorate([
Column("varchar", {
length: 128,
nullable: true,
comment: "The name of the User."
}),
_ts_metadata("design:type", Object)
], User.prototype, "name", void 0);
_ts_decorate([
Column("integer", {
default: 0,
comment: "The count of followers."
}),
_ts_metadata("design:type", Number)
], User.prototype, "followersCount", void 0);
_ts_decorate([
Column("integer", {
default: 0,
comment: "The count of following."
}),
_ts_metadata("design:type", Number)
], User.prototype, "followingCount", void 0);
_ts_decorate([
Column("varchar", {
length: 512,
nullable: true,
comment: "The URI of the new account of the User"
}),
_ts_metadata("design:type", Object)
], User.prototype, "movedToUri", void 0);
_ts_decorate([
Column("simple-array", {
nullable: true,
comment: "URIs the user is known as too"
}),
_ts_metadata("design:type", Object)
], User.prototype, "alsoKnownAs", void 0);
_ts_decorate([
Column("integer", {
default: 0,
comment: "The count of notes."
}),
_ts_metadata("design:type", Number)
], User.prototype, "notesCount", void 0);
_ts_decorate([
Column({
...id(),
nullable: true,
comment: "The ID of avatar DriveFile."
}),
_ts_metadata("design:type", Object)
], User.prototype, "avatarId", void 0);
_ts_decorate([
Column("varchar", {
length: 512,
nullable: true,
comment: "The URL of the avatar DriveFile"
}),
_ts_metadata("design:type", Object)
], User.prototype, "avatarUrl", void 0);
_ts_decorate([
Column("varchar", {
length: 128,
nullable: true,
comment: "The blurhash of the avatar DriveFile"
}),
_ts_metadata("design:type", Object)
], User.prototype, "avatarBlurhash", void 0);
_ts_decorate([
OneToOne((type)=>DriveFile, {
onDelete: "SET NULL"
}),
JoinColumn(),
_ts_metadata("design:type", Object)
], User.prototype, "avatar", void 0);
_ts_decorate([
Column({
...id(),
nullable: true,
comment: "The ID of banner DriveFile."
}),
_ts_metadata("design:type", Object)
], User.prototype, "bannerId", void 0);
_ts_decorate([
Column("varchar", {
length: 512,
nullable: true,
comment: "The URL of the banner DriveFile"
}),
_ts_metadata("design:type", Object)
], User.prototype, "bannerUrl", void 0);
_ts_decorate([
Column("varchar", {
length: 128,
nullable: true,
comment: "The blurhash of the banner DriveFile"
}),
_ts_metadata("design:type", Object)
], User.prototype, "bannerBlurhash", void 0);
_ts_decorate([
OneToOne((type)=>DriveFile, {
onDelete: "SET NULL"
}),
JoinColumn(),
_ts_metadata("design:type", Object)
], User.prototype, "banner", void 0);
_ts_decorate([
Index(),
Column("varchar", {
length: 128,
array: true,
default: "{}"
}),
_ts_metadata("design:type", Array)
], User.prototype, "tags", void 0);
_ts_decorate([
Index(),
Column("boolean", {
default: false,
comment: "Whether the User is suspended."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isSuspended", void 0);
_ts_decorate([
Column("boolean", {
default: false,
comment: "Whether the User is silenced."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isSilenced", void 0);
_ts_decorate([
Column("boolean", {
default: false,
comment: "Whether the User is locked."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isLocked", void 0);
_ts_decorate([
Column("boolean", {
default: false,
comment: "Whether the User is a bot."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isBot", void 0);
_ts_decorate([
Column("boolean", {
default: false,
comment: "Whether the User is a cat."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isCat", void 0);
_ts_decorate([
Column("boolean", {
default: true,
comment: "Whether to speak as a cat if isCat."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "speakAsCat", void 0);
_ts_decorate([
Column("boolean", {
default: false,
comment: "Whether the User is the admin."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isAdmin", void 0);
_ts_decorate([
Column("boolean", {
default: false,
comment: "Whether the User is a moderator."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isModerator", void 0);
_ts_decorate([
Column("boolean", {
default: false,
comment: "Whether the User has an administrator-issued verified badge."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isVerified", void 0);
_ts_decorate([
Column("varchar", {
length: 1,
array: true,
default: "{}",
comment: "Self-selected minor-safety badges."
}),
_ts_metadata("design:type", Array)
], User.prototype, "minorBadges", void 0);
_ts_decorate([
Index(),
Column("boolean", {
default: true,
comment: "Whether the User is explorable."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isExplorable", void 0);
_ts_decorate([
Column("boolean", {
default: false,
comment: "Whether the User is deleted."
}),
_ts_metadata("design:type", Boolean)
], User.prototype, "isDeleted", void 0);
_ts_decorate([
Column("varchar", {
length: 128,
array: true,
default: "{}"
}),
_ts_metadata("design:type", Array)
], User.prototype, "emojis", void 0);
_ts_decorate([
Index(),
Column("varchar", {
length: 512,
nullable: true,
comment: "The host of the User. It will be null if the origin of the user is local."
}),
_ts_metadata("design:type", Object)
], User.prototype, "host", void 0);
_ts_decorate([
Column("varchar", {
length: 512,
nullable: true,
comment: "The inbox URL of the User. It will be null if the origin of the user is local."
}),
_ts_metadata("design:type", Object)
], User.prototype, "inbox", void 0);
_ts_decorate([
Column("varchar", {
length: 512,
nullable: true,
comment: "The sharedInbox URL of the User. It will be null if the origin of the user is local."
}),
_ts_metadata("design:type", Object)
], User.prototype, "sharedInbox", void 0);
_ts_decorate([
Column("varchar", {
length: 512,
nullable: true,
comment: "The featured URL of the User. It will be null if the origin of the user is local."
}),
_ts_metadata("design:type", Object)
], User.prototype, "featured", void 0);
_ts_decorate([
Index(),
Column("varchar", {
length: 512,
nullable: true,
comment: "The URI of the User. It will be null if the origin of the user is local."
}),
_ts_metadata("design:type", Object)
], User.prototype, "uri", void 0);
_ts_decorate([
Column("varchar", {
length: 512,
nullable: true,
comment: "The URI of the user Follower Collection. It will be null if the origin of the user is local."
}),
_ts_metadata("design:type", Object)
], User.prototype, "followersUri", void 0);
_ts_decorate([
Index({
unique: true
}),
Column("char", {
length: 16,
nullable: true,
unique: true,
comment: "The native access token of the User. It will be null if the origin of the user is local."
}),
_ts_metadata("design:type", Object)
], User.prototype, "token", void 0);
_ts_decorate([
Column("integer", {
nullable: true,
comment: "Overrides user drive capacity limit"
}),
_ts_metadata("design:type", Object)
], User.prototype, "driveCapacityOverrideMb", void 0);
_ts_decorate([
Column("enum", {
nullable: false,
default: "nobody",
enum: [
"anyone",
"followers",
"nobody"
]
}),
_ts_metadata("design:type", String)
], User.prototype, "canBite", void 0);
User = _ts_decorate([
Entity(),
Index([
"usernameLower",
"host"
], {
unique: true
}),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof Partial === "undefined" ? Object : Partial
])
], User);