refactor: prefix Mi for all entities (#11719)
* wip * wip * wip * wip * Update RepositoryModule.ts * wip * wip * wip * Revert "wip" This reverts commit c1c13b37d2aaf3c65bc148212da302b0eb7868bf.
This commit is contained in:
parent
9264ca336b
commit
792622aead
229 changed files with 1990 additions and 1990 deletions
|
@ -6,8 +6,8 @@
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Brackets } from 'typeorm';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { User } from '@/models/entities/User.js';
|
||||
import type { AnnouncementReadsRepository, AnnouncementsRepository, Announcement, AnnouncementRead } from '@/models/index.js';
|
||||
import type { MiUser } from '@/models/entities/User.js';
|
||||
import type { AnnouncementReadsRepository, AnnouncementsRepository, MiAnnouncement, MiAnnouncementRead } from '@/models/index.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { Packed } from '@/misc/json-schema.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
|
@ -28,14 +28,14 @@ export class AnnouncementService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async getReads(userId: User['id']): Promise<AnnouncementRead[]> {
|
||||
public async getReads(userId: MiUser['id']): Promise<MiAnnouncementRead[]> {
|
||||
return this.announcementReadsRepository.findBy({
|
||||
userId: userId,
|
||||
});
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async getUnreadAnnouncements(user: User): Promise<Announcement[]> {
|
||||
public async getUnreadAnnouncements(user: MiUser): Promise<MiAnnouncement[]> {
|
||||
const readsQuery = this.announcementReadsRepository.createQueryBuilder('read')
|
||||
.select('read.announcementId')
|
||||
.where('read.userId = :userId', { userId: user.id });
|
||||
|
@ -58,7 +58,7 @@ export class AnnouncementService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async create(values: Partial<Announcement>): Promise<{ raw: Announcement; packed: Packed<'Announcement'> }> {
|
||||
public async create(values: Partial<MiAnnouncement>): Promise<{ raw: MiAnnouncement; packed: Packed<'Announcement'> }> {
|
||||
const announcement = await this.announcementsRepository.insert({
|
||||
id: this.idService.genId(),
|
||||
createdAt: new Date(),
|
||||
|
@ -92,7 +92,7 @@ export class AnnouncementService {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async read(user: User, announcementId: Announcement['id']): Promise<void> {
|
||||
public async read(user: MiUser, announcementId: MiAnnouncement['id']): Promise<void> {
|
||||
try {
|
||||
await this.announcementReadsRepository.insert({
|
||||
id: this.idService.genId(),
|
||||
|
@ -111,10 +111,10 @@ export class AnnouncementService {
|
|||
|
||||
@bindThis
|
||||
public async packMany(
|
||||
announcements: Announcement[],
|
||||
me?: { id: User['id'] } | null | undefined,
|
||||
announcements: MiAnnouncement[],
|
||||
me?: { id: MiUser['id'] } | null | undefined,
|
||||
options?: {
|
||||
reads?: AnnouncementRead[];
|
||||
reads?: MiAnnouncementRead[];
|
||||
},
|
||||
): Promise<Packed<'Announcement'>[]> {
|
||||
const reads = me ? (options?.reads ?? await this.getReads(me.id)) : [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue