mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-06-27 23:36:58 +00:00
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
|
import type { FlashsRepository } from '@/models/_.js';
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
|
import { FlashEntityService } from '@/core/entities/FlashEntityService.js';
|
|
import { DI } from '@/di-symbols.js';
|
|
import { FlashService } from '@/core/FlashService.js';
|
|
|
|
export const meta = {
|
|
tags: ['flash'],
|
|
|
|
requireCredential: false,
|
|
|
|
res: {
|
|
type: 'array',
|
|
optional: false, nullable: false,
|
|
items: {
|
|
type: 'object',
|
|
optional: false, nullable: false,
|
|
ref: 'Flash',
|
|
},
|
|
},
|
|
} as const;
|
|
|
|
export const paramDef = {
|
|
type: 'object',
|
|
properties: {
|
|
offset: { type: 'integer', minimum: 0, default: 0 },
|
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
|
},
|
|
required: [],
|
|
} as const;
|
|
|
|
@Injectable()
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
|
constructor(
|
|
private flashService: FlashService,
|
|
private flashEntityService: FlashEntityService,
|
|
) {
|
|
super(meta, paramDef, async (ps, me) => {
|
|
const result = await this.flashService.featured({
|
|
offset: ps.offset,
|
|
limit: ps.limit,
|
|
});
|
|
return await this.flashEntityService.packMany(result, me);
|
|
});
|
|
}
|
|
}
|