mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-18 16:07:31 -07:00
4e15337a64
* wip * wip * wip * Update index.ts * Update gen-openapi-spec.ts * Update api.ja-JP.md * Fix * Improve doc * Update gen-openapi-spec.ts * Update redoc.html * Improve doc * Update gen-openapi-spec.ts * Improve doc * Update CHANGELOG.md
45 lines
755 B
TypeScript
45 lines
755 B
TypeScript
import $ from 'cafy';
|
|
import App, { pack } from '../../../../models/app';
|
|
import define from '../../define';
|
|
|
|
export const meta = {
|
|
tags: ['account', 'app'],
|
|
|
|
desc: {
|
|
'ja-JP': '自分のアプリケーション一覧を取得します。',
|
|
'en-US': 'Get my apps'
|
|
},
|
|
|
|
requireCredential: true,
|
|
|
|
params: {
|
|
limit: {
|
|
validator: $.optional.num.range(1, 100),
|
|
default: 10
|
|
},
|
|
|
|
offset: {
|
|
validator: $.optional.num.min(0),
|
|
default: 0
|
|
}
|
|
}
|
|
};
|
|
|
|
export default define(meta, async (ps, user) => {
|
|
const query = {
|
|
userId: user._id
|
|
};
|
|
|
|
const apps = await App
|
|
.find(query, {
|
|
limit: ps.limit,
|
|
skip: ps.offset,
|
|
sort: {
|
|
_id: -1
|
|
}
|
|
});
|
|
|
|
return await Promise.all(apps.map(app => pack(app, user, {
|
|
detail: true
|
|
})));
|
|
});
|