This commit is contained in:
syuilo 2021-12-09 23:58:30 +09:00
parent 0abe2dfee0
commit c69b72e199
573 changed files with 3318 additions and 3318 deletions

View file

@ -10,7 +10,7 @@ import { LessThan } from 'typeorm';
export default function() { export default function() {
async function tick() { async function tick() {
await AttestationChallenges.delete({ await AttestationChallenges.delete({
createdAt: LessThan(new Date(new Date().getTime() - 5 * 60 * 1000)) createdAt: LessThan(new Date(new Date().getTime() - 5 * 60 * 1000)),
}); });
} }

View file

@ -35,13 +35,13 @@ export default function() {
activeSincePrevTick: activeDeliverJobs, activeSincePrevTick: activeDeliverJobs,
active: deliverJobCounts.active, active: deliverJobCounts.active,
waiting: deliverJobCounts.waiting, waiting: deliverJobCounts.waiting,
delayed: deliverJobCounts.delayed delayed: deliverJobCounts.delayed,
}, },
inbox: { inbox: {
activeSincePrevTick: activeInboxJobs, activeSincePrevTick: activeInboxJobs,
active: inboxJobCounts.active, active: inboxJobCounts.active,
waiting: inboxJobCounts.waiting, waiting: inboxJobCounts.waiting,
delayed: inboxJobCounts.delayed delayed: inboxJobCounts.delayed,
}, },
}; };

View file

@ -38,7 +38,7 @@ export default function() {
fs: { fs: {
r: round(Math.max(0, fsStats.rIO_sec)), r: round(Math.max(0, fsStats.rIO_sec)),
w: round(Math.max(0, fsStats.wIO_sec)), w: round(Math.max(0, fsStats.wIO_sec)),
} },
}; };
ev.emit('serverStats', stats); ev.emit('serverStats', stats);
log.unshift(stats); log.unshift(stats);

View file

@ -6,10 +6,10 @@ const index = {
analysis: { analysis: {
analyzer: { analyzer: {
ngram: { ngram: {
tokenizer: 'ngram' tokenizer: 'ngram',
} },
} },
} },
}, },
mappings: { mappings: {
properties: { properties: {
@ -25,9 +25,9 @@ const index = {
userHost: { userHost: {
type: 'keyword', type: 'keyword',
index: true, index: true,
} },
} },
} },
}; };
// Init ElasticSearch connection // Init ElasticSearch connection
@ -35,9 +35,9 @@ const client = config.elasticsearch ? new elasticsearch.Client({
node: `${config.elasticsearch.ssl ? 'https://' : 'http://'}${config.elasticsearch.host}:${config.elasticsearch.port}`, node: `${config.elasticsearch.ssl ? 'https://' : 'http://'}${config.elasticsearch.host}:${config.elasticsearch.port}`,
auth: (config.elasticsearch.user && config.elasticsearch.pass) ? { auth: (config.elasticsearch.user && config.elasticsearch.pass) ? {
username: config.elasticsearch.user, username: config.elasticsearch.user,
password: config.elasticsearch.pass password: config.elasticsearch.pass,
} : undefined, } : undefined,
pingTimeout: 30000 pingTimeout: 30000,
}) : null; }) : null;
if (client) { if (client) {
@ -47,7 +47,7 @@ if (client) {
if (!exist.body) { if (!exist.body) {
client.indices.create({ client.indices.create({
index: config.elasticsearch.index || 'misskey_note', index: config.elasticsearch.index || 'misskey_note',
body: index body: index,
}); });
} }
}); });

View file

@ -175,7 +175,7 @@ export const entities = [
Ad, Ad,
PasswordResetRequest, PasswordResetRequest,
UserPending, UserPending,
...charts as any ...charts as any,
]; ];
export function initDb(justBorrow = false, sync = false, forceRecreate = false) { export function initDb(justBorrow = false, sync = false, forceRecreate = false) {
@ -205,12 +205,12 @@ export function initDb(justBorrow = false, sync = false, forceRecreate = false)
port: config.redis.port, port: config.redis.port,
password: config.redis.pass, password: config.redis.pass,
prefix: `${config.redis.prefix}:query:`, prefix: `${config.redis.prefix}:query:`,
db: config.redis.db || 0 db: config.redis.db || 0,
} },
} : false, } : false,
logging: log, logging: log,
logger: log ? new MyCustomLogger() : undefined, logger: log ? new MyCustomLogger() : undefined,
entities: entities entities: entities,
}); });
} }

View file

@ -8,7 +8,7 @@ export function createConnection() {
{ {
password: config.redis.pass, password: config.redis.pass,
prefix: config.redis.prefix, prefix: config.redis.prefix,
db: config.redis.db || 0 db: config.redis.db || 0,
} }
); );
} }

View file

@ -134,7 +134,7 @@ export default class Reversi {
color, color,
pos, pos,
effects, effects,
turn turn,
}); });
this.calcTurn(); this.calcTurn();
@ -211,7 +211,7 @@ export default class Reversi {
[ 0, +1], // 下 [ 0, +1], // 下
[ -1, +1], // 左下 [ -1, +1], // 左下
[ -1, 0], // 左 [ -1, 0], // 左
[ -1, -1] // 左上 [ -1, -1], // 左上
]; ];
const effectsInLine = ([dx, dy]: [number, number]): number[] => { const effectsInLine = ([dx, dy]: [number, number]): number[] => {

View file

@ -22,8 +22,8 @@ export const fourfour: Map = {
'----', '----',
'-wb-', '-wb-',
'-bw-', '-bw-',
'----' '----',
] ],
}; };
export const sixsix: Map = { export const sixsix: Map = {
@ -35,8 +35,8 @@ export const sixsix: Map = {
'--wb--', '--wb--',
'--bw--', '--bw--',
'------', '------',
'------' '------',
] ],
}; };
export const roundedSixsix: Map = { export const roundedSixsix: Map = {
@ -49,8 +49,8 @@ export const roundedSixsix: Map = {
'--wb--', '--wb--',
'--bw--', '--bw--',
'------', '------',
' ---- ' ' ---- ',
] ],
}; };
export const roundedSixsix2: Map = { export const roundedSixsix2: Map = {
@ -63,8 +63,8 @@ export const roundedSixsix2: Map = {
'--wb--', '--wb--',
'--bw--', '--bw--',
' ---- ', ' ---- ',
' -- ' ' -- ',
] ],
}; };
export const eighteight: Map = { export const eighteight: Map = {
@ -78,8 +78,8 @@ export const eighteight: Map = {
'---bw---', '---bw---',
'--------', '--------',
'--------', '--------',
'--------' '--------',
] ],
}; };
export const eighteightH1: Map = { export const eighteightH1: Map = {
@ -93,8 +93,8 @@ export const eighteightH1: Map = {
'---bw---', '---bw---',
'--------', '--------',
'--------', '--------',
'--------' '--------',
] ],
}; };
export const eighteightH2: Map = { export const eighteightH2: Map = {
@ -108,8 +108,8 @@ export const eighteightH2: Map = {
'---bw---', '---bw---',
'--------', '--------',
'--------', '--------',
'-------b' '-------b',
] ],
}; };
export const eighteightH3: Map = { export const eighteightH3: Map = {
@ -123,8 +123,8 @@ export const eighteightH3: Map = {
'---bw---', '---bw---',
'--------', '--------',
'--------', '--------',
'-------b' '-------b',
] ],
}; };
export const eighteightH4: Map = { export const eighteightH4: Map = {
@ -138,8 +138,8 @@ export const eighteightH4: Map = {
'---bw---', '---bw---',
'--------', '--------',
'--------', '--------',
'b------b' 'b------b',
] ],
}; };
export const eighteightH28: Map = { export const eighteightH28: Map = {
@ -153,8 +153,8 @@ export const eighteightH28: Map = {
'b--bw--b', 'b--bw--b',
'b------b', 'b------b',
'b------b', 'b------b',
'bbbbbbbb' 'bbbbbbbb',
] ],
}; };
export const roundedEighteight: Map = { export const roundedEighteight: Map = {
@ -169,8 +169,8 @@ export const roundedEighteight: Map = {
'---bw---', '---bw---',
'--------', '--------',
'--------', '--------',
' ------ ' ' ------ ',
] ],
}; };
export const roundedEighteight2: Map = { export const roundedEighteight2: Map = {
@ -185,8 +185,8 @@ export const roundedEighteight2: Map = {
'---bw---', '---bw---',
'--------', '--------',
' ------ ', ' ------ ',
' ---- ' ' ---- ',
] ],
}; };
export const roundedEighteight3: Map = { export const roundedEighteight3: Map = {
@ -201,8 +201,8 @@ export const roundedEighteight3: Map = {
'---bw---', '---bw---',
' ------ ', ' ------ ',
' ---- ', ' ---- ',
' -- ' ' -- ',
] ],
}; };
export const eighteightWithNotch: Map = { export const eighteightWithNotch: Map = {
@ -217,8 +217,8 @@ export const eighteightWithNotch: Map = {
' --bw-- ', ' --bw-- ',
'--------', '--------',
'--------', '--------',
'--- ---' '--- ---',
] ],
}; };
export const eighteightWithSomeHoles: Map = { export const eighteightWithSomeHoles: Map = {
@ -233,8 +233,8 @@ export const eighteightWithSomeHoles: Map = {
'---bw- -', '---bw- -',
' -------', ' -------',
'--- ----', '--- ----',
'--------' '--------',
] ],
}; };
export const circle: Map = { export const circle: Map = {
@ -249,8 +249,8 @@ export const circle: Map = {
'---bw---', '---bw---',
' ------ ', ' ------ ',
' ------ ', ' ------ ',
' -- ' ' -- ',
] ],
}; };
export const smile: Map = { export const smile: Map = {
@ -265,8 +265,8 @@ export const smile: Map = {
'-- bw --', '-- bw --',
'--- ---', '--- ---',
'--------', '--------',
' ------ ' ' ------ ',
] ],
}; };
export const window: Map = { export const window: Map = {
@ -281,8 +281,8 @@ export const window: Map = {
'---bw---', '---bw---',
'- -- -', '- -- -',
'- -- -', '- -- -',
'--------' '--------',
] ],
}; };
export const reserved: Map = { export const reserved: Map = {
@ -297,8 +297,8 @@ export const reserved: Map = {
'---bw---', '---bw---',
'--------', '--------',
'--------', '--------',
'b------w' 'b------w',
] ],
}; };
export const x: Map = { export const x: Map = {
@ -313,8 +313,8 @@ export const x: Map = {
'---bw---', '---bw---',
'--b--w--', '--b--w--',
'-b----w-', '-b----w-',
'b------w' 'b------w',
] ],
}; };
export const parallel: Map = { export const parallel: Map = {
@ -329,8 +329,8 @@ export const parallel: Map = {
'---ww---', '---ww---',
'--------', '--------',
'--------', '--------',
'--------' '--------',
] ],
}; };
export const lackOfBlack: Map = { export const lackOfBlack: Map = {
@ -344,8 +344,8 @@ export const lackOfBlack: Map = {
'---bw---', '---bw---',
'--------', '--------',
'--------', '--------',
'--------' '--------',
] ],
}; };
export const squareParty: Map = { export const squareParty: Map = {
@ -360,8 +360,8 @@ export const squareParty: Map = {
'-bbbwww-', '-bbbwww-',
'-b-bw-w-', '-b-bw-w-',
'-bbbwww-', '-bbbwww-',
'--------' '--------',
] ],
}; };
export const minesweeper: Map = { export const minesweeper: Map = {
@ -376,8 +376,8 @@ export const minesweeper: Map = {
'-w-bw-b-', '-w-bw-b-',
'b-w--b-w', 'b-w--b-w',
'-b-bw-w-', '-b-bw-w-',
'w-w--b-b' 'w-w--b-b',
] ],
}; };
export const tenthtenth: Map = { export const tenthtenth: Map = {
@ -393,8 +393,8 @@ export const tenthtenth: Map = {
'----------', '----------',
'----------', '----------',
'----------', '----------',
'----------' '----------',
] ],
}; };
export const hole: Map = { export const hole: Map = {
@ -411,8 +411,8 @@ export const hole: Map = {
'--wb--wb--', '--wb--wb--',
'--bw--bw--', '--bw--bw--',
'----------', '----------',
'----------' '----------',
] ],
}; };
export const grid: Map = { export const grid: Map = {
@ -429,8 +429,8 @@ export const grid: Map = {
'- - -- - -', '- - -- - -',
'----------', '----------',
'- - -- - -', '- - -- - -',
'----------' '----------',
] ],
}; };
export const cross: Map = { export const cross: Map = {
@ -447,8 +447,8 @@ export const cross: Map = {
'----------', '----------',
' ---- ', ' ---- ',
' ---- ', ' ---- ',
' ---- ' ' ---- ',
] ],
}; };
export const charX: Map = { export const charX: Map = {
@ -465,8 +465,8 @@ export const charX: Map = {
' -------- ', ' -------- ',
'----------', '----------',
'---- ----', '---- ----',
'--- ---' '--- ---',
] ],
}; };
export const charY: Map = { export const charY: Map = {
@ -483,8 +483,8 @@ export const charY: Map = {
' ------ ', ' ------ ',
' ------ ', ' ------ ',
' ------ ', ' ------ ',
' ------ ' ' ------ ',
] ],
}; };
export const walls: Map = { export const walls: Map = {
@ -501,8 +501,8 @@ export const walls: Map = {
'w--------w', 'w--------w',
'w--------w', 'w--------w',
'w--------w', 'w--------w',
' bbbbbbbb ' ' bbbbbbbb ',
] ],
}; };
export const cpu: Map = { export const cpu: Map = {
@ -519,8 +519,8 @@ export const cpu: Map = {
'w--------w', 'w--------w',
' -------- ', ' -------- ',
'w--------w', 'w--------w',
' b b b b ' ' b b b b ',
] ],
}; };
export const checker: Map = { export const checker: Map = {
@ -537,8 +537,8 @@ export const checker: Map = {
'---bwbw---', '---bwbw---',
'----------', '----------',
'----------', '----------',
'----------' '----------',
] ],
}; };
export const japaneseCurry: Map = { export const japaneseCurry: Map = {
@ -555,8 +555,8 @@ export const japaneseCurry: Map = {
'w-w-w-b-b-', 'w-w-w-b-b-',
'-w-w-w-b-b', '-w-w-w-b-b',
'w-w-w-w-b-', 'w-w-w-w-b-',
'-w-w-w-w-b' '-w-w-w-w-b',
] ],
}; };
export const mosaic: Map = { export const mosaic: Map = {
@ -574,7 +574,7 @@ export const mosaic: Map = {
' - - - - -', ' - - - - -',
'- - - - - ', '- - - - - ',
' - - - - -', ' - - - - -',
] ],
}; };
export const arena: Map = { export const arena: Map = {
@ -591,8 +591,8 @@ export const arena: Map = {
' -------- ', ' -------- ',
'- ------ -', '- ------ -',
' - - - - ', ' - - - - ',
'- - -- - -' '- - -- - -',
] ],
}; };
export const reactor: Map = { export const reactor: Map = {
@ -609,8 +609,8 @@ export const reactor: Map = {
'---w b---', '---w b---',
'- --bw-- -', '- --bw-- -',
'w- - - -b', 'w- - - -b',
'-b------w-' '-b------w-',
] ],
}; };
export const sixeight: Map = { export const sixeight: Map = {
@ -624,8 +624,8 @@ export const sixeight: Map = {
'--bw--', '--bw--',
'------', '------',
'------', '------',
'------' '------',
] ],
}; };
export const spark: Map = { export const spark: Map = {
@ -642,8 +642,8 @@ export const spark: Map = {
' -------- ', ' -------- ',
' -------- ', ' -------- ',
'----------', '----------',
' - - ' ' - - ',
] ],
}; };
export const islands: Map = { export const islands: Map = {
@ -660,8 +660,8 @@ export const islands: Map = {
' --------', ' --------',
' --------', ' --------',
' --------', ' --------',
' --------' ' --------',
] ],
}; };
export const galaxy: Map = { export const galaxy: Map = {
@ -680,8 +680,8 @@ export const galaxy: Map = {
'---w--bbb---', '---w--bbb---',
' ---w------ ', ' ---w------ ',
' ---www-- ', ' ---www-- ',
' ------ ' ' ------ ',
] ],
}; };
export const triangle: Map = { export const triangle: Map = {
@ -698,8 +698,8 @@ export const triangle: Map = {
' -------- ', ' -------- ',
' -------- ', ' -------- ',
'----------', '----------',
'----------' '----------',
] ],
}; };
export const iphonex: Map = { export const iphonex: Map = {
@ -718,8 +718,8 @@ export const iphonex: Map = {
'--------', '--------',
'--------', '--------',
'--------', '--------',
' ------ ' ' ------ ',
] ],
}; };
export const dealWithIt: Map = { export const dealWithIt: Map = {
@ -731,8 +731,8 @@ export const dealWithIt: Map = {
'--w-b-------', '--w-b-------',
' --b-w------', ' --b-w------',
' --w-b---- ', ' --w-b---- ',
' ------- ' ' ------- ',
] ],
}; };
export const experiment: Map = { export const experiment: Map = {
@ -750,8 +750,8 @@ export const experiment: Map = {
'bbbbbb wwwwww', 'bbbbbb wwwwww',
'bbbbbb wwwwww', 'bbbbbb wwwwww',
'bbbbbb wwwwww', 'bbbbbb wwwwww',
'wwwwww bbbbbb' 'wwwwww bbbbbb',
] ],
}; };
export const bigBoard: Map = { export const bigBoard: Map = {
@ -773,8 +773,8 @@ export const bigBoard: Map = {
'----------------', '----------------',
'----------------', '----------------',
'----------------', '----------------',
'----------------' '----------------',
] ],
}; };
export const twoBoard: Map = { export const twoBoard: Map = {
@ -789,8 +789,8 @@ export const twoBoard: Map = {
'---bw--- ---bw---', '---bw--- ---bw---',
'-------- --------', '-------- --------',
'-------- --------', '-------- --------',
'-------- --------' '-------- --------',
] ],
}; };
export const test1: Map = { export const test1: Map = {
@ -800,8 +800,8 @@ export const test1: Map = {
'--------', '--------',
'---wb---', '---wb---',
'---bw---', '---bw---',
'--------' '--------',
] ],
}; };
export const test2: Map = { export const test2: Map = {
@ -812,8 +812,8 @@ export const test2: Map = {
'------', '------',
'-b--w-', '-b--w-',
'-w--b-', '-w--b-',
'-w--b-' '-w--b-',
] ],
}; };
export const test3: Map = { export const test3: Map = {
@ -832,7 +832,7 @@ export const test3: Map = {
'-w-', '-w-',
'---', '---',
'b--', 'b--',
] ],
}; };
export const test4: Map = { export const test4: Map = {
@ -843,8 +843,8 @@ export const test4: Map = {
'-w--b-', '-w--b-',
'------', '------',
'-w--b-', '-w--b-',
'-w--b-' '-w--b-',
] ],
}; };
// 検証用: この盤面で藍(lv3)が黒で始めると何故か(?)A1に打ってしまう // 検証用: この盤面で藍(lv3)が黒で始めると何故か(?)A1に打ってしまう
@ -860,7 +860,7 @@ export const test6: Map = {
'wwbwbbbb', 'wwbwbbbb',
'--wbbbbb', '--wbbbbb',
'-wwwww--', '-wwwww--',
] ],
}; };
// 検証用: この盤面で藍(lv3)が黒で始めると何故か(?)G7に打ってしまう // 検証用: この盤面で藍(lv3)が黒で始めると何故か(?)G7に打ってしまう
@ -876,7 +876,7 @@ export const test7: Map = {
'-wwbbwwb', '-wwbbwwb',
'--wwww--', '--wwww--',
'--wwww--', '--wwww--',
] ],
}; };
// 検証用: この盤面で藍(lv5)が黒で始めると何故か(?)A1に打ってしまう // 検証用: この盤面で藍(lv5)が黒で始めると何故か(?)A1に打ってしまう
@ -892,5 +892,5 @@ export const test8: Map = {
'wwwwww--', 'wwwwww--',
'--www---', '--www---',
'--ww----', '--ww----',
] ],
}; };

View file

@ -144,7 +144,7 @@ export function toHtml(nodes: mfm.MfmNode[] | null, mentionedRemoteUsers: IMenti
a.href = `https://www.google.com/search?q=${node.props.query}`; a.href = `https://www.google.com/search?q=${node.props.query}`;
a.textContent = node.props.content; a.textContent = node.props.content;
return a; return a;
} },
}; };
appendChildren(nodes, doc.body); appendChildren(nodes, doc.body);

View file

@ -10,7 +10,7 @@ export class Cache<T> {
public set(key: string | null, value: T): void { public set(key: string | null, value: T): void {
this.cache.set(key, { this.cache.set(key, {
date: Date.now(), date: Date.now(),
value value,
}); });
} }

View file

@ -33,17 +33,17 @@ type CaptchaResponse = {
async function getCaptchaResponse(url: string, secret: string, response: string): Promise<CaptchaResponse> { async function getCaptchaResponse(url: string, secret: string, response: string): Promise<CaptchaResponse> {
const params = new URLSearchParams({ const params = new URLSearchParams({
secret, secret,
response response,
}); });
const res = await fetch(url, { const res = await fetch(url, {
method: 'POST', method: 'POST',
body: params, body: params,
headers: { headers: {
'User-Agent': config.userAgent 'User-Agent': config.userAgent,
}, },
timeout: 10 * 1000, timeout: 10 * 1000,
agent: getAgentByUrl agent: getAgentByUrl,
}).catch(e => { }).catch(e => {
throw `${e.message || e}`; throw `${e.message || e}`;
}); });

View file

@ -24,7 +24,7 @@ export async function checkHitAntenna(antenna: Antenna, note: (Note | Packed<'No
if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) return false; if (antennaUserFollowing && !antennaUserFollowing.includes(note.userId)) return false;
} else if (antenna.src === 'list') { } else if (antenna.src === 'list') {
const listUsers = (await UserListJoinings.find({ const listUsers = (await UserListJoinings.find({
userListId: antenna.userListId! userListId: antenna.userListId!,
})).map(x => x.userId); })).map(x => x.userId);
if (!listUsers.includes(note.userId)) return false; if (!listUsers.includes(note.userId)) return false;
@ -32,7 +32,7 @@ export async function checkHitAntenna(antenna: Antenna, note: (Note | Packed<'No
const joining = await UserGroupJoinings.findOneOrFail(antenna.userGroupJoiningId!); const joining = await UserGroupJoinings.findOneOrFail(antenna.userGroupJoiningId!);
const groupUsers = (await UserGroupJoinings.find({ const groupUsers = (await UserGroupJoinings.find({
userGroupId: joining.userGroupId userGroupId: joining.userGroupId,
})).map(x => x.userId); })).map(x => x.userId);
if (!groupUsers.includes(note.userId)) return false; if (!groupUsers.includes(note.userId)) return false;

View file

@ -22,7 +22,7 @@ export async function downloadUrl(url: string, path: string) {
const req = got.stream(url, { const req = got.stream(url, {
headers: { headers: {
'User-Agent': config.userAgent 'User-Agent': config.userAgent,
}, },
timeout: { timeout: {
lookup: timeout, lookup: timeout,

View file

@ -10,8 +10,8 @@ export async function fetchMeta(noCache = false): Promise<Meta> {
// 過去のバグでレコードが複数出来てしまっている可能性があるので新しいIDを優先する // 過去のバグでレコードが複数出来てしまっている可能性があるので新しいIDを優先する
const meta = await transactionalEntityManager.findOne(Meta, { const meta = await transactionalEntityManager.findOne(Meta, {
order: { order: {
id: 'DESC' id: 'DESC',
} },
}); });
if (meta) { if (meta) {
@ -19,7 +19,7 @@ export async function fetchMeta(noCache = false): Promise<Meta> {
return meta; return meta;
} else { } else {
const saved = await transactionalEntityManager.save(Meta, { const saved = await transactionalEntityManager.save(Meta, {
id: 'x' id: 'x',
}) as Meta; }) as Meta;
cache = saved; cache = saved;

View file

@ -12,9 +12,9 @@ export async function getJson(url: string, accept = 'application/json, */*', tim
method: 'GET', method: 'GET',
headers: Object.assign({ headers: Object.assign({
'User-Agent': config.userAgent, 'User-Agent': config.userAgent,
Accept: accept Accept: accept,
}, headers || {}), }, headers || {}),
timeout timeout,
}); });
return await res.json(); return await res.json();
@ -26,9 +26,9 @@ export async function getHtml(url: string, accept = 'text/html, */*', timeout =
method: 'GET', method: 'GET',
headers: Object.assign({ headers: Object.assign({
'User-Agent': config.userAgent, 'User-Agent': config.userAgent,
Accept: accept Accept: accept,
}, headers || {}), }, headers || {}),
timeout timeout,
}); });
return await res.text(); return await res.text();
@ -95,7 +95,7 @@ export const httpAgent = config.proxy
maxSockets, maxSockets,
maxFreeSockets: 256, maxFreeSockets: 256,
scheduling: 'lifo', scheduling: 'lifo',
proxy: config.proxy proxy: config.proxy,
}) })
: _http; : _http;
@ -109,7 +109,7 @@ export const httpsAgent = config.proxy
maxSockets, maxSockets,
maxFreeSockets: 256, maxFreeSockets: 256,
scheduling: 'lifo', scheduling: 'lifo',
proxy: config.proxy proxy: config.proxy,
}) })
: _https; : _https;

View file

@ -8,14 +8,14 @@ export async function genRsaKeyPair(modulusLength = 2048) {
modulusLength, modulusLength,
publicKeyEncoding: { publicKeyEncoding: {
type: 'spki', type: 'spki',
format: 'pem' format: 'pem',
}, },
privateKeyEncoding: { privateKeyEncoding: {
type: 'pkcs8', type: 'pkcs8',
format: 'pem', format: 'pem',
cipher: undefined, cipher: undefined,
passphrase: undefined passphrase: undefined,
} },
}); });
} }
@ -24,13 +24,13 @@ export async function genEcKeyPair(namedCurve: 'prime256v1' | 'secp384r1' | 'sec
namedCurve, namedCurve,
publicKeyEncoding: { publicKeyEncoding: {
type: 'spki', type: 'spki',
format: 'pem' format: 'pem',
}, },
privateKeyEncoding: { privateKeyEncoding: {
type: 'pkcs8', type: 'pkcs8',
format: 'pem', format: 'pem',
cipher: undefined, cipher: undefined,
passphrase: undefined passphrase: undefined,
} },
}); });
} }

View file

@ -26,12 +26,12 @@ export type FileInfo = {
const TYPE_OCTET_STREAM = { const TYPE_OCTET_STREAM = {
mime: 'application/octet-stream', mime: 'application/octet-stream',
ext: null ext: null,
}; };
const TYPE_SVG = { const TYPE_SVG = {
mime: 'image/svg+xml', mime: 'image/svg+xml',
ext: 'svg' ext: 'svg',
}; };
/** /**
@ -116,7 +116,7 @@ export async function detectType(path: string) {
return { return {
mime: type.mime, mime: type.mime,
ext: type.ext ext: type.ext,
}; };
} }

View file

@ -112,14 +112,14 @@ export function decodeReaction(str: string): DecodedReaction {
return { return {
reaction: `:${name}@${host || '.'}:`, // ローカル分は@以降を省略するのではなく.にする reaction: `:${name}@${host || '.'}:`, // ローカル分は@以降を省略するのではなく.にする
name, name,
host host,
}; };
} }
return { return {
reaction: str, reaction: str,
name: undefined, name: undefined,
host: undefined host: undefined,
}; };
} }

View file

@ -9,7 +9,7 @@ export class AbuseUserReport {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the AbuseUserReport.' comment: 'The created date of the AbuseUserReport.',
}) })
public createdAt: Date; public createdAt: Date;
@ -18,7 +18,7 @@ export class AbuseUserReport {
public targetUserId: User['id']; public targetUserId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public targetUser: User | null; public targetUser: User | null;
@ -28,26 +28,26 @@ export class AbuseUserReport {
public reporterId: User['id']; public reporterId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public reporter: User | null; public reporter: User | null;
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public assigneeId: User['id'] | null; public assigneeId: User['id'] | null;
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public assignee: User | null; public assignee: User | null;
@Index() @Index()
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public resolved: boolean; public resolved: boolean;
@ -60,14 +60,14 @@ export class AbuseUserReport {
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public targetUserHost: string | null; public targetUserHost: string | null;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public reporterHost: string | null; public reporterHost: string | null;
//#endregion //#endregion

View file

@ -9,7 +9,7 @@ export class AccessToken {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the AccessToken.' comment: 'The created date of the AccessToken.',
}) })
public createdAt: Date; public createdAt: Date;
@ -21,7 +21,7 @@ export class AccessToken {
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128 length: 128,
}) })
public token: string; public token: string;
@ -29,13 +29,13 @@ export class AccessToken {
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true, nullable: true,
default: null default: null,
}) })
public session: string | null; public session: string | null;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128 length: 128,
}) })
public hash: string; public hash: string;
@ -44,7 +44,7 @@ export class AccessToken {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -52,12 +52,12 @@ export class AccessToken {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
default: null default: null,
}) })
public appId: App['id'] | null; public appId: App['id'] | null;
@ManyToOne(type => App, { @ManyToOne(type => App, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public app: App | null; public app: App | null;
@ -65,32 +65,32 @@ export class AccessToken {
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true, nullable: true,
default: null default: null,
}) })
public name: string | null; public name: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true, nullable: true,
default: null default: null,
}) })
public description: string | null; public description: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true, nullable: true,
default: null default: null,
}) })
public iconUrl: string | null; public iconUrl: string | null;
@Column('varchar', { @Column('varchar', {
length: 64, array: true, length: 64, array: true,
default: '{}' default: '{}',
}) })
public permission: string[]; public permission: string[];
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public fetched: boolean; public fetched: boolean;
} }

View file

@ -8,44 +8,44 @@ export class Ad {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Ad.' comment: 'The created date of the Ad.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The expired date of the Ad.' comment: 'The expired date of the Ad.',
}) })
public expiresAt: Date; public expiresAt: Date;
@Column('varchar', { @Column('varchar', {
length: 32, nullable: false length: 32, nullable: false,
}) })
public place: string; public place: string;
// 今は使われていないが将来的に活用される可能性はある // 今は使われていないが将来的に活用される可能性はある
@Column('varchar', { @Column('varchar', {
length: 32, nullable: false length: 32, nullable: false,
}) })
public priority: string; public priority: string;
@Column('integer', { @Column('integer', {
default: 1, nullable: false default: 1, nullable: false,
}) })
public ratio: number; public ratio: number;
@Column('varchar', { @Column('varchar', {
length: 1024, nullable: false length: 1024, nullable: false,
}) })
public url: string; public url: string;
@Column('varchar', { @Column('varchar', {
length: 1024, nullable: false length: 1024, nullable: false,
}) })
public imageUrl: string; public imageUrl: string;
@Column('varchar', { @Column('varchar', {
length: 8192, nullable: false length: 8192, nullable: false,
}) })
public memo: string; public memo: string;

View file

@ -10,7 +10,7 @@ export class AnnouncementRead {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the AnnouncementRead.' comment: 'The created date of the AnnouncementRead.',
}) })
public createdAt: Date; public createdAt: Date;
@ -19,7 +19,7 @@ export class AnnouncementRead {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -29,7 +29,7 @@ export class AnnouncementRead {
public announcementId: Announcement['id']; public announcementId: Announcement['id'];
@ManyToOne(type => Announcement, { @ManyToOne(type => Announcement, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public announcement: Announcement | null; public announcement: Announcement | null;

View file

@ -8,28 +8,28 @@ export class Announcement {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Announcement.' comment: 'The created date of the Announcement.',
}) })
public createdAt: Date; public createdAt: Date;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The updated date of the Announcement.', comment: 'The updated date of the Announcement.',
nullable: true nullable: true,
}) })
public updatedAt: Date | null; public updatedAt: Date | null;
@Column('varchar', { @Column('varchar', {
length: 8192, nullable: false length: 8192, nullable: false,
}) })
public text: string; public text: string;
@Column('varchar', { @Column('varchar', {
length: 256, nullable: false length: 256, nullable: false,
}) })
public title: string; public title: string;
@Column('varchar', { @Column('varchar', {
length: 1024, nullable: true length: 1024, nullable: true,
}) })
public imageUrl: string | null; public imageUrl: string | null;

View file

@ -12,12 +12,12 @@ export class AntennaNote {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The note ID.' comment: 'The note ID.',
}) })
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;
@ -25,19 +25,19 @@ export class AntennaNote {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The antenna ID.' comment: 'The antenna ID.',
}) })
public antennaId: Antenna['id']; public antennaId: Antenna['id'];
@ManyToOne(type => Antenna, { @ManyToOne(type => Antenna, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public antenna: Antenna | null; public antenna: Antenna | null;
@Index() @Index()
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public read: boolean; public read: boolean;
} }

View file

@ -10,26 +10,26 @@ export class Antenna {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Antenna.' comment: 'The created date of the Antenna.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The owner ID.' comment: 'The owner ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
comment: 'The name of the Antenna.' comment: 'The name of the Antenna.',
}) })
public name: string; public name: string;
@ -38,51 +38,51 @@ export class Antenna {
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public userListId: UserList['id'] | null; public userListId: UserList['id'] | null;
@ManyToOne(type => UserList, { @ManyToOne(type => UserList, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public userList: UserList | null; public userList: UserList | null;
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public userGroupJoiningId: UserGroupJoining['id'] | null; public userGroupJoiningId: UserGroupJoining['id'] | null;
@ManyToOne(type => UserGroupJoining, { @ManyToOne(type => UserGroupJoining, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public userGroupJoining: UserGroupJoining | null; public userGroupJoining: UserGroupJoining | null;
@Column('varchar', { @Column('varchar', {
length: 1024, array: true, length: 1024, array: true,
default: '{}' default: '{}',
}) })
public users: string[]; public users: string[];
@Column('jsonb', { @Column('jsonb', {
default: [] default: [],
}) })
public keywords: string[][]; public keywords: string[][];
@Column('jsonb', { @Column('jsonb', {
default: [] default: [],
}) })
public excludeKeywords: string[][]; public excludeKeywords: string[][];
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public caseSensitive: boolean; public caseSensitive: boolean;
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public withReplies: boolean; public withReplies: boolean;

View file

@ -9,7 +9,7 @@ export class App {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the App.' comment: 'The created date of the App.',
}) })
public createdAt: Date; public createdAt: Date;
@ -17,7 +17,7 @@ export class App {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The owner ID.' comment: 'The owner ID.',
}) })
public userId: User['id'] | null; public userId: User['id'] | null;
@ -30,31 +30,31 @@ export class App {
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 64, length: 64,
comment: 'The secret key of the App.' comment: 'The secret key of the App.',
}) })
public secret: string; public secret: string;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
comment: 'The name of the App.' comment: 'The name of the App.',
}) })
public name: string; public name: string;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
comment: 'The description of the App.' comment: 'The description of the App.',
}) })
public description: string; public description: string;
@Column('varchar', { @Column('varchar', {
length: 64, array: true, length: 64, array: true,
comment: 'The permission of the App.' comment: 'The permission of the App.',
}) })
public permission: string[]; public permission: string[];
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The callbackUrl of the App.' comment: 'The callbackUrl of the App.',
}) })
public callbackUrl: string | null; public callbackUrl: string | null;
} }

View file

@ -12,7 +12,7 @@ export class AttestationChallenge {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -20,19 +20,19 @@ export class AttestationChallenge {
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 64, length: 64,
comment: 'Hex-encoded sha256 hash of the challenge.' comment: 'Hex-encoded sha256 hash of the challenge.',
}) })
public challenge: string; public challenge: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The date challenge was created for expiry purposes.' comment: 'The date challenge was created for expiry purposes.',
}) })
public createdAt: Date; public createdAt: Date;
@Column('boolean', { @Column('boolean', {
comment: comment:
'Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.', 'Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as authentication.',
default: false default: false,
}) })
public registrationChallenge: boolean; public registrationChallenge: boolean;

View file

@ -9,25 +9,25 @@ export class AuthSession {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the AuthSession.' comment: 'The created date of the AuthSession.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128 length: 128,
}) })
public token: string; public token: string;
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE', onDelete: 'CASCADE',
nullable: true nullable: true,
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -36,7 +36,7 @@ export class AuthSession {
public appId: App['id']; public appId: App['id'];
@ManyToOne(type => App, { @ManyToOne(type => App, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public app: App | null; public app: App | null;

View file

@ -10,19 +10,19 @@ export class Blocking {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Blocking.' comment: 'The created date of the Blocking.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The blockee user ID.' comment: 'The blockee user ID.',
}) })
public blockeeId: User['id']; public blockeeId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public blockee: User | null; public blockee: User | null;
@ -30,12 +30,12 @@ export class Blocking {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The blocker user ID.' comment: 'The blocker user ID.',
}) })
public blockerId: User['id']; public blockerId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public blocker: User | null; public blocker: User | null;

View file

@ -11,19 +11,19 @@ export class ChannelFollowing {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the ChannelFollowing.' comment: 'The created date of the ChannelFollowing.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The followee channel ID.' comment: 'The followee channel ID.',
}) })
public followeeId: Channel['id']; public followeeId: Channel['id'];
@ManyToOne(type => Channel, { @ManyToOne(type => Channel, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public followee: Channel | null; public followee: Channel | null;
@ -31,12 +31,12 @@ export class ChannelFollowing {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The follower user ID.' comment: 'The follower user ID.',
}) })
public followerId: User['id']; public followerId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public follower: User | null; public follower: User | null;

View file

@ -10,7 +10,7 @@ export class ChannelNotePining {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the ChannelNotePining.' comment: 'The created date of the ChannelNotePining.',
}) })
public createdAt: Date; public createdAt: Date;
@ -19,7 +19,7 @@ export class ChannelNotePining {
public channelId: Channel['id']; public channelId: Channel['id'];
@ManyToOne(type => Channel, { @ManyToOne(type => Channel, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public channel: Channel | null; public channel: Channel | null;
@ -28,7 +28,7 @@ export class ChannelNotePining {
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;

View file

@ -10,13 +10,13 @@ export class Channel {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Channel.' comment: 'The created date of the Channel.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
nullable: true nullable: true,
}) })
public lastNotedAt: Date | null; public lastNotedAt: Date | null;
@ -24,37 +24,37 @@ export class Channel {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The owner ID.' comment: 'The owner ID.',
}) })
public userId: User['id'] | null; public userId: User['id'] | null;
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
comment: 'The name of the Channel.' comment: 'The name of the Channel.',
}) })
public name: string; public name: string;
@Column('varchar', { @Column('varchar', {
length: 2048, nullable: true, length: 2048, nullable: true,
comment: 'The description of the Channel.' comment: 'The description of the Channel.',
}) })
public description: string | null; public description: string | null;
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The ID of banner Channel.' comment: 'The ID of banner Channel.',
}) })
public bannerId: DriveFile['id'] | null; public bannerId: DriveFile['id'] | null;
@ManyToOne(type => DriveFile, { @ManyToOne(type => DriveFile, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public banner: DriveFile | null; public banner: DriveFile | null;
@ -62,14 +62,14 @@ export class Channel {
@Index() @Index()
@Column('integer', { @Column('integer', {
default: 0, default: 0,
comment: 'The count of notes.' comment: 'The count of notes.',
}) })
public notesCount: number; public notesCount: number;
@Index() @Index()
@Column('integer', { @Column('integer', {
default: 0, default: 0,
comment: 'The count of users.' comment: 'The count of users.',
}) })
public usersCount: number; public usersCount: number;
} }

View file

@ -12,12 +12,12 @@ export class ClipNote {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The note ID.' comment: 'The note ID.',
}) })
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;
@ -25,12 +25,12 @@ export class ClipNote {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The clip ID.' comment: 'The clip ID.',
}) })
public clipId: Clip['id']; public clipId: Clip['id'];
@ManyToOne(type => Clip, { @ManyToOne(type => Clip, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public clip: Clip | null; public clip: Clip | null;

View file

@ -8,37 +8,37 @@ export class Clip {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Clip.' comment: 'The created date of the Clip.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The owner ID.' comment: 'The owner ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
comment: 'The name of the Clip.' comment: 'The name of the Clip.',
}) })
public name: string; public name: string;
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public isPublic: boolean; public isPublic: boolean;
@Column('varchar', { @Column('varchar', {
length: 2048, nullable: true, default: null, length: 2048, nullable: true, default: null,
comment: 'The description of the Clip.' comment: 'The description of the Clip.',
}) })
public description: string | null; public description: string | null;
} }

View file

@ -11,7 +11,7 @@ export class DriveFile {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the DriveFile.' comment: 'The created date of the DriveFile.',
}) })
public createdAt: Date; public createdAt: Date;
@ -19,12 +19,12 @@ export class DriveFile {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The owner ID.' comment: 'The owner ID.',
}) })
public userId: User['id'] | null; public userId: User['id'] | null;
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -32,50 +32,50 @@ export class DriveFile {
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: 'The host of owner. It will be null if the user in local.' comment: 'The host of owner. It will be null if the user in local.',
}) })
public userHost: string | null; public userHost: string | null;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 32, length: 32,
comment: 'The MD5 hash of the DriveFile.' comment: 'The MD5 hash of the DriveFile.',
}) })
public md5: string; public md5: string;
@Column('varchar', { @Column('varchar', {
length: 256, length: 256,
comment: 'The file name of the DriveFile.' comment: 'The file name of the DriveFile.',
}) })
public name: string; public name: string;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
comment: 'The content type (MIME) of the DriveFile.' comment: 'The content type (MIME) of the DriveFile.',
}) })
public type: string; public type: string;
@Column('integer', { @Column('integer', {
comment: 'The file size (bytes) of the DriveFile.' comment: 'The file size (bytes) of the DriveFile.',
}) })
public size: number; public size: number;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The comment of the DriveFile.' comment: 'The comment of the DriveFile.',
}) })
public comment: string | null; public comment: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: 'The BlurHash string.' comment: 'The BlurHash string.',
}) })
public blurhash: string | null; public blurhash: string | null;
@Column('jsonb', { @Column('jsonb', {
default: {}, default: {},
comment: 'The any properties of the DriveFile. For example, it includes image width/height.' comment: 'The any properties of the DriveFile. For example, it includes image width/height.',
}) })
public properties: { width?: number; height?: number; orientation?: number; avgColor?: string }; public properties: { width?: number; height?: number; orientation?: number; avgColor?: string };
@ -85,19 +85,19 @@ export class DriveFile {
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
comment: 'The URL of the DriveFile.' comment: 'The URL of the DriveFile.',
}) })
public url: string; public url: string;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The URL of the thumbnail of the DriveFile.' comment: 'The URL of the thumbnail of the DriveFile.',
}) })
public thumbnailUrl: string | null; public thumbnailUrl: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The URL of the webpublic of the DriveFile.' comment: 'The URL of the webpublic of the DriveFile.',
}) })
public webpublicUrl: string | null; public webpublicUrl: string | null;
@ -122,7 +122,7 @@ export class DriveFile {
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.' comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.',
}) })
public uri: string | null; public uri: string | null;
@ -135,12 +135,12 @@ export class DriveFile {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The parent folder ID. If null, it means the DriveFile is located in root.' comment: 'The parent folder ID. If null, it means the DriveFile is located in root.',
}) })
public folderId: DriveFolder['id'] | null; public folderId: DriveFolder['id'] | null;
@ManyToOne(type => DriveFolder, { @ManyToOne(type => DriveFolder, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public folder: DriveFolder | null; public folder: DriveFolder | null;
@ -148,7 +148,7 @@ export class DriveFile {
@Index() @Index()
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the DriveFile is NSFW.' comment: 'Whether the DriveFile is NSFW.',
}) })
public isSensitive: boolean; public isSensitive: boolean;
@ -158,7 +158,7 @@ export class DriveFile {
@Index() @Index()
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the DriveFile is direct link to remote server.' comment: 'Whether the DriveFile is direct link to remote server.',
}) })
public isLink: boolean; public isLink: boolean;
} }

View file

@ -9,13 +9,13 @@ export class DriveFolder {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the DriveFolder.' comment: 'The created date of the DriveFolder.',
}) })
public createdAt: Date; public createdAt: Date;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
comment: 'The name of the DriveFolder.' comment: 'The name of the DriveFolder.',
}) })
public name: string; public name: string;
@ -23,12 +23,12 @@ export class DriveFolder {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The owner ID.' comment: 'The owner ID.',
}) })
public userId: User['id'] | null; public userId: User['id'] | null;
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -37,12 +37,12 @@ export class DriveFolder {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.' comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.',
}) })
public parentId: DriveFolder['id'] | null; public parentId: DriveFolder['id'] | null;
@ManyToOne(type => DriveFolder, { @ManyToOne(type => DriveFolder, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public parent: DriveFolder | null; public parent: DriveFolder | null;

View file

@ -8,24 +8,24 @@ export class Emoji {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
nullable: true nullable: true,
}) })
public updatedAt: Date | null; public updatedAt: Date | null;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128 length: 128,
}) })
public name: string; public name: string;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true length: 128, nullable: true,
}) })
public host: string | null; public host: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true length: 128, nullable: true,
}) })
public category: string | null; public category: string | null;
@ -35,17 +35,17 @@ export class Emoji {
public url: string; public url: string;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true length: 512, nullable: true,
}) })
public uri: string | null; public uri: string | null;
@Column('varchar', { @Column('varchar', {
length: 64, nullable: true length: 64, nullable: true,
}) })
public type: string | null; public type: string | null;
@Column('varchar', { @Column('varchar', {
array: true, length: 128, default: '{}' array: true, length: 128, default: '{}',
}) })
public aliases: string[]; public aliases: string[];
} }

View file

@ -9,19 +9,19 @@ export class FollowRequest {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the FollowRequest.' comment: 'The created date of the FollowRequest.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The followee user ID.' comment: 'The followee user ID.',
}) })
public followeeId: User['id']; public followeeId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public followee: User | null; public followee: User | null;
@ -29,56 +29,56 @@ export class FollowRequest {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The follower user ID.' comment: 'The follower user ID.',
}) })
public followerId: User['id']; public followerId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public follower: User | null; public follower: User | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: 'id of Follow Activity.' comment: 'id of Follow Activity.',
}) })
public requestId: string | null; public requestId: string | null;
//#region Denormalized fields //#region Denormalized fields
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followerHost: string | null; public followerHost: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followerInbox: string | null; public followerInbox: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followerSharedInbox: string | null; public followerSharedInbox: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followeeHost: string | null; public followeeHost: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followeeInbox: string | null; public followeeInbox: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followeeSharedInbox: string | null; public followeeSharedInbox: string | null;
//#endregion //#endregion

View file

@ -10,19 +10,19 @@ export class Following {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Following.' comment: 'The created date of the Following.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The followee user ID.' comment: 'The followee user ID.',
}) })
public followeeId: User['id']; public followeeId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public followee: User | null; public followee: User | null;
@ -30,12 +30,12 @@ export class Following {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The follower user ID.' comment: 'The follower user ID.',
}) })
public followerId: User['id']; public followerId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public follower: User | null; public follower: User | null;
@ -43,37 +43,37 @@ export class Following {
//#region Denormalized fields //#region Denormalized fields
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followerHost: string | null; public followerHost: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followerInbox: string | null; public followerInbox: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followerSharedInbox: string | null; public followerSharedInbox: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followeeHost: string | null; public followeeHost: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followeeInbox: string | null; public followeeInbox: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public followeeSharedInbox: string | null; public followeeSharedInbox: string | null;
//#endregion //#endregion

View file

@ -17,7 +17,7 @@ export class GalleryLike {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -26,7 +26,7 @@ export class GalleryLike {
public postId: GalleryPost['id']; public postId: GalleryPost['id'];
@ManyToOne(type => GalleryPost, { @ManyToOne(type => GalleryPost, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public post: GalleryPost | null; public post: GalleryPost | null;

View file

@ -10,13 +10,13 @@ export class GalleryPost {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the GalleryPost.' comment: 'The created date of the GalleryPost.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The updated date of the GalleryPost.' comment: 'The updated date of the GalleryPost.',
}) })
public updatedAt: Date; public updatedAt: Date;
@ -26,19 +26,19 @@ export class GalleryPost {
public title: string; public title: string;
@Column('varchar', { @Column('varchar', {
length: 2048, nullable: true length: 2048, nullable: true,
}) })
public description: string | null; public description: string | null;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The ID of author.' comment: 'The ID of author.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -46,26 +46,26 @@ export class GalleryPost {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
array: true, default: '{}' array: true, default: '{}',
}) })
public fileIds: DriveFile['id'][]; public fileIds: DriveFile['id'][];
@Index() @Index()
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the post is sensitive.' comment: 'Whether the post is sensitive.',
}) })
public isSensitive: boolean; public isSensitive: boolean;
@Index() @Index()
@Column('integer', { @Column('integer', {
default: 0 default: 0,
}) })
public likedCount: number; public likedCount: number;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, array: true, default: '{}' length: 128, array: true, default: '{}',
}) })
public tags: string[]; public tags: string[];

View file

@ -9,13 +9,13 @@ export class ReversiGame {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the ReversiGame.' comment: 'The created date of the ReversiGame.',
}) })
public createdAt: Date; public createdAt: Date;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
nullable: true, nullable: true,
comment: 'The started date of the ReversiGame.' comment: 'The started date of the ReversiGame.',
}) })
public startedAt: Date | null; public startedAt: Date | null;
@ -23,7 +23,7 @@ export class ReversiGame {
public user1Id: User['id']; public user1Id: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user1: User | null; public user1: User | null;
@ -32,7 +32,7 @@ export class ReversiGame {
public user2Id: User['id']; public user2Id: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user2: User | null; public user2: User | null;
@ -69,13 +69,13 @@ export class ReversiGame {
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public winnerId: User['id'] | null; public winnerId: User['id'] | null;
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public surrendered: User['id'] | null; public surrendered: User['id'] | null;
@ -94,7 +94,7 @@ export class ReversiGame {
public map: string[]; public map: string[];
@Column('varchar', { @Column('varchar', {
length: 32 length: 32,
}) })
public bw: string; public bw: string;
@ -127,7 +127,7 @@ export class ReversiGame {
* posを文字列としてすべて連結したもののCRC32値 * posを文字列としてすべて連結したもののCRC32値
*/ */
@Column('varchar', { @Column('varchar', {
length: 32, nullable: true length: 32, nullable: true,
}) })
public crc32: string | null; public crc32: string | null;
} }

View file

@ -9,7 +9,7 @@ export class ReversiMatching {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the ReversiMatching.' comment: 'The created date of the ReversiMatching.',
}) })
public createdAt: Date; public createdAt: Date;
@ -18,7 +18,7 @@ export class ReversiMatching {
public parentId: User['id']; public parentId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public parent: User | null; public parent: User | null;
@ -28,7 +28,7 @@ export class ReversiMatching {
public childId: User['id']; public childId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public child: User | null; public child: User | null;

View file

@ -9,7 +9,7 @@ export class Hashtag {
@Index({ unique: true }) @Index({ unique: true })
@Column('varchar', { @Column('varchar', {
length: 128 length: 128,
}) })
public name: string; public name: string;
@ -21,7 +21,7 @@ export class Hashtag {
@Index() @Index()
@Column('integer', { @Column('integer', {
default: 0 default: 0,
}) })
public mentionedUsersCount: number; public mentionedUsersCount: number;
@ -33,7 +33,7 @@ export class Hashtag {
@Index() @Index()
@Column('integer', { @Column('integer', {
default: 0 default: 0,
}) })
public mentionedLocalUsersCount: number; public mentionedLocalUsersCount: number;
@ -45,7 +45,7 @@ export class Hashtag {
@Index() @Index()
@Column('integer', { @Column('integer', {
default: 0 default: 0,
}) })
public mentionedRemoteUsersCount: number; public mentionedRemoteUsersCount: number;
@ -57,7 +57,7 @@ export class Hashtag {
@Index() @Index()
@Column('integer', { @Column('integer', {
default: 0 default: 0,
}) })
public attachedUsersCount: number; public attachedUsersCount: number;
@ -69,7 +69,7 @@ export class Hashtag {
@Index() @Index()
@Column('integer', { @Column('integer', {
default: 0 default: 0,
}) })
public attachedLocalUsersCount: number; public attachedLocalUsersCount: number;
@ -81,7 +81,7 @@ export class Hashtag {
@Index() @Index()
@Column('integer', { @Column('integer', {
default: 0 default: 0,
}) })
public attachedRemoteUsersCount: number; public attachedRemoteUsersCount: number;
} }

View file

@ -11,7 +11,7 @@ export class Instance {
*/ */
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The caught date of the Instance.' comment: 'The caught date of the Instance.',
}) })
public caughtAt: Date; public caughtAt: Date;
@ -21,7 +21,7 @@ export class Instance {
@Index({ unique: true }) @Index({ unique: true })
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
comment: 'The host of the Instance.' comment: 'The host of the Instance.',
}) })
public host: string; public host: string;
@ -30,7 +30,7 @@ export class Instance {
*/ */
@Column('integer', { @Column('integer', {
default: 0, default: 0,
comment: 'The count of the users of the Instance.' comment: 'The count of the users of the Instance.',
}) })
public usersCount: number; public usersCount: number;
@ -39,7 +39,7 @@ export class Instance {
*/ */
@Column('integer', { @Column('integer', {
default: 0, default: 0,
comment: 'The count of the notes of the Instance.' comment: 'The count of the notes of the Instance.',
}) })
public notesCount: number; public notesCount: number;
@ -109,7 +109,7 @@ export class Instance {
* *
*/ */
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public isNotResponding: boolean; public isNotResponding: boolean;
@ -118,13 +118,13 @@ export class Instance {
*/ */
@Index() @Index()
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public isSuspended: boolean; public isSuspended: boolean;
@Column('varchar', { @Column('varchar', {
length: 64, nullable: true, default: null, length: 64, nullable: true, default: null,
comment: 'The software of the Instance.' comment: 'The software of the Instance.',
}) })
public softwareName: string | null; public softwareName: string | null;

View file

@ -11,19 +11,19 @@ export class MessagingMessage {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the MessagingMessage.' comment: 'The created date of the MessagingMessage.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The sender user ID.' comment: 'The sender user ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -31,12 +31,12 @@ export class MessagingMessage {
@Index() @Index()
@Column({ @Column({
...id(), nullable: true, ...id(), nullable: true,
comment: 'The recipient user ID.' comment: 'The recipient user ID.',
}) })
public recipientId: User['id'] | null; public recipientId: User['id'] | null;
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public recipient: User | null; public recipient: User | null;
@ -44,18 +44,18 @@ export class MessagingMessage {
@Index() @Index()
@Column({ @Column({
...id(), nullable: true, ...id(), nullable: true,
comment: 'The recipient group ID.' comment: 'The recipient group ID.',
}) })
public groupId: UserGroup['id'] | null; public groupId: UserGroup['id'] | null;
@ManyToOne(type => UserGroup, { @ManyToOne(type => UserGroup, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public group: UserGroup | null; public group: UserGroup | null;
@Column('varchar', { @Column('varchar', {
length: 4096, nullable: true length: 4096, nullable: true,
}) })
public text: string | null; public text: string | null;
@ -71,7 +71,7 @@ export class MessagingMessage {
@Column({ @Column({
...id(), ...id(),
array: true, default: '{}' array: true, default: '{}',
}) })
public reads: User['id'][]; public reads: User['id'][];
@ -82,7 +82,7 @@ export class MessagingMessage {
public fileId: DriveFile['id'] | null; public fileId: DriveFile['id'] | null;
@ManyToOne(type => DriveFile, { @ManyToOne(type => DriveFile, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public file: DriveFile | null; public file: DriveFile | null;

View file

@ -7,17 +7,17 @@ import { Clip } from './clip';
export class Meta { export class Meta {
@PrimaryColumn({ @PrimaryColumn({
type: 'varchar', type: 'varchar',
length: 32 length: 32,
}) })
public id: string; public id: string;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true length: 128, nullable: true,
}) })
public name: string | null; public name: string | null;
@Column('varchar', { @Column('varchar', {
length: 1024, nullable: true length: 1024, nullable: true,
}) })
public description: string | null; public description: string | null;
@ -25,7 +25,7 @@ export class Meta {
* *
*/ */
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true length: 128, nullable: true,
}) })
public maintainerName: string | null; public maintainerName: string | null;
@ -33,7 +33,7 @@ export class Meta {
* *
*/ */
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true length: 128, nullable: true,
}) })
public maintainerEmail: string | null; public maintainerEmail: string | null;
@ -58,27 +58,27 @@ export class Meta {
public useStarForReactionFallback: boolean; public useStarForReactionFallback: boolean;
@Column('varchar', { @Column('varchar', {
length: 64, array: true, default: '{}' length: 64, array: true, default: '{}',
}) })
public langs: string[]; public langs: string[];
@Column('varchar', { @Column('varchar', {
length: 256, array: true, default: '{}' length: 256, array: true, default: '{}',
}) })
public pinnedUsers: string[]; public pinnedUsers: string[];
@Column('varchar', { @Column('varchar', {
length: 256, array: true, default: '{}' length: 256, array: true, default: '{}',
}) })
public hiddenTags: string[]; public hiddenTags: string[];
@Column('varchar', { @Column('varchar', {
length: 256, array: true, default: '{}' length: 256, array: true, default: '{}',
}) })
public blockedHosts: string[]; public blockedHosts: string[];
@Column('varchar', { @Column('varchar', {
length: 512, array: true, default: '{"/featured", "/channels", "/explore", "/pages", "/about-misskey"}' length: 512, array: true, default: '{"/featured", "/channels", "/explore", "/pages", "/about-misskey"}',
}) })
public pinnedPages: string[]; public pinnedPages: string[];
@ -91,38 +91,38 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true, nullable: true,
default: '/assets/ai.png' default: '/assets/ai.png',
}) })
public mascotImageUrl: string | null; public mascotImageUrl: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public bannerUrl: string | null; public bannerUrl: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public backgroundImageUrl: string | null; public backgroundImageUrl: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public logoImageUrl: string | null; public logoImageUrl: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true, nullable: true,
default: 'https://xn--931a.moe/aiart/yubitun.png' default: 'https://xn--931a.moe/aiart/yubitun.png',
}) })
public errorImageUrl: string | null; public errorImageUrl: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public iconUrl: string | null; public iconUrl: string | null;
@ -143,7 +143,7 @@ export class Meta {
public proxyAccountId: User['id'] | null; public proxyAccountId: User['id'] | null;
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public proxyAccount: User | null; public proxyAccount: User | null;
@ -160,13 +160,13 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 64, length: 64,
nullable: true nullable: true,
}) })
public hcaptchaSiteKey: string | null; public hcaptchaSiteKey: string | null;
@Column('varchar', { @Column('varchar', {
length: 64, length: 64,
nullable: true nullable: true,
}) })
public hcaptchaSecretKey: string | null; public hcaptchaSecretKey: string | null;
@ -177,37 +177,37 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 64, length: 64,
nullable: true nullable: true,
}) })
public recaptchaSiteKey: string | null; public recaptchaSiteKey: string | null;
@Column('varchar', { @Column('varchar', {
length: 64, length: 64,
nullable: true nullable: true,
}) })
public recaptchaSecretKey: string | null; public recaptchaSecretKey: string | null;
@Column('integer', { @Column('integer', {
default: 1024, default: 1024,
comment: 'Drive capacity of a local user (MB)' comment: 'Drive capacity of a local user (MB)',
}) })
public localDriveCapacityMb: number; public localDriveCapacityMb: number;
@Column('integer', { @Column('integer', {
default: 32, default: 32,
comment: 'Drive capacity of a remote user (MB)' comment: 'Drive capacity of a remote user (MB)',
}) })
public remoteDriveCapacityMb: number; public remoteDriveCapacityMb: number;
@Column('integer', { @Column('integer', {
default: 500, default: 500,
comment: 'Max allowed note text length in characters' comment: 'Max allowed note text length in characters',
}) })
public maxNoteTextLength: number; public maxNoteTextLength: number;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public summalyProxy: string | null; public summalyProxy: string | null;
@ -218,7 +218,7 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public email: string | null; public email: string | null;
@ -229,24 +229,24 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public smtpHost: string | null; public smtpHost: string | null;
@Column('integer', { @Column('integer', {
nullable: true nullable: true,
}) })
public smtpPort: number | null; public smtpPort: number | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public smtpUser: string | null; public smtpUser: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public smtpPass: string | null; public smtpPass: string | null;
@ -257,13 +257,13 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public swPublicKey: string | null; public swPublicKey: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public swPrivateKey: string | null; public swPrivateKey: string | null;
@ -274,13 +274,13 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public twitterConsumerKey: string | null; public twitterConsumerKey: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public twitterConsumerSecret: string | null; public twitterConsumerSecret: string | null;
@ -291,13 +291,13 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public githubClientId: string | null; public githubClientId: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public githubClientSecret: string | null; public githubClientSecret: string | null;
@ -308,19 +308,19 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public discordClientId: string | null; public discordClientId: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public discordClientSecret: string | null; public discordClientSecret: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
nullable: true nullable: true,
}) })
public deeplAuthKey: string | null; public deeplAuthKey: string | null;
@ -331,21 +331,21 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public ToSUrl: string | null; public ToSUrl: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
default: 'https://github.com/misskey-dev/misskey', default: 'https://github.com/misskey-dev/misskey',
nullable: false nullable: false,
}) })
public repositoryUrl: string; public repositoryUrl: string;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
default: 'https://github.com/misskey-dev/misskey/issues/new', default: 'https://github.com/misskey-dev/misskey/issues/new',
nullable: true nullable: true,
}) })
public feedbackUrl: string | null; public feedbackUrl: string | null;
@ -356,48 +356,48 @@ export class Meta {
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public objectStorageBucket: string | null; public objectStorageBucket: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public objectStoragePrefix: string | null; public objectStoragePrefix: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public objectStorageBaseUrl: string | null; public objectStorageBaseUrl: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public objectStorageEndpoint: string | null; public objectStorageEndpoint: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public objectStorageRegion: string | null; public objectStorageRegion: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public objectStorageAccessKey: string | null; public objectStorageAccessKey: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true nullable: true,
}) })
public objectStorageSecretKey: string | null; public objectStorageSecretKey: string | null;
@Column('integer', { @Column('integer', {
nullable: true nullable: true,
}) })
public objectStoragePort: number | null; public objectStoragePort: number | null;

View file

@ -8,7 +8,7 @@ export class ModerationLog {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the ModerationLog.' comment: 'The created date of the ModerationLog.',
}) })
public createdAt: Date; public createdAt: Date;
@ -17,7 +17,7 @@ export class ModerationLog {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;

View file

@ -13,12 +13,12 @@ export class MutedNote {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The note ID.' comment: 'The note ID.',
}) })
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;
@ -26,12 +26,12 @@ export class MutedNote {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The user ID.' comment: 'The user ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -42,7 +42,7 @@ export class MutedNote {
@Index() @Index()
@Column('enum', { @Column('enum', {
enum: mutedNoteReasons, enum: mutedNoteReasons,
comment: 'The reason of the MutedNote.' comment: 'The reason of the MutedNote.',
}) })
public reason: typeof mutedNoteReasons[number]; public reason: typeof mutedNoteReasons[number];
} }

View file

@ -10,19 +10,19 @@ export class Muting {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Muting.' comment: 'The created date of the Muting.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The mutee user ID.' comment: 'The mutee user ID.',
}) })
public muteeId: User['id']; public muteeId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public mutee: User | null; public mutee: User | null;
@ -30,12 +30,12 @@ export class Muting {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The muter user ID.' comment: 'The muter user ID.',
}) })
public muterId: User['id']; public muterId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public muter: User | null; public muter: User | null;

View file

@ -10,7 +10,7 @@ export class NoteFavorite {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the NoteFavorite.' comment: 'The created date of the NoteFavorite.',
}) })
public createdAt: Date; public createdAt: Date;
@ -19,7 +19,7 @@ export class NoteFavorite {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -28,7 +28,7 @@ export class NoteFavorite {
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;

View file

@ -11,7 +11,7 @@ export class NoteReaction {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the NoteReaction.' comment: 'The created date of the NoteReaction.',
}) })
public createdAt: Date; public createdAt: Date;
@ -20,7 +20,7 @@ export class NoteReaction {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user?: User | null; public user?: User | null;
@ -30,7 +30,7 @@ export class NoteReaction {
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note?: Note | null; public note?: Note | null;
@ -38,7 +38,7 @@ export class NoteReaction {
// TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため) // TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため)
@Column('varchar', { @Column('varchar', {
length: 260 length: 260,
}) })
public reaction: string; public reaction: string;
} }

View file

@ -20,7 +20,7 @@ export class NoteThreadMuting {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;

View file

@ -15,7 +15,7 @@ export class NoteUnread {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -25,7 +25,7 @@ export class NoteUnread {
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;
@ -48,7 +48,7 @@ export class NoteUnread {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public noteUserId: User['id']; public noteUserId: User['id'];
@ -56,7 +56,7 @@ export class NoteUnread {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public noteChannelId: Channel['id'] | null; public noteChannelId: Channel['id'] | null;
//#endregion //#endregion

View file

@ -11,19 +11,19 @@ export class NoteWatching {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the NoteWatching.' comment: 'The created date of the NoteWatching.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The watcher ID.' comment: 'The watcher ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -31,12 +31,12 @@ export class NoteWatching {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The target Note ID.' comment: 'The target Note ID.',
}) })
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;
@ -45,7 +45,7 @@ export class NoteWatching {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public noteUserId: Note['userId']; public noteUserId: Note['userId'];
//#endregion //#endregion

View file

@ -15,7 +15,7 @@ export class Note {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Note.' comment: 'The created date of the Note.',
}) })
public createdAt: Date; public createdAt: Date;
@ -23,12 +23,12 @@ export class Note {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The ID of reply target.' comment: 'The ID of reply target.',
}) })
public replyId: Note['id'] | null; public replyId: Note['id'] | null;
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public reply: Note | null; public reply: Note | null;
@ -37,67 +37,67 @@ export class Note {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The ID of renote target.' comment: 'The ID of renote target.',
}) })
public renoteId: Note['id'] | null; public renoteId: Note['id'] | null;
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public renote: Note | null; public renote: Note | null;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 256, nullable: true length: 256, nullable: true,
}) })
public threadId: string | null; public threadId: string | null;
@Column('varchar', { @Column('varchar', {
length: 8192, nullable: true length: 8192, nullable: true,
}) })
public text: string | null; public text: string | null;
@Column('varchar', { @Column('varchar', {
length: 256, nullable: true length: 256, nullable: true,
}) })
public name: string | null; public name: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true length: 512, nullable: true,
}) })
public cw: string | null; public cw: string | null;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The ID of author.' comment: 'The ID of author.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public localOnly: boolean; public localOnly: boolean;
@Column('smallint', { @Column('smallint', {
default: 0 default: 0,
}) })
public renoteCount: number; public renoteCount: number;
@Column('smallint', { @Column('smallint', {
default: 0 default: 0,
}) })
public repliesCount: number; public repliesCount: number;
@Column('jsonb', { @Column('jsonb', {
default: {} default: {},
}) })
public reactions: Record<string, number>; public reactions: Record<string, number>;
@ -113,66 +113,66 @@ export class Note {
@Index({ unique: true }) @Index({ unique: true })
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The URI of a note. it will be null when the note is local.' comment: 'The URI of a note. it will be null when the note is local.',
}) })
public uri: string | null; public uri: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The human readable url of a note. it will be null when the note is local.' comment: 'The human readable url of a note. it will be null when the note is local.',
}) })
public url: string | null; public url: string | null;
@Column('integer', { @Column('integer', {
default: 0, select: false default: 0, select: false,
}) })
public score: number; public score: number;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
array: true, default: '{}' array: true, default: '{}',
}) })
public fileIds: DriveFile['id'][]; public fileIds: DriveFile['id'][];
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 256, array: true, default: '{}' length: 256, array: true, default: '{}',
}) })
public attachedFileTypes: string[]; public attachedFileTypes: string[];
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
array: true, default: '{}' array: true, default: '{}',
}) })
public visibleUserIds: User['id'][]; public visibleUserIds: User['id'][];
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
array: true, default: '{}' array: true, default: '{}',
}) })
public mentions: User['id'][]; public mentions: User['id'][];
@Column('text', { @Column('text', {
default: '[]' default: '[]',
}) })
public mentionedRemoteUsers: string; public mentionedRemoteUsers: string;
@Column('varchar', { @Column('varchar', {
length: 128, array: true, default: '{}' length: 128, array: true, default: '{}',
}) })
public emojis: string[]; public emojis: string[];
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, array: true, default: '{}' length: 128, array: true, default: '{}',
}) })
public tags: string[]; public tags: string[];
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public hasPoll: boolean; public hasPoll: boolean;
@ -180,12 +180,12 @@ export class Note {
@Column({ @Column({
...id(), ...id(),
nullable: true, default: null, nullable: true, default: null,
comment: 'The ID of source channel.' comment: 'The ID of source channel.',
}) })
public channelId: Channel['id'] | null; public channelId: Channel['id'] | null;
@ManyToOne(type => Channel, { @ManyToOne(type => Channel, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public channel: Channel | null; public channel: Channel | null;
@ -194,33 +194,33 @@ export class Note {
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public userHost: string | null; public userHost: string | null;
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public replyUserId: User['id'] | null; public replyUserId: User['id'] | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public replyUserHost: string | null; public replyUserHost: string | null;
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public renoteUserId: User['id'] | null; public renoteUserId: User['id'] | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public renoteUserHost: string | null; public renoteUserHost: string | null;
//#endregion //#endregion

View file

@ -14,7 +14,7 @@ export class Notification {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Notification.' comment: 'The created date of the Notification.',
}) })
public createdAt: Date; public createdAt: Date;
@ -24,12 +24,12 @@ export class Notification {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The ID of recipient user of the Notification.' comment: 'The ID of recipient user of the Notification.',
}) })
public notifieeId: User['id']; public notifieeId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public notifiee: User | null; public notifiee: User | null;
@ -41,12 +41,12 @@ export class Notification {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The ID of sender user of the Notification.' comment: 'The ID of sender user of the Notification.',
}) })
public notifierId: User['id'] | null; public notifierId: User['id'] | null;
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public notifier: User | null; public notifier: User | null;
@ -68,7 +68,7 @@ export class Notification {
@Index() @Index()
@Column('enum', { @Column('enum', {
enum: notificationTypes, enum: notificationTypes,
comment: 'The type of the Notification.' comment: 'The type of the Notification.',
}) })
public type: typeof notificationTypes[number]; public type: typeof notificationTypes[number];
@ -78,53 +78,53 @@ export class Notification {
@Index() @Index()
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the Notification is read.' comment: 'Whether the Notification is read.',
}) })
public isRead: boolean; public isRead: boolean;
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public noteId: Note['id'] | null; public noteId: Note['id'] | null;
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public followRequestId: FollowRequest['id'] | null; public followRequestId: FollowRequest['id'] | null;
@ManyToOne(type => FollowRequest, { @ManyToOne(type => FollowRequest, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public followRequest: FollowRequest | null; public followRequest: FollowRequest | null;
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public userGroupInvitationId: UserGroupInvitation['id'] | null; public userGroupInvitationId: UserGroupInvitation['id'] | null;
@ManyToOne(type => UserGroupInvitation, { @ManyToOne(type => UserGroupInvitation, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public userGroupInvitation: UserGroupInvitation | null; public userGroupInvitation: UserGroupInvitation | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true length: 128, nullable: true,
}) })
public reaction: string | null; public reaction: string | null;
@Column('integer', { @Column('integer', {
nullable: true nullable: true,
}) })
public choice: number | null; public choice: number | null;
@ -132,7 +132,7 @@ export class Notification {
* body * body
*/ */
@Column('varchar', { @Column('varchar', {
length: 2048, nullable: true length: 2048, nullable: true,
}) })
public customBody: string | null; public customBody: string | null;
@ -141,7 +141,7 @@ export class Notification {
* () * ()
*/ */
@Column('varchar', { @Column('varchar', {
length: 256, nullable: true length: 256, nullable: true,
}) })
public customHeader: string | null; public customHeader: string | null;
@ -150,7 +150,7 @@ export class Notification {
* () * ()
*/ */
@Column('varchar', { @Column('varchar', {
length: 1024, nullable: true length: 1024, nullable: true,
}) })
public customIcon: string | null; public customIcon: string | null;
@ -160,12 +160,12 @@ export class Notification {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public appAccessTokenId: AccessToken['id'] | null; public appAccessTokenId: AccessToken['id'] | null;
@ManyToOne(type => AccessToken, { @ManyToOne(type => AccessToken, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public appAccessToken: AccessToken | null; public appAccessToken: AccessToken | null;

View file

@ -17,7 +17,7 @@ export class PageLike {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -26,7 +26,7 @@ export class PageLike {
public pageId: Page['id']; public pageId: Page['id'];
@ManyToOne(type => Page, { @ManyToOne(type => Page, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public page: Page | null; public page: Page | null;

View file

@ -11,13 +11,13 @@ export class Page {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Page.' comment: 'The created date of the Page.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The updated date of the Page.' comment: 'The updated date of the Page.',
}) })
public updatedAt: Date; public updatedAt: Date;
@ -33,7 +33,7 @@ export class Page {
public name: string; public name: string;
@Column('varchar', { @Column('varchar', {
length: 256, nullable: true length: 256, nullable: true,
}) })
public summary: string | null; public summary: string | null;
@ -41,7 +41,7 @@ export class Page {
public alignCenter: boolean; public alignCenter: boolean;
@Column('boolean', { @Column('boolean', {
default: false default: false,
}) })
public hideTitleWhenPinned: boolean; public hideTitleWhenPinned: boolean;
@ -53,12 +53,12 @@ export class Page {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The ID of author.' comment: 'The ID of author.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -70,24 +70,24 @@ export class Page {
public eyeCatchingImageId: DriveFile['id'] | null; public eyeCatchingImageId: DriveFile['id'] | null;
@ManyToOne(type => DriveFile, { @ManyToOne(type => DriveFile, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public eyeCatchingImage: DriveFile | null; public eyeCatchingImage: DriveFile | null;
@Column('jsonb', { @Column('jsonb', {
default: [] default: [],
}) })
public content: Record<string, any>[]; public content: Record<string, any>[];
@Column('jsonb', { @Column('jsonb', {
default: [] default: [],
}) })
public variables: Record<string, any>[]; public variables: Record<string, any>[];
@Column('varchar', { @Column('varchar', {
length: 16384, length: 16384,
default: '' default: '',
}) })
public script: string; public script: string;
@ -102,12 +102,12 @@ export class Page {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
array: true, default: '{}' array: true, default: '{}',
}) })
public visibleUserIds: User['id'][]; public visibleUserIds: User['id'][];
@Column('integer', { @Column('integer', {
default: 0 default: 0,
}) })
public likedCount: number; public likedCount: number;

View file

@ -23,7 +23,7 @@ export class PasswordResetRequest {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;

View file

@ -11,7 +11,7 @@ export class PollVote {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the PollVote.' comment: 'The created date of the PollVote.',
}) })
public createdAt: Date; public createdAt: Date;
@ -20,7 +20,7 @@ export class PollVote {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -30,7 +30,7 @@ export class PollVote {
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;

View file

@ -10,13 +10,13 @@ export class Poll {
public noteId: Note['id']; public noteId: Note['id'];
@OneToOne(type => Note, { @OneToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
nullable: true nullable: true,
}) })
public expiresAt: Date | null; public expiresAt: Date | null;
@ -24,7 +24,7 @@ export class Poll {
public multiple: boolean; public multiple: boolean;
@Column('varchar', { @Column('varchar', {
length: 128, array: true, default: '{}' length: 128, array: true, default: '{}',
}) })
public choices: string[]; public choices: string[];
@ -36,21 +36,21 @@ export class Poll {
//#region Denormalized fields //#region Denormalized fields
@Column('enum', { @Column('enum', {
enum: noteVisibilities, enum: noteVisibilities,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public noteVisibility: typeof noteVisibilities[number]; public noteVisibility: typeof noteVisibilities[number];
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public userId: User['id']; public userId: User['id'];
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public userHost: string | null; public userHost: string | null;
//#endregion //#endregion

View file

@ -9,7 +9,7 @@ export class PromoNote {
public noteId: Note['id']; public noteId: Note['id'];
@OneToOne(type => Note, { @OneToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;
@ -21,7 +21,7 @@ export class PromoNote {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public userId: User['id']; public userId: User['id'];
//#endregion //#endregion

View file

@ -10,7 +10,7 @@ export class PromoRead {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the PromoRead.' comment: 'The created date of the PromoRead.',
}) })
public createdAt: Date; public createdAt: Date;
@ -19,7 +19,7 @@ export class PromoRead {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -28,7 +28,7 @@ export class PromoRead {
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;

View file

@ -9,50 +9,50 @@ export class RegistryItem {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the RegistryItem.' comment: 'The created date of the RegistryItem.',
}) })
public createdAt: Date; public createdAt: Date;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The updated date of the RegistryItem.' comment: 'The updated date of the RegistryItem.',
}) })
public updatedAt: Date; public updatedAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The owner ID.' comment: 'The owner ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@Column('varchar', { @Column('varchar', {
length: 1024, length: 1024,
comment: 'The key of the RegistryItem.' comment: 'The key of the RegistryItem.',
}) })
public key: string; public key: string;
@Column('jsonb', { @Column('jsonb', {
default: {}, nullable: true, default: {}, nullable: true,
comment: 'The value of the RegistryItem.' comment: 'The value of the RegistryItem.',
}) })
public value: any | null; public value: any | null;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 1024, array: true, default: '{}' length: 1024, array: true, default: '{}',
}) })
public scope: string[]; public scope: string[];
// サードパーティアプリに開放するときのためのカラム // サードパーティアプリに開放するときのためのカラム
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true length: 512, nullable: true,
}) })
public domain: string | null; public domain: string | null;
} }

View file

@ -8,7 +8,7 @@ export class Signin {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the Signin.' comment: 'The created date of the Signin.',
}) })
public createdAt: Date; public createdAt: Date;
@ -17,7 +17,7 @@ export class Signin {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;

View file

@ -15,7 +15,7 @@ export class SwSubscription {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;

View file

@ -10,19 +10,19 @@ export class UserGroupInvitation {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the UserGroupInvitation.' comment: 'The created date of the UserGroupInvitation.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The user ID.' comment: 'The user ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -30,12 +30,12 @@ export class UserGroupInvitation {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The group ID.' comment: 'The group ID.',
}) })
public userGroupId: UserGroup['id']; public userGroupId: UserGroup['id'];
@ManyToOne(type => UserGroup, { @ManyToOne(type => UserGroup, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public userGroup: UserGroup | null; public userGroup: UserGroup | null;

View file

@ -10,19 +10,19 @@ export class UserGroupJoining {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the UserGroupJoining.' comment: 'The created date of the UserGroupJoining.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The user ID.' comment: 'The user ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -30,12 +30,12 @@ export class UserGroupJoining {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The group ID.' comment: 'The group ID.',
}) })
public userGroupId: UserGroup['id']; public userGroupId: UserGroup['id'];
@ManyToOne(type => UserGroup, { @ManyToOne(type => UserGroup, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public userGroup: UserGroup | null; public userGroup: UserGroup | null;

View file

@ -9,7 +9,7 @@ export class UserGroup {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the UserGroup.' comment: 'The created date of the UserGroup.',
}) })
public createdAt: Date; public createdAt: Date;
@ -21,12 +21,12 @@ export class UserGroup {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The ID of owner.' comment: 'The ID of owner.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;

View file

@ -8,7 +8,7 @@ export class UserKeypair {
public userId: User['id']; public userId: User['id'];
@OneToOne(type => User, { @OneToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;

View file

@ -10,19 +10,19 @@ export class UserListJoining {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the UserListJoining.' comment: 'The created date of the UserListJoining.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The user ID.' comment: 'The user ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -30,12 +30,12 @@ export class UserListJoining {
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The list ID.' comment: 'The list ID.',
}) })
public userListId: UserList['id']; public userListId: UserList['id'];
@ManyToOne(type => UserList, { @ManyToOne(type => UserList, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public userList: UserList | null; public userList: UserList | null;

View file

@ -8,26 +8,26 @@ export class UserList {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the UserList.' comment: 'The created date of the UserList.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column({ @Column({
...id(), ...id(),
comment: 'The owner ID.' comment: 'The owner ID.',
}) })
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
comment: 'The name of the UserList.' comment: 'The name of the UserList.',
}) })
public name: string; public name: string;
} }

View file

@ -10,7 +10,7 @@ export class UserNotePining {
public id: string; public id: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the UserNotePinings.' comment: 'The created date of the UserNotePinings.',
}) })
public createdAt: Date; public createdAt: Date;
@ -19,7 +19,7 @@ export class UserNotePining {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -28,7 +28,7 @@ export class UserNotePining {
public noteId: Note['id']; public noteId: Note['id'];
@ManyToOne(type => Note, { @ManyToOne(type => Note, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public note: Note | null; public note: Note | null;

View file

@ -12,26 +12,26 @@ export class UserProfile {
public userId: User['id']; public userId: User['id'];
@OneToOne(type => User, { @OneToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: 'The location of the User.' comment: 'The location of the User.',
}) })
public location: string | null; public location: string | null;
@Column('char', { @Column('char', {
length: 10, nullable: true, length: 10, nullable: true,
comment: 'The birthday (YYYY-MM-DD) of the User.' comment: 'The birthday (YYYY-MM-DD) of the User.',
}) })
public birthday: string | null; public birthday: string | null;
@Column('varchar', { @Column('varchar', {
length: 2048, nullable: true, length: 2048, nullable: true,
comment: 'The description (bio) of the User.' comment: 'The description (bio) of the User.',
}) })
public description: string | null; public description: string | null;
@ -50,13 +50,13 @@ export class UserProfile {
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'Remote URL of the user.' comment: 'Remote URL of the user.',
}) })
public url: string | null; public url: string | null;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: 'The email address of the User.' comment: 'The email address of the User.',
}) })
public email: string | null; public email: string | null;
@ -71,7 +71,7 @@ export class UserProfile {
public emailVerified: boolean; public emailVerified: boolean;
@Column('jsonb', { @Column('jsonb', {
default: ['follow', 'receiveFollowRequest', 'groupInvited'] default: ['follow', 'receiveFollowRequest', 'groupInvited'],
}) })
public emailNotificationTypes: string[]; public emailNotificationTypes: string[];
@ -113,20 +113,20 @@ export class UserProfile {
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: 'The password hash of the User. It will be null if the origin of the user is local.' comment: 'The password hash of the User. It will be null if the origin of the user is local.',
}) })
public password: string | null; public password: string | null;
// TODO: そのうち消す // TODO: そのうち消す
@Column('jsonb', { @Column('jsonb', {
default: {}, default: {},
comment: 'The client-specific data of the User.' comment: 'The client-specific data of the User.',
}) })
public clientData: Record<string, any>; public clientData: Record<string, any>;
@Column('jsonb', { @Column('jsonb', {
default: {}, default: {},
comment: 'The room data of the User.' comment: 'The room data of the User.',
}) })
public room: Record<string, any>; public room: Record<string, any>;
@ -137,7 +137,7 @@ export class UserProfile {
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether reject index by crawler.' comment: 'Whether reject index by crawler.',
}) })
public noCrawle: boolean; public noCrawle: boolean;
@ -163,18 +163,18 @@ export class UserProfile {
@Column({ @Column({
...id(), ...id(),
nullable: true nullable: true,
}) })
public pinnedPageId: Page['id'] | null; public pinnedPageId: Page['id'] | null;
@OneToOne(type => Page, { @OneToOne(type => Page, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public pinnedPage: Page | null; public pinnedPage: Page | null;
@Column('jsonb', { @Column('jsonb', {
default: {} default: {},
}) })
public integrations: Record<string, any>; public integrations: Record<string, any>;
@ -185,12 +185,12 @@ export class UserProfile {
public enableWordMute: boolean; public enableWordMute: boolean;
@Column('jsonb', { @Column('jsonb', {
default: [] default: [],
}) })
public mutedWords: string[][]; public mutedWords: string[][];
@Column('jsonb', { @Column('jsonb', {
default: [] default: [],
}) })
public mutedInstances: string[]; public mutedInstances: string[];
@ -205,7 +205,7 @@ export class UserProfile {
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: '[Denormalized]' comment: '[Denormalized]',
}) })
public userHost: string | null; public userHost: string | null;
//#endregion //#endregion

View file

@ -8,7 +8,7 @@ export class UserPublickey {
public userId: User['id']; public userId: User['id'];
@OneToOne(type => User, { @OneToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;

View file

@ -5,7 +5,7 @@ import { id } from '../id';
@Entity() @Entity()
export class UserSecurityKey { export class UserSecurityKey {
@PrimaryColumn('varchar', { @PrimaryColumn('varchar', {
comment: 'Variable-length id given to navigator.credentials.get()' comment: 'Variable-length id given to navigator.credentials.get()',
}) })
public id: string; public id: string;
@ -14,7 +14,7 @@ export class UserSecurityKey {
public userId: User['id']; public userId: User['id'];
@ManyToOne(type => User, { @ManyToOne(type => User, {
onDelete: 'CASCADE' onDelete: 'CASCADE',
}) })
@JoinColumn() @JoinColumn()
public user: User | null; public user: User | null;
@ -22,19 +22,19 @@ export class UserSecurityKey {
@Index() @Index()
@Column('varchar', { @Column('varchar', {
comment: comment:
'Variable-length public key used to verify attestations (hex-encoded).' 'Variable-length public key used to verify attestations (hex-encoded).',
}) })
public publicKey: string; public publicKey: string;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: comment:
'The date of the last time the UserSecurityKey was successfully validated.' 'The date of the last time the UserSecurityKey was successfully validated.',
}) })
public lastUsed: Date; public lastUsed: Date;
@Column('varchar', { @Column('varchar', {
comment: 'User-defined name for this key', comment: 'User-defined name for this key',
length: 30 length: 30,
}) })
public name: string; public name: string;

View file

@ -10,25 +10,25 @@ export class User {
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
comment: 'The created date of the User.' comment: 'The created date of the User.',
}) })
public createdAt: Date; public createdAt: Date;
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
nullable: true, nullable: true,
comment: 'The updated date of the User.' comment: 'The updated date of the User.',
}) })
public updatedAt: Date | null; public updatedAt: Date | null;
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
nullable: true nullable: true,
}) })
public lastFetchedAt: Date | null; public lastFetchedAt: Date | null;
@Index() @Index()
@Column('timestamp with time zone', { @Column('timestamp with time zone', {
nullable: true nullable: true,
}) })
public lastActiveDate: Date | null; public lastActiveDate: Date | null;
@ -39,50 +39,50 @@ export class User {
@Column('varchar', { @Column('varchar', {
length: 128, length: 128,
comment: 'The username of the User.' comment: 'The username of the User.',
}) })
public username: string; public username: string;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, select: false, length: 128, select: false,
comment: 'The username (lowercased) of the User.' comment: 'The username (lowercased) of the User.',
}) })
public usernameLower: string; public usernameLower: string;
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: 'The name of the User.' comment: 'The name of the User.',
}) })
public name: string | null; public name: string | null;
@Column('integer', { @Column('integer', {
default: 0, default: 0,
comment: 'The count of followers.' comment: 'The count of followers.',
}) })
public followersCount: number; public followersCount: number;
@Column('integer', { @Column('integer', {
default: 0, default: 0,
comment: 'The count of following.' comment: 'The count of following.',
}) })
public followingCount: number; public followingCount: number;
@Column('integer', { @Column('integer', {
default: 0, default: 0,
comment: 'The count of notes.' comment: 'The count of notes.',
}) })
public notesCount: number; public notesCount: number;
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The ID of avatar DriveFile.' comment: 'The ID of avatar DriveFile.',
}) })
public avatarId: DriveFile['id'] | null; public avatarId: DriveFile['id'] | null;
@OneToOne(type => DriveFile, { @OneToOne(type => DriveFile, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public avatar: DriveFile | null; public avatar: DriveFile | null;
@ -90,19 +90,19 @@ export class User {
@Column({ @Column({
...id(), ...id(),
nullable: true, nullable: true,
comment: 'The ID of banner DriveFile.' comment: 'The ID of banner DriveFile.',
}) })
public bannerId: DriveFile['id'] | null; public bannerId: DriveFile['id'] | null;
@OneToOne(type => DriveFile, { @OneToOne(type => DriveFile, {
onDelete: 'SET NULL' onDelete: 'SET NULL',
}) })
@JoinColumn() @JoinColumn()
public banner: DriveFile | null; public banner: DriveFile | null;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, array: true, default: '{}' length: 128, array: true, default: '{}',
}) })
public tags: string[]; public tags: string[];
@ -128,107 +128,107 @@ export class User {
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the User is suspended.' comment: 'Whether the User is suspended.',
}) })
public isSuspended: boolean; public isSuspended: boolean;
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the User is silenced.' comment: 'Whether the User is silenced.',
}) })
public isSilenced: boolean; public isSilenced: boolean;
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the User is locked.' comment: 'Whether the User is locked.',
}) })
public isLocked: boolean; public isLocked: boolean;
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the User is a bot.' comment: 'Whether the User is a bot.',
}) })
public isBot: boolean; public isBot: boolean;
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the User is a cat.' comment: 'Whether the User is a cat.',
}) })
public isCat: boolean; public isCat: boolean;
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the User is the admin.' comment: 'Whether the User is the admin.',
}) })
public isAdmin: boolean; public isAdmin: boolean;
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the User is a moderator.' comment: 'Whether the User is a moderator.',
}) })
public isModerator: boolean; public isModerator: boolean;
@Index() @Index()
@Column('boolean', { @Column('boolean', {
default: true, default: true,
comment: 'Whether the User is explorable.' comment: 'Whether the User is explorable.',
}) })
public isExplorable: boolean; public isExplorable: boolean;
// アカウントが削除されたかどうかのフラグだが、完全に削除される際は物理削除なので実質削除されるまでの「削除が進行しているかどうか」のフラグ // アカウントが削除されたかどうかのフラグだが、完全に削除される際は物理削除なので実質削除されるまでの「削除が進行しているかどうか」のフラグ
@Column('boolean', { @Column('boolean', {
default: false, default: false,
comment: 'Whether the User is deleted.' comment: 'Whether the User is deleted.',
}) })
public isDeleted: boolean; public isDeleted: boolean;
@Column('varchar', { @Column('varchar', {
length: 128, array: true, default: '{}' length: 128, array: true, default: '{}',
}) })
public emojis: string[]; public emojis: string[];
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 128, nullable: true, length: 128, nullable: true,
comment: 'The host of the User. It will be null if the origin of the user is local.' comment: 'The host of the User. It will be null if the origin of the user is local.',
}) })
public host: string | null; public host: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The inbox URL of the User. It will be null if the origin of the user is local.' comment: 'The inbox URL of the User. It will be null if the origin of the user is local.',
}) })
public inbox: string | null; public inbox: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The sharedInbox URL of the User. It will be null if the origin of the user is local.' comment: 'The sharedInbox URL of the User. It will be null if the origin of the user is local.',
}) })
public sharedInbox: string | null; public sharedInbox: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The featured URL of the User. It will be null if the origin of the user is local.' comment: 'The featured URL of the User. It will be null if the origin of the user is local.',
}) })
public featured: string | null; public featured: string | null;
@Index() @Index()
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The URI of the User. It will be null if the origin of the user is local.' comment: 'The URI of the User. It will be null if the origin of the user is local.',
}) })
public uri: string | null; public uri: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, nullable: true, length: 512, nullable: true,
comment: 'The URI of the user Follower Collection. It will be null if the origin of the user is local.' comment: 'The URI of the user Follower Collection. It will be null if the origin of the user is local.',
}) })
public followersUri: string | null; public followersUri: string | null;
@Index({ unique: true }) @Index({ unique: true })
@Column('char', { @Column('char', {
length: 16, nullable: true, unique: true, 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.' comment: 'The native access token of the User. It will be null if the origin of the user is local.',
}) })
public token: string | null; public token: string | null;

View file

@ -1,4 +1,4 @@
export const id = () => ({ export const id = () => ({
type: 'varchar' as const, type: 'varchar' as const,
length: 32 length: 32,
}); });

View file

@ -19,13 +19,13 @@ export class AbuseUserReportRepository extends Repository<AbuseUserReport> {
targetUserId: report.targetUserId, targetUserId: report.targetUserId,
assigneeId: report.assigneeId, assigneeId: report.assigneeId,
reporter: Users.pack(report.reporter || report.reporterId, null, { reporter: Users.pack(report.reporter || report.reporterId, null, {
detail: true detail: true,
}), }),
targetUser: Users.pack(report.targetUser || report.targetUserId, null, { targetUser: Users.pack(report.targetUser || report.targetUserId, null, {
detail: true detail: true,
}), }),
assignee: report.assigneeId ? Users.pack(report.assignee || report.assigneeId, null, { assignee: report.assigneeId ? Users.pack(report.assignee || report.assigneeId, null, {
detail: true detail: true,
}) : null, }) : null,
}); });
} }

View file

@ -27,7 +27,7 @@ export class AntennaRepository extends Repository<Antenna> {
notify: antenna.notify, notify: antenna.notify,
withReplies: antenna.withReplies, withReplies: antenna.withReplies,
withFile: antenna.withFile, withFile: antenna.withFile,
hasUnreadNote hasUnreadNote,
}; };
} }
} }
@ -39,16 +39,16 @@ export const packedAntennaSchema = {
id: { id: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'id' format: 'id',
}, },
createdAt: { createdAt: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'date-time' format: 'date-time',
}, },
name: { name: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
keywords: { keywords: {
type: 'array' as const, type: 'array' as const,
@ -58,9 +58,9 @@ export const packedAntennaSchema = {
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
} },
} },
}, },
excludeKeywords: { excludeKeywords: {
type: 'array' as const, type: 'array' as const,
@ -70,55 +70,55 @@ export const packedAntennaSchema = {
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
} },
} },
}, },
src: { src: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
enum: ['home', 'all', 'users', 'list', 'group'] enum: ['home', 'all', 'users', 'list', 'group'],
}, },
userListId: { userListId: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const, optional: false as const, nullable: true as const,
format: 'id' format: 'id',
}, },
userGroupId: { userGroupId: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const, optional: false as const, nullable: true as const,
format: 'id' format: 'id',
}, },
users: { users: {
type: 'array' as const, type: 'array' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
} },
}, },
caseSensitive: { caseSensitive: {
type: 'boolean' as const, type: 'boolean' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
default: false default: false,
}, },
notify: { notify: {
type: 'boolean' as const, type: 'boolean' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
withReplies: { withReplies: {
type: 'boolean' as const, type: 'boolean' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
default: false default: false,
}, },
withFile: { withFile: {
type: 'boolean' as const, type: 'boolean' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
hasUnreadNote: { hasUnreadNote: {
type: 'boolean' as const, type: 'boolean' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
default: false default: false,
} },
}, },
}; };

View file

@ -18,7 +18,7 @@ export class AppRepository extends Repository<App> {
const opts = Object.assign({ const opts = Object.assign({
detail: false, detail: false,
includeSecret: false, includeSecret: false,
includeProfileImageIds: false includeProfileImageIds: false,
}, options); }, options);
const app = typeof src === 'object' ? src : await this.findOneOrFail(src); const app = typeof src === 'object' ? src : await this.findOneOrFail(src);
@ -33,8 +33,8 @@ export class AppRepository extends Repository<App> {
isAuthorized: await AccessTokens.count({ isAuthorized: await AccessTokens.count({
appId: app.id, appId: app.id,
userId: me, userId: me,
}).then(count => count > 0) }).then(count => count > 0),
} : {}) } : {}),
}; };
} }
} }
@ -45,31 +45,31 @@ export const packedAppSchema = {
properties: { properties: {
id: { id: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
name: { name: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
callbackUrl: { callbackUrl: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const optional: false as const, nullable: true as const,
}, },
permission: { permission: {
type: 'array' as const, type: 'array' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
} },
}, },
secret: { secret: {
type: 'string' as const, type: 'string' as const,
optional: true as const, nullable: false as const optional: true as const, nullable: false as const,
}, },
isAuthorized: { isAuthorized: {
type: 'boolean' as const, type: 'boolean' as const,
optional: true as const, nullable: false as const optional: true as const, nullable: false as const,
} },
} },
}; };

View file

@ -15,7 +15,7 @@ export class AuthSessionRepository extends Repository<AuthSession> {
return await awaitAll({ return await awaitAll({
id: session.id, id: session.id,
app: Apps.pack(session.appId, me), app: Apps.pack(session.appId, me),
token: session.token token: session.token,
}); });
} }
} }

View file

@ -18,8 +18,8 @@ export class BlockingRepository extends Repository<Blocking> {
createdAt: blocking.createdAt.toISOString(), createdAt: blocking.createdAt.toISOString(),
blockeeId: blocking.blockeeId, blockeeId: blocking.blockeeId,
blockee: Users.pack(blocking.blockeeId, me, { blockee: Users.pack(blocking.blockeeId, me, {
detail: true detail: true,
}) }),
}); });
} }
@ -56,5 +56,5 @@ export const packedBlockingSchema = {
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
ref: 'User' as const, ref: 'User' as const,
}, },
} },
}; };

View file

@ -36,7 +36,7 @@ export class ChannelRepository extends Repository<Channel> {
...(me ? { ...(me ? {
isFollowing: following != null, isFollowing: following != null,
hasUnreadNote, hasUnreadNote,
} : {}) } : {}),
}; };
} }
} }

View file

@ -46,7 +46,7 @@ export class DriveFileRepository extends Repository<DriveFile> {
if (file.uri != null && file.userHost != null && config.mediaProxy != null) { if (file.uri != null && file.userHost != null && config.mediaProxy != null) {
return appendQuery(config.mediaProxy, query({ return appendQuery(config.mediaProxy, query({
url: file.uri, url: file.uri,
thumbnail: thumbnail ? '1' : undefined thumbnail: thumbnail ? '1' : undefined,
})); }));
} }
@ -118,7 +118,7 @@ export class DriveFileRepository extends Repository<DriveFile> {
): Promise<Packed<'DriveFile'> | null> { ): Promise<Packed<'DriveFile'> | null> {
const opts = Object.assign({ const opts = Object.assign({
detail: false, detail: false,
self: false self: false,
}, options); }, options);
const file = typeof src === 'object' ? src : await this.findOne(src); const file = typeof src === 'object' ? src : await this.findOne(src);
@ -141,10 +141,10 @@ export class DriveFileRepository extends Repository<DriveFile> {
comment: file.comment, comment: file.comment,
folderId: file.folderId, folderId: file.folderId,
folder: opts.detail && file.folderId ? DriveFolders.pack(file.folderId, { folder: opts.detail && file.folderId ? DriveFolders.pack(file.folderId, {
detail: true detail: true,
}) : null, }) : null,
userId: opts.withUser ? file.userId : null, userId: opts.withUser ? file.userId : null,
user: (opts.withUser && file.userId) ? Users.pack(file.userId) : null user: (opts.withUser && file.userId) ? Users.pack(file.userId) : null,
}); });
} }
@ -175,23 +175,23 @@ export const packedDriveFileSchema = {
name: { name: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
example: 'lenna.jpg' example: 'lenna.jpg',
}, },
type: { type: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
example: 'image/jpeg' example: 'image/jpeg',
}, },
md5: { md5: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'md5', format: 'md5',
example: '15eca7fba0480996e2245f5185bf39f2' example: '15eca7fba0480996e2245f5185bf39f2',
}, },
size: { size: {
type: 'number' as const, type: 'number' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
example: 51469 example: 51469,
}, },
isSensitive: { isSensitive: {
type: 'boolean' as const, type: 'boolean' as const,
@ -199,7 +199,7 @@ export const packedDriveFileSchema = {
}, },
blurhash: { blurhash: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const optional: false as const, nullable: true as const,
}, },
properties: { properties: {
type: 'object' as const, type: 'object' as const,
@ -208,24 +208,24 @@ export const packedDriveFileSchema = {
width: { width: {
type: 'number' as const, type: 'number' as const,
optional: true as const, nullable: false as const, optional: true as const, nullable: false as const,
example: 1280 example: 1280,
}, },
height: { height: {
type: 'number' as const, type: 'number' as const,
optional: true as const, nullable: false as const, optional: true as const, nullable: false as const,
example: 720 example: 720,
}, },
orientation: { orientation: {
type: 'number' as const, type: 'number' as const,
optional: true as const, nullable: false as const, optional: true as const, nullable: false as const,
example: 8 example: 8,
}, },
avgColor: { avgColor: {
type: 'string' as const, type: 'string' as const,
optional: true as const, nullable: false as const, optional: true as const, nullable: false as const,
example: 'rgb(40,65,87)' example: 'rgb(40,65,87)',
} },
} },
}, },
url: { url: {
type: 'string' as const, type: 'string' as const,
@ -239,7 +239,7 @@ export const packedDriveFileSchema = {
}, },
comment: { comment: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const optional: false as const, nullable: true as const,
}, },
folderId: { folderId: {
type: 'string' as const, type: 'string' as const,
@ -262,6 +262,6 @@ export const packedDriveFileSchema = {
type: 'object' as const, type: 'object' as const,
optional: true as const, nullable: true as const, optional: true as const, nullable: true as const,
ref: 'User' as const, ref: 'User' as const,
} },
}, },
}; };

View file

@ -20,7 +20,7 @@ export class DriveFolderRepository extends Repository<DriveFolder> {
} }
): Promise<Packed<'DriveFolder'>> { ): Promise<Packed<'DriveFolder'>> {
const opts = Object.assign({ const opts = Object.assign({
detail: false detail: false,
}, options); }, options);
const folder = typeof src === 'object' ? src : await this.findOneOrFail(src); const folder = typeof src === 'object' ? src : await this.findOneOrFail(src);
@ -33,18 +33,18 @@ export class DriveFolderRepository extends Repository<DriveFolder> {
...(opts.detail ? { ...(opts.detail ? {
foldersCount: DriveFolders.count({ foldersCount: DriveFolders.count({
parentId: folder.id parentId: folder.id,
}), }),
filesCount: DriveFiles.count({ filesCount: DriveFiles.count({
folderId: folder.id folderId: folder.id,
}), }),
...(folder.parentId ? { ...(folder.parentId ? {
parent: this.pack(folder.parentId, { parent: this.pack(folder.parentId, {
detail: true detail: true,
}) }),
} : {}) } : {}),
} : {}) } : {}),
}); });
} }
} }

View file

@ -61,5 +61,5 @@ export const packedEmojiSchema = {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
}, },
} },
}; };

View file

@ -7,100 +7,100 @@ export const packedFederationInstanceSchema = {
id: { id: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'id' format: 'id',
}, },
caughtAt: { caughtAt: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'date-time' format: 'date-time',
}, },
host: { host: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
example: 'misskey.example.com' example: 'misskey.example.com',
}, },
usersCount: { usersCount: {
type: 'number' as const, type: 'number' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
notesCount: { notesCount: {
type: 'number' as const, type: 'number' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
followingCount: { followingCount: {
type: 'number' as const, type: 'number' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
followersCount: { followersCount: {
type: 'number' as const, type: 'number' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
driveUsage: { driveUsage: {
type: 'number' as const, type: 'number' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
driveFiles: { driveFiles: {
type: 'number' as const, type: 'number' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
latestRequestSentAt: { latestRequestSentAt: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const, optional: false as const, nullable: true as const,
format: 'date-time' format: 'date-time',
}, },
lastCommunicatedAt: { lastCommunicatedAt: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'date-time' format: 'date-time',
}, },
isNotResponding: { isNotResponding: {
type: 'boolean' as const, type: 'boolean' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
isSuspended: { isSuspended: {
type: 'boolean' as const, type: 'boolean' as const,
optional: false as const, nullable: false as const optional: false as const, nullable: false as const,
}, },
softwareName: { softwareName: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const, optional: false as const, nullable: true as const,
example: 'misskey' example: 'misskey',
}, },
softwareVersion: { softwareVersion: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const, optional: false as const, nullable: true as const,
example: config.version example: config.version,
}, },
openRegistrations: { openRegistrations: {
type: 'boolean' as const, type: 'boolean' as const,
optional: false as const, nullable: true as const, optional: false as const, nullable: true as const,
example: true example: true,
}, },
name: { name: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const optional: false as const, nullable: true as const,
}, },
description: { description: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const optional: false as const, nullable: true as const,
}, },
maintainerName: { maintainerName: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const optional: false as const, nullable: true as const,
}, },
maintainerEmail: { maintainerEmail: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const optional: false as const, nullable: true as const,
}, },
iconUrl: { iconUrl: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const, optional: false as const, nullable: true as const,
format: 'url' format: 'url',
}, },
infoUpdatedAt: { infoUpdatedAt: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: true as const, optional: false as const, nullable: true as const,
format: 'date-time' format: 'date-time',
} },
} },
}; };

View file

@ -65,10 +65,10 @@ export class FollowingRepository extends Repository<Following> {
followeeId: following.followeeId, followeeId: following.followeeId,
followerId: following.followerId, followerId: following.followerId,
followee: opts.populateFollowee ? Users.pack(following.followee || following.followeeId, me, { followee: opts.populateFollowee ? Users.pack(following.followee || following.followeeId, me, {
detail: true detail: true,
}) : undefined, }) : undefined,
follower: opts.populateFollower ? Users.pack(following.follower || following.followerId, me, { follower: opts.populateFollower ? Users.pack(following.follower || following.followerId, me, {
detail: true detail: true,
}) : undefined, }) : undefined,
}); });
} }
@ -120,5 +120,5 @@ export const packedFollowingSchema = {
optional: true as const, nullable: false as const, optional: true as const, nullable: false as const,
ref: 'User' as const, ref: 'User' as const,
}, },
} },
}; };

View file

@ -83,8 +83,8 @@ export const packedGalleryPostSchema = {
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'id' format: 'id',
} },
}, },
files: { files: {
type: 'array' as const, type: 'array' as const,
@ -93,7 +93,7 @@ export const packedGalleryPostSchema = {
type: 'object' as const, type: 'object' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
ref: 'DriveFile' as const, ref: 'DriveFile' as const,
} },
}, },
tags: { tags: {
type: 'array' as const, type: 'array' as const,
@ -101,11 +101,11 @@ export const packedGalleryPostSchema = {
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
} },
}, },
isSensitive: { isSensitive: {
type: 'boolean' as const, type: 'boolean' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
}, },
} },
}; };

View file

@ -14,7 +14,7 @@ export class ReversiGameRepository extends Repository<ReversiGame> {
} }
): Promise<Packed<'ReversiGame'>> { ): Promise<Packed<'ReversiGame'>> {
const opts = Object.assign({ const opts = Object.assign({
detail: true detail: true,
}, options); }, options);
const game = typeof src === 'object' ? src : await this.findOneOrFail(src); const game = typeof src === 'object' ? src : await this.findOneOrFail(src);
@ -45,10 +45,10 @@ export class ReversiGameRepository extends Repository<ReversiGame> {
logs: game.logs.map(log => ({ logs: game.logs.map(log => ({
at: log.at.toISOString(), at: log.at.toISOString(),
color: log.color, color: log.color,
pos: log.pos pos: log.pos,
})), })),
map: game.map, map: game.map,
} : {}) } : {}),
}; };
} }
} }
@ -176,8 +176,8 @@ export const packedReversiGameSchema = {
type: 'number' as const, type: 'number' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
}, },
} },
} },
}, },
map: { map: {
type: 'array' as const, type: 'array' as const,
@ -185,7 +185,7 @@ export const packedReversiGameSchema = {
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
} },
} },
} },
}; };

View file

@ -18,12 +18,12 @@ export class ReversiMatchingRepository extends Repository<ReversiMatching> {
createdAt: matching.createdAt.toISOString(), createdAt: matching.createdAt.toISOString(),
parentId: matching.parentId, parentId: matching.parentId,
parent: Users.pack(matching.parentId, me, { parent: Users.pack(matching.parentId, me, {
detail: true detail: true,
}), }),
childId: matching.childId, childId: matching.childId,
child: Users.pack(matching.childId, me, { child: Users.pack(matching.childId, me, {
detail: true detail: true,
}) }),
}); });
} }
} }
@ -65,5 +65,5 @@ export const packedReversiMatchingSchema = {
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
ref: 'User' as const, ref: 'User' as const,
}, },
} },
}; };

View file

@ -58,5 +58,5 @@ export const packedHashtagSchema = {
type: 'number' as const, type: 'number' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
}, },
} },
}; };

View file

@ -112,8 +112,8 @@ export const packedMessagingMessageSchema = {
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'id' format: 'id',
} },
}, },
}, },
}; };

View file

@ -17,7 +17,7 @@ export class ModerationLogRepository extends Repository<ModerationLog> {
info: log.info, info: log.info,
userId: log.userId, userId: log.userId,
user: Users.pack(log.user || log.userId, null, { user: Users.pack(log.user || log.userId, null, {
detail: true detail: true,
}), }),
}); });
} }

View file

@ -18,8 +18,8 @@ export class MutingRepository extends Repository<Muting> {
createdAt: muting.createdAt.toISOString(), createdAt: muting.createdAt.toISOString(),
muteeId: muting.muteeId, muteeId: muting.muteeId,
mutee: Users.pack(muting.muteeId, me, { mutee: Users.pack(muting.muteeId, me, {
detail: true detail: true,
}) }),
}); });
} }
@ -56,5 +56,5 @@ export const packedMutingSchema = {
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
ref: 'User' as const, ref: 'User' as const,
}, },
} },
}; };

View file

@ -27,7 +27,7 @@ export class NoteReactionRepository extends Repository<NoteReaction> {
type: convertLegacyReaction(reaction.reaction), type: convertLegacyReaction(reaction.reaction),
...(opts.withNote ? { ...(opts.withNote ? {
note: await Notes.pack(reaction.noteId, me), note: await Notes.pack(reaction.noteId, me),
} : {}) } : {}),
}; };
} }
} }

View file

@ -51,7 +51,7 @@ export class NoteRepository extends Repository<Note> {
// フォロワーかどうか // フォロワーかどうか
const following = await Followings.findOne({ const following = await Followings.findOne({
followeeId: note.userId, followeeId: note.userId,
followerId: meId followerId: meId,
}); });
if (following == null) { if (following == null) {
@ -103,7 +103,7 @@ export class NoteRepository extends Repository<Note> {
// フォロワーかどうか // フォロワーかどうか
const following = await Followings.findOne({ const following = await Followings.findOne({
followeeId: packedNote.userId, followeeId: packedNote.userId,
followerId: meId followerId: meId,
}); });
if (following == null) { if (following == null) {
@ -138,7 +138,7 @@ export class NoteRepository extends Repository<Note> {
): Promise<Packed<'Note'>> { ): Promise<Packed<'Note'>> {
const opts = Object.assign({ const opts = Object.assign({
detail: true, detail: true,
skipHide: false skipHide: false,
}, options); }, options);
const meId = me ? me.id : null; const meId = me ? me.id : null;
@ -150,13 +150,13 @@ export class NoteRepository extends Repository<Note> {
const choices = poll.choices.map(c => ({ const choices = poll.choices.map(c => ({
text: c, text: c,
votes: poll.votes[poll.choices.indexOf(c)], votes: poll.votes[poll.choices.indexOf(c)],
isVoted: false isVoted: false,
})); }));
if (poll.multiple) { if (poll.multiple) {
const votes = await PollVotes.find({ const votes = await PollVotes.find({
userId: meId!, userId: meId!,
noteId: note.id noteId: note.id,
}); });
const myChoices = votes.map(v => v.choice); const myChoices = votes.map(v => v.choice);
@ -166,7 +166,7 @@ export class NoteRepository extends Repository<Note> {
} else { } else {
const vote = await PollVotes.findOne({ const vote = await PollVotes.findOne({
userId: meId!, userId: meId!,
noteId: note.id noteId: note.id,
}); });
if (vote) { if (vote) {
@ -177,7 +177,7 @@ export class NoteRepository extends Repository<Note> {
return { return {
multiple: poll.multiple, multiple: poll.multiple,
expiresAt: poll.expiresAt, expiresAt: poll.expiresAt,
choices choices,
}; };
} }
@ -251,20 +251,20 @@ export class NoteRepository extends Repository<Note> {
...(opts.detail ? { ...(opts.detail ? {
reply: note.replyId ? this.pack(note.reply || note.replyId, me, { reply: note.replyId ? this.pack(note.reply || note.replyId, me, {
detail: false, detail: false,
_hint_: options?._hint_ _hint_: options?._hint_,
}) : undefined, }) : undefined,
renote: note.renoteId ? this.pack(note.renote || note.renoteId, me, { renote: note.renoteId ? this.pack(note.renote || note.renoteId, me, {
detail: true, detail: true,
_hint_: options?._hint_ _hint_: options?._hint_,
}) : undefined, }) : undefined,
poll: note.hasPoll ? populatePoll() : undefined, poll: note.hasPoll ? populatePoll() : undefined,
...(meId ? { ...(meId ? {
myReaction: populateMyReaction() myReaction: populateMyReaction(),
} : {}) } : {}),
} : {}) } : {}),
}); });
if (packed.user.isCat && packed.text) { if (packed.user.isCat && packed.text) {
@ -315,8 +315,8 @@ export class NoteRepository extends Repository<Note> {
return await Promise.all(notes.map(n => this.pack(n, me, { return await Promise.all(notes.map(n => this.pack(n, me, {
...options, ...options,
_hint_: { _hint_: {
myReactions: myReactionsMap myReactions: myReactionsMap,
} },
}))); })));
} }
} }
@ -390,8 +390,8 @@ export const packedNoteSchema = {
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'id' format: 'id',
} },
}, },
visibleUserIds: { visibleUserIds: {
type: 'array' as const, type: 'array' as const,
@ -399,8 +399,8 @@ export const packedNoteSchema = {
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'id' format: 'id',
} },
}, },
fileIds: { fileIds: {
type: 'array' as const, type: 'array' as const,
@ -408,8 +408,8 @@ export const packedNoteSchema = {
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
format: 'id' format: 'id',
} },
}, },
files: { files: {
type: 'array' as const, type: 'array' as const,
@ -418,7 +418,7 @@ export const packedNoteSchema = {
type: 'object' as const, type: 'object' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
ref: 'DriveFile' as const, ref: 'DriveFile' as const,
} },
}, },
tags: { tags: {
type: 'array' as const, type: 'array' as const,
@ -426,7 +426,7 @@ export const packedNoteSchema = {
items: { items: {
type: 'string' as const, type: 'string' as const,
optional: false as const, nullable: false as const, optional: false as const, nullable: false as const,
} },
}, },
poll: { poll: {
type: 'object' as const, type: 'object' as const,

View file

@ -32,40 +32,40 @@ export class NotificationRepository extends Repository<Notification> {
...(notification.type === 'mention' ? { ...(notification.type === 'mention' ? {
note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, {
detail: true, detail: true,
_hint_: options._hintForEachNotes_ _hint_: options._hintForEachNotes_,
}), }),
} : {}), } : {}),
...(notification.type === 'reply' ? { ...(notification.type === 'reply' ? {
note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, {
detail: true, detail: true,
_hint_: options._hintForEachNotes_ _hint_: options._hintForEachNotes_,
}), }),
} : {}), } : {}),
...(notification.type === 'renote' ? { ...(notification.type === 'renote' ? {
note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, {
detail: true, detail: true,
_hint_: options._hintForEachNotes_ _hint_: options._hintForEachNotes_,
}), }),
} : {}), } : {}),
...(notification.type === 'quote' ? { ...(notification.type === 'quote' ? {
note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, {
detail: true, detail: true,
_hint_: options._hintForEachNotes_ _hint_: options._hintForEachNotes_,
}), }),
} : {}), } : {}),
...(notification.type === 'reaction' ? { ...(notification.type === 'reaction' ? {
note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, {
detail: true, detail: true,
_hint_: options._hintForEachNotes_ _hint_: options._hintForEachNotes_,
}), }),
reaction: notification.reaction reaction: notification.reaction,
} : {}), } : {}),
...(notification.type === 'pollVote' ? { ...(notification.type === 'pollVote' ? {
note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, { note: Notes.pack(notification.note || notification.noteId!, { id: notification.notifieeId }, {
detail: true, detail: true,
_hint_: options._hintForEachNotes_ _hint_: options._hintForEachNotes_,
}), }),
choice: notification.choice choice: notification.choice,
} : {}), } : {}),
...(notification.type === 'groupInvited' ? { ...(notification.type === 'groupInvited' ? {
invitation: UserGroupInvitations.pack(notification.userGroupInvitationId!), invitation: UserGroupInvitations.pack(notification.userGroupInvitationId!),
@ -102,8 +102,8 @@ export class NotificationRepository extends Repository<Notification> {
return await Promise.all(notifications.map(x => this.pack(x, { return await Promise.all(notifications.map(x => this.pack(x, {
_hintForEachNotes_: { _hintForEachNotes_: {
myReactions: myReactionsMap myReactions: myReactionsMap,
} },
}))); })));
} }
} }
@ -171,5 +171,5 @@ export const packedNotificationSchema = {
type: 'string' as const, type: 'string' as const,
optional: true as const, nullable: true as const, optional: true as const, nullable: true as const,
}, },
} },
}; };

Some files were not shown because too many files have changed in this diff Show more