Merge branch 'develop' into sw-notification-action

This commit is contained in:
tamaina 2021-02-21 13:52:54 +09:00
commit b040c4da2f
64 changed files with 1253 additions and 248 deletions

View file

@ -85,7 +85,7 @@ export default define(meta, async (ps, user) => {
}
//#region Construct query
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
.andWhere('note.channelId = :channelId', { channelId: channel.id })
.leftJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('note.channel', 'channel');

View file

@ -46,6 +46,11 @@ export const meta = {
validator: $.optional.nullable.type(ID),
default: null
},
channelId: {
validator: $.optional.nullable.type(ID),
default: null
},
},
res: {
@ -64,7 +69,15 @@ export const meta = {
export default define(meta, async (ps, me) => {
if (es == null) {
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId);
if (ps.userId) {
query.andWhere('note.userId = :userId', { userId: ps.userId });
} else if (ps.channelId) {
query.andWhere('note.channelId = :channelId', { channelId: ps.channelId });
}
query
.andWhere('note.text ILIKE :q', { q: `%${ps.query}%` })
.leftJoinAndSelect('note.user', 'user');