correct name of SkLatestNote
This commit is contained in:
parent
b15f25758a
commit
fea993f6b2
7 changed files with 16 additions and 16 deletions
|
@ -14,7 +14,7 @@ import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mf
|
|||
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
||||
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
||||
import { MiNote } from '@/models/Note.js';
|
||||
import { LatestNote } from '@/models/LatestNote.js';
|
||||
import { SkLatestNote } from '@/models/LatestNote.js';
|
||||
import type { ChannelFollowingsRepository, ChannelsRepository, FollowingsRepository, InstancesRepository, LatestNotesRepository, MiFollowing, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserListMembershipsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||
import type { MiApp } from '@/models/App.js';
|
||||
|
@ -1159,7 +1159,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
if (currentLatest != null && currentLatest.noteId >= note.id) return;
|
||||
|
||||
// Record this as the latest note for the given user
|
||||
const latestNote = new LatestNote({
|
||||
const latestNote = new SkLatestNote({
|
||||
userId: note.userId,
|
||||
noteId: note.id,
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ import { Brackets, In, Not } from 'typeorm';
|
|||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/User.js';
|
||||
import type { MiNote, IMentionedRemoteUsers } from '@/models/Note.js';
|
||||
import { LatestNote } from '@/models/LatestNote.js';
|
||||
import { SkLatestNote } from '@/models/LatestNote.js';
|
||||
import type { InstancesRepository, LatestNotesRepository, NotesRepository, UsersRepository } from '@/models/_.js';
|
||||
import { RelayService } from '@/core/RelayService.js';
|
||||
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||
|
@ -268,7 +268,7 @@ export class NoteDeleteService {
|
|||
if (!nextLatest) return;
|
||||
|
||||
// Record it as the latest
|
||||
const latestNote = new LatestNote({
|
||||
const latestNote = new SkLatestNote({
|
||||
userId: note.userId,
|
||||
noteId: nextLatest.id,
|
||||
});
|
||||
|
@ -278,7 +278,7 @@ export class NoteDeleteService {
|
|||
await this.latestNotesRepository
|
||||
.createQueryBuilder('latest')
|
||||
.insert()
|
||||
.into(LatestNote)
|
||||
.into(SkLatestNote)
|
||||
.values(latestNote)
|
||||
.orIgnore()
|
||||
.execute();
|
||||
|
|
|
@ -13,7 +13,7 @@ import { MiNote } from '@/models/Note.js';
|
|||
* DMs are not counted.
|
||||
*/
|
||||
@Entity('latest_note')
|
||||
export class LatestNote {
|
||||
export class SkLatestNote {
|
||||
@PrimaryColumn({
|
||||
name: 'user_id',
|
||||
type: 'varchar' as const,
|
||||
|
@ -44,7 +44,7 @@ export class LatestNote {
|
|||
})
|
||||
public note: MiNote | null;
|
||||
|
||||
constructor(data?: Partial<LatestNote>) {
|
||||
constructor(data?: Partial<SkLatestNote>) {
|
||||
if (!data) return;
|
||||
|
||||
for (const [k, v] of Object.entries(data)) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import type { Provider } from '@nestjs/common';
|
|||
import { Module } from '@nestjs/common';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import {
|
||||
LatestNote,
|
||||
SkLatestNote,
|
||||
MiAbuseReportNotificationRecipient,
|
||||
MiAbuseUserReport,
|
||||
MiAccessToken,
|
||||
|
@ -121,7 +121,7 @@ const $avatarDecorationsRepository: Provider = {
|
|||
|
||||
const $latestNotesRepository: Provider = {
|
||||
provide: DI.latestNotesRepository,
|
||||
useFactory: (db: DataSource) => db.getRepository(LatestNote).extend(miRepository as MiRepository<LatestNote>),
|
||||
useFactory: (db: DataSource) => db.getRepository(SkLatestNote).extend(miRepository as MiRepository<SkLatestNote>),
|
||||
inject: [DI.db],
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import { RelationIdLoader } from 'typeorm/query-builder/relation-id/RelationIdLo
|
|||
import { RawSqlResultsToEntityTransformer } from 'typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js';
|
||||
import { ObjectUtils } from 'typeorm/util/ObjectUtils.js';
|
||||
import { OrmUtils } from 'typeorm/util/OrmUtils.js';
|
||||
import { LatestNote } from '@/models/LatestNote.js';
|
||||
import { SkLatestNote } from '@/models/LatestNote.js';
|
||||
import { MiAbuseUserReport } from '@/models/AbuseUserReport.js';
|
||||
import { MiAbuseReportNotificationRecipient } from '@/models/AbuseReportNotificationRecipient.js';
|
||||
import { MiAccessToken } from '@/models/AccessToken.js';
|
||||
|
@ -127,7 +127,7 @@ export const miRepository = {
|
|||
} satisfies MiRepository<ObjectLiteral>;
|
||||
|
||||
export {
|
||||
LatestNote,
|
||||
SkLatestNote,
|
||||
MiAbuseUserReport,
|
||||
MiAbuseReportNotificationRecipient,
|
||||
MiAccessToken,
|
||||
|
@ -226,7 +226,7 @@ export type GalleryPostsRepository = Repository<MiGalleryPost> & MiRepository<Mi
|
|||
export type HashtagsRepository = Repository<MiHashtag> & MiRepository<MiHashtag>;
|
||||
export type InstancesRepository = Repository<MiInstance> & MiRepository<MiInstance>;
|
||||
export type MetasRepository = Repository<MiMeta> & MiRepository<MiMeta>;
|
||||
export type LatestNotesRepository = Repository<LatestNote> & MiRepository<LatestNote>;
|
||||
export type LatestNotesRepository = Repository<SkLatestNote> & MiRepository<SkLatestNote>;
|
||||
export type ModerationLogsRepository = Repository<MiModerationLog> & MiRepository<MiModerationLog>;
|
||||
export type MutingsRepository = Repository<MiMuting> & MiRepository<MiMuting>;
|
||||
export type RenoteMutingsRepository = Repository<MiRenoteMuting> & MiRepository<MiRenoteMuting>;
|
||||
|
|
|
@ -83,7 +83,7 @@ import { MiReversiGame } from '@/models/ReversiGame.js';
|
|||
import { Config } from '@/config.js';
|
||||
import MisskeyLogger from '@/logger.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { LatestNote } from '@/models/LatestNote.js';
|
||||
import { SkLatestNote } from '@/models/LatestNote.js';
|
||||
|
||||
pg.types.setTypeParser(20, Number);
|
||||
|
||||
|
@ -131,7 +131,7 @@ class MyCustomLogger implements Logger {
|
|||
}
|
||||
|
||||
export const entities = [
|
||||
LatestNote,
|
||||
SkLatestNote,
|
||||
MiAnnouncement,
|
||||
MiAnnouncementRead,
|
||||
MiMeta,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { LatestNote, MiFollowing } from '@/models/_.js';
|
||||
import { SkLatestNote, MiFollowing } from '@/models/_.js';
|
||||
import type { NotesRepository } from '@/models/_.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
|
@ -57,7 +57,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.setParameter('me', me.id)
|
||||
|
||||
// Limit to latest notes
|
||||
.innerJoin(LatestNote, 'latest', 'note.id = latest.note_id')
|
||||
.innerJoin(SkLatestNote, 'latest', 'note.id = latest.note_id')
|
||||
|
||||
// Avoid N+1 queries from the "pack" method
|
||||
.innerJoinAndSelect('note.user', 'user')
|
||||
|
|
Loading…
Reference in a new issue