add achievement

This commit is contained in:
syuilo
2023-01-22 08:00:42 +09:00
parent 7fdf298bd4
commit 26ae2dfc0f
4 changed files with 17 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
import { GetterService } from '@/server/api/GetterService.js';
import { DI } from '@/di-symbols.js';
import { ApiError } from '../../../error.js';
import { AchievementService } from '@/core/AchievementService.js';
export const meta = {
tags: ['notes', 'favorites'],
@@ -51,6 +52,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
private idService: IdService,
private getterService: GetterService,
private achievementService: AchievementService,
) {
super(meta, paramDef, async (ps, me) => {
// Get favoritee
@@ -76,6 +78,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
noteId: note.id,
userId: me.id,
});
if (note.userHost == null) {
this.achievementService.create(note.userId, 'myNoteFavorited1');
}
});
}
}