diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-11-17 14:59:15 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-17 14:59:15 +0900 |
| commit | 0044d83801fd261e586143b0442102fabf9106cb (patch) | |
| tree | dd7c18374e1afaced3669a38c2e20359f6f3949f /src/server/api/endpoints/pages | |
| parent | 12.57.4 (diff) | |
| download | sharkey-0044d83801fd261e586143b0442102fabf9106cb.tar.gz sharkey-0044d83801fd261e586143b0442102fabf9106cb.tar.bz2 sharkey-0044d83801fd261e586143b0442102fabf9106cb.zip | |
nanka iroiro (#6847)
* wip
* wip
* wip
* wip
* Update ja-JP.yml
* wip
* wip
* wip
Diffstat (limited to 'src/server/api/endpoints/pages')
| -rw-r--r-- | src/server/api/endpoints/pages/featured.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/server/api/endpoints/pages/featured.ts b/src/server/api/endpoints/pages/featured.ts new file mode 100644 index 0000000000..19802d0448 --- /dev/null +++ b/src/server/api/endpoints/pages/featured.ts @@ -0,0 +1,29 @@ +import define from '../../define'; +import { Pages } from '../../../../models'; + +export const meta = { + tags: ['pages'], + + requireCredential: false as const, + + res: { + type: 'array' as const, + optional: false as const, nullable: false as const, + items: { + type: 'object' as const, + optional: false as const, nullable: false as const, + ref: 'Page', + } + }, +}; + +export default define(meta, async (ps, me) => { + const query = Pages.createQueryBuilder('page') + .where('page.visibility = \'public\'') + .andWhere('page.likedCount > 0') + .orderBy('page.likedCount', 'DESC'); + + const pages = await query.take(10).getMany(); + + return await Pages.packMany(pages, me); +}); |