mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-03-28 09:37:32 +01:00
b7fd6bf33a835fd73c2a86eb007074d3680f6efd によるリワーク This reverts commiteeef3965b7
This reverts commit04fefb2056
This reverts commit576251200f
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
|
import { Brackets } from 'typeorm';
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
|
import { QueryService } from '@/core/QueryService.js';
|
|
import { AnnouncementService } from '@/core/AnnouncementService.js';
|
|
import { DI } from '@/di-symbols.js';
|
|
import type { AnnouncementReadsRepository, AnnouncementsRepository } from '@/models/index.js';
|
|
|
|
export const meta = {
|
|
tags: ['meta'],
|
|
|
|
requireCredential: false,
|
|
|
|
res: {
|
|
type: 'array',
|
|
optional: false, nullable: false,
|
|
items: {
|
|
type: 'object',
|
|
optional: false, nullable: false,
|
|
ref: 'Announcement',
|
|
},
|
|
},
|
|
} as const;
|
|
|
|
export const paramDef = {
|
|
type: 'object',
|
|
properties: {
|
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
|
offset: { type: 'integer', default: 0 },
|
|
isActive: { type: 'boolean', default: true },
|
|
},
|
|
required: [],
|
|
} as const;
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
@Injectable()
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
|
constructor(
|
|
@Inject(DI.announcementsRepository)
|
|
private announcementsRepository: AnnouncementsRepository,
|
|
|
|
@Inject(DI.announcementReadsRepository)
|
|
private announcementReadsRepository: AnnouncementReadsRepository,
|
|
|
|
private queryService: QueryService,
|
|
private announcementService: AnnouncementService,
|
|
) {
|
|
super(meta, paramDef, async (ps, me) => {
|
|
return this.announcementService.getAnnouncements(me, ps.limit, ps.offset, ps.isActive);
|
|
});
|
|
}
|
|
}
|