fix lint
This commit is contained in:
@ -21,7 +21,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@ -40,7 +40,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -24,16 +24,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '47db1a1c-b0af-458d-8fb4-986e4efafe1e'
|
||||
}
|
||||
}
|
||||
id: '47db1a1c-b0af-458d-8fb4-986e4efafe1e',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
@ -48,7 +48,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
const clips = await Clips.find({
|
||||
id: In(clipNotes.map(x => x.clipId)),
|
||||
isPublic: true
|
||||
isPublic: true,
|
||||
});
|
||||
|
||||
return await Promise.all(clips.map(x => Clips.pack(x)));
|
||||
|
@ -18,12 +18,12 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
offset: {
|
||||
validator: $.optional.num.min(0),
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
|
||||
@ -34,16 +34,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: 'e1035875-9551-45ec-afa8-1ded1fcb53c8'
|
||||
}
|
||||
}
|
||||
id: 'e1035875-9551-45ec-afa8-1ded1fcb53c8',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -29,7 +29,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 300
|
||||
max: 300,
|
||||
},
|
||||
|
||||
kind: 'write:notes',
|
||||
@ -106,10 +106,10 @@ export const meta = {
|
||||
.each(c => c.length > 0 && c.length < 50),
|
||||
multiple: $.optional.bool,
|
||||
expiresAt: $.optional.nullable.num.int(),
|
||||
expiredAfter: $.optional.nullable.num.int().min(1)
|
||||
expiredAfter: $.optional.nullable.num.int().min(1),
|
||||
}).strict(),
|
||||
ref: 'poll'
|
||||
}
|
||||
ref: 'poll',
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@ -120,59 +120,59 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchRenoteTarget: {
|
||||
message: 'No such renote target.',
|
||||
code: 'NO_SUCH_RENOTE_TARGET',
|
||||
id: 'b5c90186-4ab0-49c8-9bba-a1f76c282ba4'
|
||||
id: 'b5c90186-4ab0-49c8-9bba-a1f76c282ba4',
|
||||
},
|
||||
|
||||
cannotReRenote: {
|
||||
message: 'You can not Renote a pure Renote.',
|
||||
code: 'CANNOT_RENOTE_TO_A_PURE_RENOTE',
|
||||
id: 'fd4cc33e-2a37-48dd-99cc-9b806eb2031a'
|
||||
id: 'fd4cc33e-2a37-48dd-99cc-9b806eb2031a',
|
||||
},
|
||||
|
||||
noSuchReplyTarget: {
|
||||
message: 'No such reply target.',
|
||||
code: 'NO_SUCH_REPLY_TARGET',
|
||||
id: '749ee0f6-d3da-459a-bf02-282e2da4292c'
|
||||
id: '749ee0f6-d3da-459a-bf02-282e2da4292c',
|
||||
},
|
||||
|
||||
cannotReplyToPureRenote: {
|
||||
message: 'You can not reply to a pure Renote.',
|
||||
code: 'CANNOT_REPLY_TO_A_PURE_RENOTE',
|
||||
id: '3ac74a84-8fd5-4bb0-870f-01804f82ce15'
|
||||
id: '3ac74a84-8fd5-4bb0-870f-01804f82ce15',
|
||||
},
|
||||
|
||||
contentRequired: {
|
||||
message: 'Content required. You need to set text, fileIds, renoteId or poll.',
|
||||
code: 'CONTENT_REQUIRED',
|
||||
id: '6f57e42b-c348-439b-bc45-993995cc515a'
|
||||
id: '6f57e42b-c348-439b-bc45-993995cc515a',
|
||||
},
|
||||
|
||||
cannotCreateAlreadyExpiredPoll: {
|
||||
message: 'Poll is already expired.',
|
||||
code: 'CANNOT_CREATE_ALREADY_EXPIRED_POLL',
|
||||
id: '04da457d-b083-4055-9082-955525eda5a5'
|
||||
id: '04da457d-b083-4055-9082-955525eda5a5',
|
||||
},
|
||||
|
||||
noSuchChannel: {
|
||||
message: 'No such channel.',
|
||||
code: 'NO_SUCH_CHANNEL',
|
||||
id: 'b1653923-5453-4edc-b786-7c4f39bb0bbb'
|
||||
id: 'b1653923-5453-4edc-b786-7c4f39bb0bbb',
|
||||
},
|
||||
|
||||
youHaveBeenBlocked: {
|
||||
message: 'You have been blocked by this user.',
|
||||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||
id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3'
|
||||
id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -188,7 +188,7 @@ export default define(meta, async (ps, user) => {
|
||||
files = (await Promise.all(fileIds.map(fileId =>
|
||||
DriveFiles.findOne({
|
||||
id: fileId,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
})
|
||||
))).filter(file => file != null) as DriveFile[];
|
||||
}
|
||||
@ -273,7 +273,7 @@ export default define(meta, async (ps, user) => {
|
||||
poll: ps.poll ? {
|
||||
choices: ps.poll.choices,
|
||||
multiple: ps.poll.multiple || false,
|
||||
expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null
|
||||
expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null,
|
||||
} : undefined,
|
||||
text: ps.text || undefined,
|
||||
reply,
|
||||
@ -289,6 +289,6 @@ export default define(meta, async (ps, user) => {
|
||||
});
|
||||
|
||||
return {
|
||||
createdNote: await Notes.pack(note, user)
|
||||
createdNote: await Notes.pack(note, user),
|
||||
};
|
||||
});
|
||||
|
@ -17,28 +17,28 @@ export const meta = {
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 300,
|
||||
minInterval: ms('1sec')
|
||||
minInterval: ms('1sec'),
|
||||
},
|
||||
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '490be23f-8c1f-4796-819f-94cb4f9d1630'
|
||||
id: '490be23f-8c1f-4796-819f-94cb4f9d1630',
|
||||
},
|
||||
|
||||
accessDenied: {
|
||||
message: 'Access denied.',
|
||||
code: 'ACCESS_DENIED',
|
||||
id: 'fe8d7103-0ea8-4ec3-814d-f8b401dc69e9'
|
||||
}
|
||||
}
|
||||
id: 'fe8d7103-0ea8-4ec3-814d-f8b401dc69e9',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -16,22 +16,22 @@ export const meta = {
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '6dd26674-e060-4816-909a-45ba3f4da458'
|
||||
id: '6dd26674-e060-4816-909a-45ba3f4da458',
|
||||
},
|
||||
|
||||
alreadyFavorited: {
|
||||
message: 'The note has already been marked as a favorite.',
|
||||
code: 'ALREADY_FAVORITED',
|
||||
id: 'a402c12b-34dd-41d2-97d8-4d2ffd96a1a6'
|
||||
id: 'a402c12b-34dd-41d2-97d8-4d2ffd96a1a6',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -44,7 +44,7 @@ export default define(meta, async (ps, user) => {
|
||||
// if already favorited
|
||||
const exist = await NoteFavorites.findOne({
|
||||
noteId: note.id,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (exist != null) {
|
||||
@ -56,6 +56,6 @@ export default define(meta, async (ps, user) => {
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
noteId: note.id,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
});
|
||||
|
@ -15,22 +15,22 @@ export const meta = {
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '80848a2c-398f-4343-baa9-df1d57696c56'
|
||||
id: '80848a2c-398f-4343-baa9-df1d57696c56',
|
||||
},
|
||||
|
||||
notFavorited: {
|
||||
message: 'You have not marked that note a favorite.',
|
||||
code: 'NOT_FAVORITED',
|
||||
id: 'b625fc69-635e-45e9-86f4-dbefbef35af5'
|
||||
id: 'b625fc69-635e-45e9-86f4-dbefbef35af5',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -43,7 +43,7 @@ export default define(meta, async (ps, user) => {
|
||||
// if already favorited
|
||||
const exist = await NoteFavorites.findOne({
|
||||
noteId: note.id,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (exist == null) {
|
||||
|
@ -17,7 +17,7 @@ export const meta = {
|
||||
|
||||
offset: {
|
||||
validator: $.optional.num.min(0),
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
|
||||
@ -28,7 +28,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@ -34,11 +34,11 @@ export const meta = {
|
||||
},
|
||||
|
||||
sinceDate: {
|
||||
validator: $.optional.num
|
||||
validator: $.optional.num,
|
||||
},
|
||||
|
||||
untilDate: {
|
||||
validator: $.optional.num
|
||||
validator: $.optional.num,
|
||||
},
|
||||
},
|
||||
|
||||
@ -49,16 +49,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
gtlDisabled: {
|
||||
message: 'Global timeline has been disabled.',
|
||||
code: 'GTL_DISABLED',
|
||||
id: '0332fc13-6ab2-4427-ae80-a9fadffd1a6b'
|
||||
id: '0332fc13-6ab2-4427-ae80-a9fadffd1a6b',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -69,16 +69,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
stlDisabled: {
|
||||
message: 'Hybrid timeline has been disabled.',
|
||||
code: 'STL_DISABLED',
|
||||
id: '620763f4-f621-4533-ab33-0577a1a3c342'
|
||||
id: '620763f4-f621-4533-ab33-0577a1a3c342',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -33,7 +33,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@ -60,16 +60,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
ltlDisabled: {
|
||||
message: 'Local timeline has been disabled.',
|
||||
code: 'LTL_DISABLED',
|
||||
id: '45a6eb02-7695-4393-b023-dd3be9aaaefd'
|
||||
id: '45a6eb02-7695-4393-b023-dd3be9aaaefd',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -18,12 +18,12 @@ export const meta = {
|
||||
params: {
|
||||
following: {
|
||||
validator: $.optional.bool,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@ -46,7 +46,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -11,13 +11,13 @@ export const meta = {
|
||||
params: {
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
offset: {
|
||||
validator: $.optional.num.min(0),
|
||||
default: 0
|
||||
}
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@ -26,9 +26,9 @@ export const meta = {
|
||||
items: {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note'
|
||||
}
|
||||
}
|
||||
ref: 'Note',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -68,10 +68,10 @@ export default define(meta, async (ps, user) => {
|
||||
if (polls.length === 0) return [];
|
||||
|
||||
const notes = await Notes.find({
|
||||
id: In(polls.map(poll => poll.noteId))
|
||||
id: In(polls.map(poll => poll.noteId)),
|
||||
});
|
||||
|
||||
return await Notes.packMany(notes, user, {
|
||||
detail: true
|
||||
detail: true,
|
||||
});
|
||||
});
|
||||
|
@ -27,7 +27,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
choice: {
|
||||
validator: $.num
|
||||
validator: $.num,
|
||||
},
|
||||
},
|
||||
|
||||
@ -35,39 +35,39 @@ export const meta = {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: 'ecafbd2e-c283-4d6d-aecb-1a0a33b75396'
|
||||
id: 'ecafbd2e-c283-4d6d-aecb-1a0a33b75396',
|
||||
},
|
||||
|
||||
noPoll: {
|
||||
message: 'The note does not attach a poll.',
|
||||
code: 'NO_POLL',
|
||||
id: '5f979967-52d9-4314-a911-1c673727f92f'
|
||||
id: '5f979967-52d9-4314-a911-1c673727f92f',
|
||||
},
|
||||
|
||||
invalidChoice: {
|
||||
message: 'Choice ID is invalid.',
|
||||
code: 'INVALID_CHOICE',
|
||||
id: 'e0cc9a04-f2e8-41e4-a5f1-4127293260cc'
|
||||
id: 'e0cc9a04-f2e8-41e4-a5f1-4127293260cc',
|
||||
},
|
||||
|
||||
alreadyVoted: {
|
||||
message: 'You have already voted.',
|
||||
code: 'ALREADY_VOTED',
|
||||
id: '0963fc77-efac-419b-9424-b391608dc6d8'
|
||||
id: '0963fc77-efac-419b-9424-b391608dc6d8',
|
||||
},
|
||||
|
||||
alreadyExpired: {
|
||||
message: 'The poll is already expired.',
|
||||
code: 'ALREADY_EXPIRED',
|
||||
id: '1022a357-b085-4054-9083-8f8de358337e'
|
||||
id: '1022a357-b085-4054-9083-8f8de358337e',
|
||||
},
|
||||
|
||||
youHaveBeenBlocked: {
|
||||
message: 'You cannot vote this poll because you have been blocked by this user.',
|
||||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||
id: '85a5377e-b1e9-4617-b0b9-5bea73331e49'
|
||||
id: '85a5377e-b1e9-4617-b0b9-5bea73331e49',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -107,7 +107,7 @@ export default define(meta, async (ps, user) => {
|
||||
// if already voted
|
||||
const exist = await PollVotes.find({
|
||||
noteId: note.id,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (exist.length) {
|
||||
@ -126,7 +126,7 @@ export default define(meta, async (ps, user) => {
|
||||
createdAt,
|
||||
noteId: note.id,
|
||||
userId: user.id,
|
||||
choice: ps.choice
|
||||
choice: ps.choice,
|
||||
}).then(x => PollVotes.findOneOrFail(x.identifiers[0]));
|
||||
|
||||
// Increment votes count
|
||||
@ -135,14 +135,14 @@ export default define(meta, async (ps, user) => {
|
||||
|
||||
publishNoteStream(note.id, 'pollVoted', {
|
||||
choice: ps.choice,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
// Notify
|
||||
createNotification(note.userId, 'pollVote', {
|
||||
notifierId: user.id,
|
||||
noteId: note.id,
|
||||
choice: ps.choice
|
||||
choice: ps.choice,
|
||||
});
|
||||
|
||||
// Fetch watchers
|
||||
@ -154,7 +154,7 @@ export default define(meta, async (ps, user) => {
|
||||
createNotification(watcher.userId, 'pollVote', {
|
||||
notifierId: user.id,
|
||||
noteId: note.id,
|
||||
choice: ps.choice
|
||||
choice: ps.choice,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -23,12 +23,12 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
offset: {
|
||||
validator: $.optional.num,
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@ -47,16 +47,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'NoteReaction',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '263fff3d-d0e1-4af4-bea7-8408059b451a'
|
||||
}
|
||||
}
|
||||
id: '263fff3d-d0e1-4af4-bea7-8408059b451a',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -66,7 +66,7 @@ export default define(meta, async (ps, user) => {
|
||||
});
|
||||
|
||||
const query = {
|
||||
noteId: note.id
|
||||
noteId: note.id,
|
||||
} as DeepPartial<NoteReaction>;
|
||||
|
||||
if (ps.type) {
|
||||
@ -82,8 +82,8 @@ export default define(meta, async (ps, user) => {
|
||||
take: ps.limit!,
|
||||
skip: ps.offset,
|
||||
order: {
|
||||
id: -1
|
||||
}
|
||||
id: -1,
|
||||
},
|
||||
});
|
||||
|
||||
return await Promise.all(reactions.map(reaction => NoteReactions.pack(reaction, user)));
|
||||
|
@ -19,28 +19,28 @@ export const meta = {
|
||||
|
||||
reaction: {
|
||||
validator: $.str,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '033d0620-5bfe-4027-965d-980b0c85a3ea'
|
||||
id: '033d0620-5bfe-4027-965d-980b0c85a3ea',
|
||||
},
|
||||
|
||||
alreadyReacted: {
|
||||
message: 'You are already reacting to that note.',
|
||||
code: 'ALREADY_REACTED',
|
||||
id: '71efcf98-86d6-4e2b-b2ad-9d032369366b'
|
||||
id: '71efcf98-86d6-4e2b-b2ad-9d032369366b',
|
||||
},
|
||||
|
||||
youHaveBeenBlocked: {
|
||||
message: 'You cannot react this note because you have been blocked by this user.',
|
||||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||
id: '20ef5475-9f38-4e4c-bd33-de6d979498ec'
|
||||
id: '20ef5475-9f38-4e4c-bd33-de6d979498ec',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -16,7 +16,7 @@ export const meta = {
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 60,
|
||||
minInterval: ms('3sec')
|
||||
minInterval: ms('3sec'),
|
||||
},
|
||||
|
||||
params: {
|
||||
@ -29,15 +29,15 @@ export const meta = {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '764d9fce-f9f2-4a0e-92b1-6ceac9a7ad37'
|
||||
id: '764d9fce-f9f2-4a0e-92b1-6ceac9a7ad37',
|
||||
},
|
||||
|
||||
notReacted: {
|
||||
message: 'You are not reacting to that note.',
|
||||
code: 'NOT_REACTED',
|
||||
id: '92f4426d-4196-4125-aa5b-02943e2ec8fc'
|
||||
id: '92f4426d-4196-4125-aa5b-02943e2ec8fc',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -21,7 +21,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@ -30,7 +30,7 @@ export const meta = {
|
||||
|
||||
untilId: {
|
||||
validator: $.optional.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@ -40,16 +40,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '12908022-2e21-46cd-ba6a-3edaf6093f46'
|
||||
}
|
||||
}
|
||||
id: '12908022-2e21-46cd-ba6a-3edaf6093f46',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -27,7 +27,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
},
|
||||
|
||||
@ -38,7 +38,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
},
|
||||
|
||||
@ -62,7 +62,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
query: {
|
||||
validator: $.str
|
||||
validator: $.str,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@ -30,22 +30,22 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
host: {
|
||||
validator: $.optional.nullable.str,
|
||||
default: undefined
|
||||
default: undefined,
|
||||
},
|
||||
|
||||
userId: {
|
||||
validator: $.optional.nullable.type(ID),
|
||||
default: null
|
||||
default: null,
|
||||
},
|
||||
|
||||
channelId: {
|
||||
validator: $.optional.nullable.type(ID),
|
||||
default: null
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
|
||||
@ -56,11 +56,11 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
@ -91,8 +91,8 @@ export default define(meta, async (ps, me) => {
|
||||
} else {
|
||||
const userQuery = ps.userId != null ? [{
|
||||
term: {
|
||||
userId: ps.userId
|
||||
}
|
||||
userId: ps.userId,
|
||||
},
|
||||
}] : [];
|
||||
|
||||
const hostQuery = ps.userId == null ?
|
||||
@ -100,14 +100,14 @@ export default define(meta, async (ps, me) => {
|
||||
bool: {
|
||||
must_not: {
|
||||
exists: {
|
||||
field: 'userHost'
|
||||
}
|
||||
}
|
||||
}
|
||||
field: 'userHost',
|
||||
},
|
||||
},
|
||||
},
|
||||
}] : ps.host !== undefined ? [{
|
||||
term: {
|
||||
userHost: ps.host
|
||||
}
|
||||
userHost: ps.host,
|
||||
},
|
||||
}] : []
|
||||
: [];
|
||||
|
||||
@ -122,15 +122,15 @@ export default define(meta, async (ps, me) => {
|
||||
simple_query_string: {
|
||||
fields: ['text'],
|
||||
query: ps.query.toLowerCase(),
|
||||
default_operator: 'and'
|
||||
default_operator: 'and',
|
||||
},
|
||||
}, ...hostQuery, ...userQuery]
|
||||
}
|
||||
}, ...hostQuery, ...userQuery],
|
||||
},
|
||||
},
|
||||
sort: [{
|
||||
_doc: 'desc'
|
||||
}]
|
||||
}
|
||||
_doc: 'desc',
|
||||
}],
|
||||
},
|
||||
});
|
||||
|
||||
const hits = result.body.hits.hits.map((hit: any) => hit._id);
|
||||
@ -140,11 +140,11 @@ export default define(meta, async (ps, me) => {
|
||||
// Fetch found notes
|
||||
const notes = await Notes.find({
|
||||
where: {
|
||||
id: In(hits)
|
||||
id: In(hits),
|
||||
},
|
||||
order: {
|
||||
id: -1
|
||||
}
|
||||
id: -1,
|
||||
},
|
||||
});
|
||||
|
||||
return await Notes.packMany(notes, me);
|
||||
|
@ -13,7 +13,7 @@ export const meta = {
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@ -26,9 +26,9 @@ export const meta = {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '24fcbfc6-2e37-42b6-8388-c29b3861a08d'
|
||||
}
|
||||
}
|
||||
id: '24fcbfc6-2e37-42b6-8388-c29b3861a08d',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -38,6 +38,6 @@ export default define(meta, async (ps, user) => {
|
||||
});
|
||||
|
||||
return await Notes.pack(note, user, {
|
||||
detail: true
|
||||
detail: true,
|
||||
});
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ export const meta = {
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@ -20,18 +20,18 @@ export const meta = {
|
||||
properties: {
|
||||
isFavorited: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isWatching: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isMutedThread: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -43,21 +43,21 @@ export default define(meta, async (ps, user) => {
|
||||
userId: user.id,
|
||||
noteId: note.id,
|
||||
},
|
||||
take: 1
|
||||
take: 1,
|
||||
}),
|
||||
NoteWatchings.count({
|
||||
where: {
|
||||
userId: user.id,
|
||||
noteId: note.id,
|
||||
},
|
||||
take: 1
|
||||
take: 1,
|
||||
}),
|
||||
NoteThreadMutings.count({
|
||||
where: {
|
||||
userId: user.id,
|
||||
threadId: note.threadId || note.id,
|
||||
},
|
||||
take: 1
|
||||
take: 1,
|
||||
}),
|
||||
]);
|
||||
|
||||
|
@ -17,16 +17,16 @@ export const meta = {
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '5ff67ada-ed3b-2e71-8e87-a1a421e177d2'
|
||||
}
|
||||
}
|
||||
id: '5ff67ada-ed3b-2e71-8e87-a1a421e177d2',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -15,16 +15,16 @@ export const meta = {
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: 'bddd57ac-ceb3-b29d-4334-86ea5fae481a'
|
||||
}
|
||||
}
|
||||
id: 'bddd57ac-ceb3-b29d-4334-86ea5fae481a',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -67,7 +67,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -76,7 +76,7 @@ export default define(meta, async (ps, user) => {
|
||||
where: {
|
||||
followerId: user.id,
|
||||
},
|
||||
take: 1
|
||||
take: 1,
|
||||
})) !== 0;
|
||||
|
||||
//#region Construct query
|
||||
|
@ -33,9 +33,9 @@ export const meta = {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: 'bea9b03f-36e0-49c5-a4db-627a029f8971'
|
||||
}
|
||||
}
|
||||
id: 'bea9b03f-36e0-49c5-a4db-627a029f8971',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -73,7 +73,7 @@ export default define(meta, async (ps, user) => {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'User-Agent': config.userAgent,
|
||||
Accept: 'application/json, */*'
|
||||
Accept: 'application/json, */*',
|
||||
},
|
||||
body: params,
|
||||
timeout: 10000,
|
||||
@ -84,6 +84,6 @@ export default define(meta, async (ps, user) => {
|
||||
|
||||
return {
|
||||
sourceLang: json.translations[0].detected_source_language,
|
||||
text: json.translations[0].text
|
||||
text: json.translations[0].text,
|
||||
};
|
||||
});
|
||||
|
@ -17,22 +17,22 @@ export const meta = {
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 300,
|
||||
minInterval: ms('1sec')
|
||||
minInterval: ms('1sec'),
|
||||
},
|
||||
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: 'efd4a259-2442-496b-8dd7-b255aa1a160f'
|
||||
id: 'efd4a259-2442-496b-8dd7-b255aa1a160f',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@ -43,7 +43,7 @@ export default define(meta, async (ps, user) => {
|
||||
|
||||
const renotes = await Notes.find({
|
||||
userId: user.id,
|
||||
renoteId: note.id
|
||||
renoteId: note.id,
|
||||
});
|
||||
|
||||
for (const note of renotes) {
|
||||
|
@ -66,22 +66,22 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchList: {
|
||||
message: 'No such list.',
|
||||
code: 'NO_SUCH_LIST',
|
||||
id: '8fb1fbd5-e476-4c37-9fb0-43d55b63a2ff'
|
||||
}
|
||||
}
|
||||
id: '8fb1fbd5-e476-4c37-9fb0-43d55b63a2ff',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
const list = await UserLists.findOne({
|
||||
id: ps.listId,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (list == null) {
|
||||
|
@ -15,16 +15,16 @@ export const meta = {
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: 'ea0e37a6-90a3-4f58-ba6b-c328ca206fc7'
|
||||
}
|
||||
}
|
||||
id: 'ea0e37a6-90a3-4f58-ba6b-c328ca206fc7',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@ -15,16 +15,16 @@ export const meta = {
|
||||
params: {
|
||||
noteId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchNote: {
|
||||
message: 'No such note.',
|
||||
code: 'NO_SUCH_NOTE',
|
||||
id: '09b3695c-f72c-4731-a428-7cff825fc82e'
|
||||
}
|
||||
}
|
||||
id: '09b3695c-f72c-4731-a428-7cff825fc82e',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
Reference in New Issue
Block a user