Skip to content
Snippets Groups Projects
Commit c4c20bee authored by syuilo's avatar syuilo
Browse files

wip #6441

parent 41b491fa
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 22 deletions
......@@ -23,7 +23,7 @@ export class NoteReaction {
onDelete: 'CASCADE'
})
@JoinColumn()
public user: User | null;
public user?: User | null;
@Index()
@Column(id())
......@@ -33,7 +33,7 @@ export class NoteReaction {
onDelete: 'CASCADE'
})
@JoinColumn()
public note: Note | null;
public note?: Note | null;
// TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため)
......
......@@ -38,7 +38,7 @@ export default define(meta, async () => {
chars: '2-9A-HJ-NP-Z', // [0-9A-Z] w/o [01IO] (32 patterns)
});
await RegistrationTickets.save({
await RegistrationTickets.insert({
id: genId(),
createdAt: new Date(),
code,
......
......@@ -53,7 +53,7 @@ export default define(meta, async (ps, user) => {
throw new ApiError(meta.errors.alreadyPromoted);
}
await PromoNotes.save({
await PromoNotes.insert({
noteId: note.id,
createdAt: new Date(),
expiresAt: new Date(ps.expiresAt),
......
......@@ -58,7 +58,7 @@ export default define(meta, async (ps, user) => {
const now = new Date();
// Insert access token doc
await AccessTokens.save({
await AccessTokens.insert({
id: genId(),
createdAt: now,
lastUsedAt: now,
......
......@@ -37,7 +37,7 @@ export default define(meta, async (ps, user) => {
throw new ApiError(meta.errors.noSuchChannel);
}
await ChannelFollowings.save({
await ChannelFollowings.insert({
id: genId(),
createdAt: new Date(),
followerId: user.id,
......
......@@ -68,7 +68,7 @@ export default define(meta, async (ps, user) => {
throw new ApiError(meta.errors.alreadyClipped);
}
await ClipNotes.save({
await ClipNotes.insert({
id: genId(),
noteId: note.id,
clipId: clip.id
......
......@@ -52,7 +52,7 @@ export default define(meta, async (ps, user) => {
}
// Create read
await AnnouncementReads.save({
await AnnouncementReads.insert({
id: genId(),
createdAt: new Date(),
announcementId: ps.announcementId,
......
......@@ -52,7 +52,7 @@ export default define(meta, async (ps, user) => {
const now = new Date();
// Insert access token doc
await AccessTokens.save({
await AccessTokens.insert({
id: genId(),
createdAt: now,
lastUsedAt: now,
......
......@@ -61,7 +61,7 @@ export default define(meta, async (ps, user) => {
}
// Create favorite
await NoteFavorites.save({
await NoteFavorites.insert({
id: genId(),
createdAt: new Date(),
noteId: note.id,
......
......@@ -68,7 +68,7 @@ export default define(meta, async (ps, user) => {
}
// Create like
await PageLikes.save({
await PageLikes.insert({
id: genId(),
createdAt: new Date(),
pageId: page.id,
......
......@@ -46,7 +46,7 @@ export default define(meta, async (ps, user) => {
return;
}
await PromoReads.save({
await PromoReads.insert({
id: genId(),
createdAt: new Date(),
noteId: note.id,
......
......@@ -58,7 +58,7 @@ export default define(meta, async (ps, user) => {
};
}
await SwSubscriptions.save({
await SwSubscriptions.insert({
id: genId(),
createdAt: new Date(),
userId: user.id,
......
......@@ -39,7 +39,7 @@ export default define(meta, async (ps, user) => {
} as UserGroup);
// Push the owner
await UserGroupJoinings.save({
await UserGroupJoinings.insert({
id: genId(),
createdAt: new Date(),
userId: user.id,
......
......@@ -52,7 +52,7 @@ export default define(meta, async (ps, user) => {
}
// Push the user
await UserGroupJoinings.save({
await UserGroupJoinings.insert({
id: genId(),
createdAt: new Date(),
userId: user.id,
......
......@@ -53,7 +53,7 @@ export default async (ctx: Koa.Context) => {
async function fail(status?: number, failure?: { error: string }) {
// Append signin history
await Signins.save({
await Signins.insert({
id: genId(),
createdAt: new Date(),
userId: user.id,
......@@ -198,7 +198,7 @@ export default async (ctx: Koa.Context) => {
const challengeId = genId();
await AttestationChallenges.save({
await AttestationChallenges.insert({
userId: user.id,
id: challengeId,
challenge: hash(Buffer.from(challenge, 'utf-8')).toString('hex'),
......
......@@ -10,7 +10,7 @@ export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: U
// 通知しない設定になっているか、自分自身の投稿なら既読にする
const read = !antenna.notify || (antenna.userId === noteUser.id);
AntennaNotes.save({
AntennaNotes.insert({
id: genId(),
antennaId: antenna.id,
noteId: note.id,
......
......@@ -18,7 +18,7 @@ export default async function(blocker: User, blockee: User) {
unFollow(blockee, blocker)
]);
await Blockings.save({
await Blockings.insert({
id: genId(),
createdAt: new Date(),
blockerId: blocker.id,
......
......@@ -22,7 +22,7 @@ export async function insertFollowingDoc(followee: User, follower: User) {
let alreadyFollowed = false;
await Followings.save({
await Followings.insert({
id: genId(),
createdAt: new Date(),
followerId: follower.id,
......
......@@ -37,7 +37,7 @@ export async function addPinned(user: User, noteId: Note['id']) {
throw new IdentifiableError('23f0cf4e-59a3-4276-a91d-61a5891c1514', 'That note has already been pinned.');
}
await UserNotePinings.save({
await UserNotePinings.insert({
id: genId(),
createdAt: new Date(),
userId: user.id,
......
......@@ -3,7 +3,7 @@ import { ModerationLogs } from '../models';
import { genId } from '../misc/gen-id';
export async function insertModerationLog(moderator: ILocalUser, type: string, info?: Record<string, any>) {
await ModerationLogs.save({
await ModerationLogs.insert({
id: genId(),
createdAt: new Date(),
userId: moderator.id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment