server: remove favorites
This commit is contained in:
parent
de81fac334
commit
aa7171e116
14 changed files with 3 additions and 268 deletions
|
@ -33,7 +33,6 @@ import { UserGroup } from '@/models/entities/user-group.js';
|
||||||
import { UserGroupJoining } from '@/models/entities/user-group-joining.js';
|
import { UserGroupJoining } from '@/models/entities/user-group-joining.js';
|
||||||
import { UserGroupInvitation } from '@/models/entities/user-group-invitation.js';
|
import { UserGroupInvitation } from '@/models/entities/user-group-invitation.js';
|
||||||
import { Hashtag } from '@/models/entities/hashtag.js';
|
import { Hashtag } from '@/models/entities/hashtag.js';
|
||||||
import { NoteFavorite } from '@/models/entities/note-favorite.js';
|
|
||||||
import { AbuseUserReport } from '@/models/entities/abuse-user-report.js';
|
import { AbuseUserReport } from '@/models/entities/abuse-user-report.js';
|
||||||
import { RegistrationTicket } from '@/models/entities/registration-tickets.js';
|
import { RegistrationTicket } from '@/models/entities/registration-tickets.js';
|
||||||
import { MessagingMessage } from '@/models/entities/messaging-message.js';
|
import { MessagingMessage } from '@/models/entities/messaging-message.js';
|
||||||
|
@ -134,7 +133,6 @@ export const entities = [
|
||||||
RenoteMuting,
|
RenoteMuting,
|
||||||
Blocking,
|
Blocking,
|
||||||
Note,
|
Note,
|
||||||
NoteFavorite,
|
|
||||||
NoteReaction,
|
NoteReaction,
|
||||||
NoteWatching,
|
NoteWatching,
|
||||||
NoteThreadMuting,
|
NoteThreadMuting,
|
||||||
|
|
|
@ -5,8 +5,6 @@ export const kinds = [
|
||||||
'write:blocks',
|
'write:blocks',
|
||||||
'read:drive',
|
'read:drive',
|
||||||
'write:drive',
|
'write:drive',
|
||||||
'read:favorites',
|
|
||||||
'write:favorites',
|
|
||||||
'read:following',
|
'read:following',
|
||||||
'write:following',
|
'write:following',
|
||||||
'read:messaging',
|
'read:messaging',
|
||||||
|
|
|
@ -23,7 +23,6 @@ import { packedHashtagSchema } from '@/models/schema/hashtag.js';
|
||||||
import { packedPageSchema } from '@/models/schema/page.js';
|
import { packedPageSchema } from '@/models/schema/page.js';
|
||||||
import { packedUserGroupSchema } from '@/models/schema/user-group.js';
|
import { packedUserGroupSchema } from '@/models/schema/user-group.js';
|
||||||
import { packedUserGroupInvitationSchema } from '@/models/schema/user-group-invitation.js';
|
import { packedUserGroupInvitationSchema } from '@/models/schema/user-group-invitation.js';
|
||||||
import { packedNoteFavoriteSchema } from '@/models/schema/note-favorite.js';
|
|
||||||
import { packedChannelSchema } from '@/models/schema/channel.js';
|
import { packedChannelSchema } from '@/models/schema/channel.js';
|
||||||
import { packedAntennaSchema } from '@/models/schema/antenna.js';
|
import { packedAntennaSchema } from '@/models/schema/antenna.js';
|
||||||
import { packedClipSchema } from '@/models/schema/clip.js';
|
import { packedClipSchema } from '@/models/schema/clip.js';
|
||||||
|
@ -47,7 +46,6 @@ export const refs = {
|
||||||
MessagingMessage: packedMessagingMessageSchema,
|
MessagingMessage: packedMessagingMessageSchema,
|
||||||
Note: packedNoteSchema,
|
Note: packedNoteSchema,
|
||||||
NoteReaction: packedNoteReactionSchema,
|
NoteReaction: packedNoteReactionSchema,
|
||||||
NoteFavorite: packedNoteFavoriteSchema,
|
|
||||||
Notification: packedNotificationSchema,
|
Notification: packedNotificationSchema,
|
||||||
DriveFile: packedDriveFileSchema,
|
DriveFile: packedDriveFileSchema,
|
||||||
DriveFolder: packedDriveFolderSchema,
|
DriveFolder: packedDriveFolderSchema,
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
|
||||||
import { id } from '../id.js';
|
|
||||||
import { Note } from './note.js';
|
|
||||||
import { User } from './user.js';
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
@Index(['userId', 'noteId'], { unique: true })
|
|
||||||
export class NoteFavorite {
|
|
||||||
@PrimaryColumn(id())
|
|
||||||
public id: string;
|
|
||||||
|
|
||||||
@Column('timestamp with time zone', {
|
|
||||||
comment: 'The created date of the NoteFavorite.',
|
|
||||||
})
|
|
||||||
public createdAt: Date;
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column(id())
|
|
||||||
public userId: User['id'];
|
|
||||||
|
|
||||||
@ManyToOne(() => User, {
|
|
||||||
onDelete: 'CASCADE',
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column(id())
|
|
||||||
public noteId: Note['id'];
|
|
||||||
|
|
||||||
@ManyToOne(() => Note, {
|
|
||||||
onDelete: 'CASCADE',
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public note: Note | null;
|
|
||||||
}
|
|
|
@ -29,7 +29,6 @@ import { RenoteMutingRepository } from './repositories/renote-muting.js';
|
||||||
import { BlockingRepository } from './repositories/blocking.js';
|
import { BlockingRepository } from './repositories/blocking.js';
|
||||||
import { NoteReactionRepository } from './repositories/note-reaction.js';
|
import { NoteReactionRepository } from './repositories/note-reaction.js';
|
||||||
import { NotificationRepository } from './repositories/notification.js';
|
import { NotificationRepository } from './repositories/notification.js';
|
||||||
import { NoteFavoriteRepository } from './repositories/note-favorite.js';
|
|
||||||
import { UserPublickey } from './entities/user-publickey.js';
|
import { UserPublickey } from './entities/user-publickey.js';
|
||||||
import { UserKeypair } from './entities/user-keypair.js';
|
import { UserKeypair } from './entities/user-keypair.js';
|
||||||
import { AppRepository } from './repositories/app.js';
|
import { AppRepository } from './repositories/app.js';
|
||||||
|
@ -64,7 +63,6 @@ export const Announcements = db.getRepository(Announcement);
|
||||||
export const AnnouncementReads = db.getRepository(AnnouncementRead);
|
export const AnnouncementReads = db.getRepository(AnnouncementRead);
|
||||||
export const Apps = (AppRepository);
|
export const Apps = (AppRepository);
|
||||||
export const Notes = (NoteRepository);
|
export const Notes = (NoteRepository);
|
||||||
export const NoteFavorites = (NoteFavoriteRepository);
|
|
||||||
export const NoteWatchings = db.getRepository(NoteWatching);
|
export const NoteWatchings = db.getRepository(NoteWatching);
|
||||||
export const NoteThreadMutings = db.getRepository(NoteThreadMuting);
|
export const NoteThreadMutings = db.getRepository(NoteThreadMuting);
|
||||||
export const NoteReactions = (NoteReactionRepository);
|
export const NoteReactions = (NoteReactionRepository);
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
import { db } from '@/db/postgre.js';
|
|
||||||
import { NoteFavorite } from '@/models/entities/note-favorite.js';
|
|
||||||
import { User } from '@/models/entities/user.js';
|
|
||||||
import { Notes } from '../index.js';
|
|
||||||
|
|
||||||
export const NoteFavoriteRepository = db.getRepository(NoteFavorite).extend({
|
|
||||||
async pack(
|
|
||||||
src: NoteFavorite['id'] | NoteFavorite,
|
|
||||||
me?: { id: User['id'] } | null | undefined,
|
|
||||||
) {
|
|
||||||
const favorite = typeof src === 'object' ? src : await this.findOneByOrFail({ id: src });
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: favorite.id,
|
|
||||||
createdAt: favorite.createdAt.toISOString(),
|
|
||||||
noteId: favorite.noteId,
|
|
||||||
// may throw error
|
|
||||||
note: await Notes.pack(favorite.note || favorite.noteId, me),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
packMany(
|
|
||||||
favorites: any[],
|
|
||||||
me: { id: User['id'] },
|
|
||||||
) {
|
|
||||||
return Promise.allSettled(favorites.map(x => this.pack(x, me)))
|
|
||||||
.then(promises => promises.flatMap(result => result.status === 'fulfilled' ? [result.value] : []));
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,26 +0,0 @@
|
||||||
export const packedNoteFavoriteSchema = {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: 'string',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
format: 'id',
|
|
||||||
example: 'xxxxxxxxxx',
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: 'string',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
format: 'date-time',
|
|
||||||
},
|
|
||||||
note: {
|
|
||||||
type: 'object',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
ref: 'Note',
|
|
||||||
},
|
|
||||||
noteId: {
|
|
||||||
type: 'string',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
format: 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
|
@ -162,7 +162,6 @@ import * as ep___i_exportFollowing from './endpoints/i/export-following.js';
|
||||||
import * as ep___i_exportMute from './endpoints/i/export-mute.js';
|
import * as ep___i_exportMute from './endpoints/i/export-mute.js';
|
||||||
import * as ep___i_exportNotes from './endpoints/i/export-notes.js';
|
import * as ep___i_exportNotes from './endpoints/i/export-notes.js';
|
||||||
import * as ep___i_exportUserLists from './endpoints/i/export-user-lists.js';
|
import * as ep___i_exportUserLists from './endpoints/i/export-user-lists.js';
|
||||||
import * as ep___i_favorites from './endpoints/i/favorites.js';
|
|
||||||
import * as ep___i_getWordMutedNotesCount from './endpoints/i/get-word-muted-notes-count.js';
|
import * as ep___i_getWordMutedNotesCount from './endpoints/i/get-word-muted-notes-count.js';
|
||||||
import * as ep___i_importBlocking from './endpoints/i/import-blocking.js';
|
import * as ep___i_importBlocking from './endpoints/i/import-blocking.js';
|
||||||
import * as ep___i_importFollowing from './endpoints/i/import-following.js';
|
import * as ep___i_importFollowing from './endpoints/i/import-following.js';
|
||||||
|
@ -215,8 +214,6 @@ import * as ep___notes_clips from './endpoints/notes/clips.js';
|
||||||
import * as ep___notes_conversation from './endpoints/notes/conversation.js';
|
import * as ep___notes_conversation from './endpoints/notes/conversation.js';
|
||||||
import * as ep___notes_create from './endpoints/notes/create.js';
|
import * as ep___notes_create from './endpoints/notes/create.js';
|
||||||
import * as ep___notes_delete from './endpoints/notes/delete.js';
|
import * as ep___notes_delete from './endpoints/notes/delete.js';
|
||||||
import * as ep___notes_favorites_create from './endpoints/notes/favorites/create.js';
|
|
||||||
import * as ep___notes_favorites_delete from './endpoints/notes/favorites/delete.js';
|
|
||||||
import * as ep___notes_featured from './endpoints/notes/featured.js';
|
import * as ep___notes_featured from './endpoints/notes/featured.js';
|
||||||
import * as ep___notes_globalTimeline from './endpoints/notes/global-timeline.js';
|
import * as ep___notes_globalTimeline from './endpoints/notes/global-timeline.js';
|
||||||
import * as ep___notes_hybridTimeline from './endpoints/notes/hybrid-timeline.js';
|
import * as ep___notes_hybridTimeline from './endpoints/notes/hybrid-timeline.js';
|
||||||
|
@ -459,7 +456,6 @@ const eps = [
|
||||||
['i/export-mute', ep___i_exportMute],
|
['i/export-mute', ep___i_exportMute],
|
||||||
['i/export-notes', ep___i_exportNotes],
|
['i/export-notes', ep___i_exportNotes],
|
||||||
['i/export-user-lists', ep___i_exportUserLists],
|
['i/export-user-lists', ep___i_exportUserLists],
|
||||||
['i/favorites', ep___i_favorites],
|
|
||||||
['i/get-word-muted-notes-count', ep___i_getWordMutedNotesCount],
|
['i/get-word-muted-notes-count', ep___i_getWordMutedNotesCount],
|
||||||
['i/import-blocking', ep___i_importBlocking],
|
['i/import-blocking', ep___i_importBlocking],
|
||||||
['i/import-following', ep___i_importFollowing],
|
['i/import-following', ep___i_importFollowing],
|
||||||
|
@ -512,8 +508,6 @@ const eps = [
|
||||||
['notes/conversation', ep___notes_conversation],
|
['notes/conversation', ep___notes_conversation],
|
||||||
['notes/create', ep___notes_create],
|
['notes/create', ep___notes_create],
|
||||||
['notes/delete', ep___notes_delete],
|
['notes/delete', ep___notes_delete],
|
||||||
['notes/favorites/create', ep___notes_favorites_create],
|
|
||||||
['notes/favorites/delete', ep___notes_favorites_delete],
|
|
||||||
['notes/featured', ep___notes_featured],
|
['notes/featured', ep___notes_featured],
|
||||||
['notes/global-timeline', ep___notes_globalTimeline],
|
['notes/global-timeline', ep___notes_globalTimeline],
|
||||||
['notes/hybrid-timeline', ep___notes_hybridTimeline],
|
['notes/hybrid-timeline', ep___notes_hybridTimeline],
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
import { NoteFavorites } from '@/models/index.js';
|
|
||||||
import define from '@/server/api/define.js';
|
|
||||||
import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js';
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ['account', 'notes', 'favorites'],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: 'read:favorites',
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: 'array',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
items: {
|
|
||||||
type: 'object',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
ref: 'NoteFavorite',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
|
||||||
sinceId: { type: 'string', format: 'misskey:id' },
|
|
||||||
untilId: { type: 'string', format: 'misskey:id' },
|
|
||||||
},
|
|
||||||
required: [],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
const query = makePaginationQuery(NoteFavorites.createQueryBuilder('favorite'), ps.sinceId, ps.untilId)
|
|
||||||
.andWhere('favorite.userId = :meId', { meId: user.id })
|
|
||||||
.leftJoinAndSelect('favorite.note', 'note');
|
|
||||||
|
|
||||||
const favorites = await query
|
|
||||||
.take(ps.limit)
|
|
||||||
.getMany();
|
|
||||||
|
|
||||||
return await NoteFavorites.packMany(favorites, user);
|
|
||||||
});
|
|
|
@ -1,48 +0,0 @@
|
||||||
import { NoteFavorites } from '@/models/index.js';
|
|
||||||
import { genId } from '@/misc/gen-id.js';
|
|
||||||
import define from '@/server/api/define.js';
|
|
||||||
import { ApiError } from '@/server/api/error.js';
|
|
||||||
import { getNote } from '@/server/api/common/getters.js';
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ['notes', 'favorites'],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: 'write:favorites',
|
|
||||||
|
|
||||||
errors: ['NO_SUCH_NOTE', 'ALREADY_FAVORITED'],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
noteId: { type: 'string', format: 'misskey:id' },
|
|
||||||
},
|
|
||||||
required: ['noteId'],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
// Get favoritee
|
|
||||||
const note = await getNote(ps.noteId, user).catch(err => {
|
|
||||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError('NO_SUCH_NOTE');
|
|
||||||
throw err;
|
|
||||||
});
|
|
||||||
|
|
||||||
// if already favorited
|
|
||||||
const exist = await NoteFavorites.countBy({
|
|
||||||
noteId: note.id,
|
|
||||||
userId: user.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (exist) throw new ApiError('ALREADY_FAVORITED');
|
|
||||||
|
|
||||||
// Create favorite
|
|
||||||
await NoteFavorites.insert({
|
|
||||||
id: genId(),
|
|
||||||
createdAt: new Date(),
|
|
||||||
noteId: note.id,
|
|
||||||
userId: user.id,
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,42 +0,0 @@
|
||||||
import { NoteFavorites } from '@/models/index.js';
|
|
||||||
import define from '@/server/api/define.js';
|
|
||||||
import { ApiError } from '@/server/api/error.js';
|
|
||||||
import { getNote } from '@/server/api/common/getters.js';
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ['notes', 'favorites'],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: 'write:favorites',
|
|
||||||
|
|
||||||
errors: ['NO_SUCH_NOTE', 'NOT_FAVORITED'],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
noteId: { type: 'string', format: 'misskey:id' },
|
|
||||||
},
|
|
||||||
required: ['noteId'],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
// Get favoritee
|
|
||||||
const note = await getNote(ps.noteId, user).catch(err => {
|
|
||||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError('NO_SUCH_NOTE');
|
|
||||||
throw err;
|
|
||||||
});
|
|
||||||
|
|
||||||
// if already favorited
|
|
||||||
const exist = await NoteFavorites.findOneBy({
|
|
||||||
noteId: note.id,
|
|
||||||
userId: user.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (exist == null) throw new ApiError('NOT_FAVORITED');
|
|
||||||
|
|
||||||
// Delete favorite
|
|
||||||
await NoteFavorites.delete(exist.id);
|
|
||||||
});
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { NoteFavorites, NoteThreadMutings, NoteWatchings } from '@/models/index.js';
|
import { NoteThreadMutings, NoteWatchings } from '@/models/index.js';
|
||||||
import { ApiError } from '@/server/api/error.js';
|
import { ApiError } from '@/server/api/error.js';
|
||||||
import { getNote } from '@/server/api/common/getters.js';
|
import { getNote } from '@/server/api/common/getters.js';
|
||||||
import define from '@/server/api/define.js';
|
import define from '@/server/api/define.js';
|
||||||
|
@ -12,10 +12,6 @@ export const meta = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
properties: {
|
properties: {
|
||||||
isFavorited: {
|
|
||||||
type: 'boolean',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
},
|
|
||||||
isWatching: {
|
isWatching: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
@ -51,14 +47,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
const [favorite, watching, threadMuting] = await Promise.all([
|
const [watching, threadMuting] = await Promise.all([
|
||||||
NoteFavorites.count({
|
|
||||||
where: {
|
|
||||||
userId: user.id,
|
|
||||||
noteId: note.id,
|
|
||||||
},
|
|
||||||
take: 1,
|
|
||||||
}),
|
|
||||||
NoteWatchings.count({
|
NoteWatchings.count({
|
||||||
where: {
|
where: {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
|
@ -76,7 +65,6 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isFavorited: favorite !== 0,
|
|
||||||
isWatching: watching !== 0,
|
isWatching: watching !== 0,
|
||||||
isMutedThread: threadMuting !== 0,
|
isMutedThread: threadMuting !== 0,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { DriveFiles, Followings, NoteFavorites, NoteReactions, Notes, PageLikes, PollVotes, Users } from '@/models/index.js';
|
import { DriveFiles, Followings, NoteReactions, Notes, PageLikes, PollVotes, Users } from '@/models/index.js';
|
||||||
import { awaitAll } from '@/prelude/await-all.js';
|
import { awaitAll } from '@/prelude/await-all.js';
|
||||||
import define from '@/server/api/define.js';
|
import define from '@/server/api/define.js';
|
||||||
import { ApiError } from '@/server/api/error.js';
|
import { ApiError } from '@/server/api/error.js';
|
||||||
|
@ -76,10 +76,6 @@ export const meta = {
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
},
|
},
|
||||||
noteFavoritesCount: {
|
|
||||||
type: 'integer',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
},
|
|
||||||
pageLikesCount: {
|
pageLikesCount: {
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
@ -148,9 +144,6 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||||
.innerJoin('reaction.note', 'note')
|
.innerJoin('reaction.note', 'note')
|
||||||
.where('note.userId = :userId', { userId: user.id })
|
.where('note.userId = :userId', { userId: user.id })
|
||||||
.getCount(),
|
.getCount(),
|
||||||
noteFavoritesCount: NoteFavorites.createQueryBuilder('favorite')
|
|
||||||
.where('favorite.userId = :userId', { userId: user.id })
|
|
||||||
.getCount(),
|
|
||||||
pageLikesCount: PageLikes.createQueryBuilder('like')
|
pageLikesCount: PageLikes.createQueryBuilder('like')
|
||||||
.where('like.userId = :userId', { userId: user.id })
|
.where('like.userId = :userId', { userId: user.id })
|
||||||
.getCount(),
|
.getCount(),
|
||||||
|
|
|
@ -68,10 +68,6 @@ export const errors: Record<string, { message: string, httpStatusCode: number }>
|
||||||
message: 'That note is already added to that clip.',
|
message: 'That note is already added to that clip.',
|
||||||
httpStatusCode: 409,
|
httpStatusCode: 409,
|
||||||
},
|
},
|
||||||
ALREADY_FAVORITED: {
|
|
||||||
message: 'That note is already favorited.',
|
|
||||||
httpStatusCode: 409,
|
|
||||||
},
|
|
||||||
ALREADY_FOLLOWING: {
|
ALREADY_FOLLOWING: {
|
||||||
message: 'You are already following that user.',
|
message: 'You are already following that user.',
|
||||||
httpStatusCode: 409,
|
httpStatusCode: 409,
|
||||||
|
@ -332,10 +328,6 @@ export const errors: Record<string, { message: string, httpStatusCode: number }>
|
||||||
message: 'That note is not added to that clip.',
|
message: 'That note is not added to that clip.',
|
||||||
httpStatusCode: 409,
|
httpStatusCode: 409,
|
||||||
},
|
},
|
||||||
NOT_FAVORITED: {
|
|
||||||
message: 'You have not favorited that note.',
|
|
||||||
httpStatusCode: 409,
|
|
||||||
},
|
|
||||||
NOT_FOLLOWING: {
|
NOT_FOLLOWING: {
|
||||||
message: 'You are not following that user.',
|
message: 'You are not following that user.',
|
||||||
httpStatusCode: 409,
|
httpStatusCode: 409,
|
||||||
|
|
Loading…
Reference in a new issue