mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
add antenna mark read functionality
This commit is contained in:
parent
377f16308a
commit
a453448c90
@ -0,0 +1,45 @@
|
||||
import define from '../../define.js';
|
||||
import { Antennas, AntennaNotes } from '@/models/index.js';
|
||||
import { FindOptionsWhere } from 'typeorm';
|
||||
import { AntennaNote } from '@/models/entities/antenna-note.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['antennas', 'account'],
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
kind: 'write:account',
|
||||
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
antennaId: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
required: ['antennaId'],
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
const antenna = await Antennas.findOneBy({
|
||||
userId: me.id,
|
||||
id: ps.antennaId,
|
||||
});
|
||||
|
||||
if (!antenna) {
|
||||
return null
|
||||
}
|
||||
|
||||
await AntennaNotes.update({
|
||||
antennaId: antenna.id,
|
||||
read: false,
|
||||
}, {
|
||||
read: true,
|
||||
})
|
||||
|
||||
return true
|
||||
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user