mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-11-29 19:12:51 +01:00
fix: antennas validation (#11469)
This commit is contained in:
parent
49fc4cce3c
commit
f664f941a2
2 changed files with 5 additions and 2 deletions
|
@ -85,8 +85,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
if ((ps.keywords.length === 0) || ps.keywords[0].every(x => x === '')) {
|
||||
throw new Error('invalid param');
|
||||
if (ps.keywords.flat().every(x => x === '') && ps.excludeKeywords.flat().every(x => x === '')) {
|
||||
throw new Error('either keywords or excludeKeywords is required.');
|
||||
}
|
||||
|
||||
const currentAntennasCount = await this.antennasRepository.countBy({
|
||||
|
|
|
@ -82,6 +82,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
private globalEventService: GlobalEventService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
if (ps.keywords.flat().every(x => x === '') && ps.excludeKeywords.flat().every(x => x === '')) {
|
||||
throw new Error('either keywords or excludeKeywords is required.');
|
||||
}
|
||||
// Fetch the antenna
|
||||
const antenna = await this.antennasRepository.findOneBy({
|
||||
id: ps.antennaId,
|
||||
|
|
Loading…
Reference in a new issue