summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/notes/search.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-12-09 23:58:30 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-12-09 23:58:30 +0900
commitc69b72e1999578cba15e34677ebd366482cba734 (patch)
tree624ac6500e36e3a7024a5ea19ae891ef86781d04 /packages/backend/src/server/api/endpoints/notes/search.ts
parentUpdate instance-mute.vue (diff)
downloadsharkey-c69b72e1999578cba15e34677ebd366482cba734.tar.gz
sharkey-c69b72e1999578cba15e34677ebd366482cba734.tar.bz2
sharkey-c69b72e1999578cba15e34677ebd366482cba734.zip
fix lint
Diffstat (limited to 'packages/backend/src/server/api/endpoints/notes/search.ts')
-rw-r--r--packages/backend/src/server/api/endpoints/notes/search.ts48
1 files changed, 24 insertions, 24 deletions
diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts
index eb832a6b31..b49ee87199 100644
--- a/packages/backend/src/server/api/endpoints/notes/search.ts
+++ b/packages/backend/src/server/api/endpoints/notes/search.ts
@@ -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);