NoteSchedule -> ScheduledNote
This commit is contained in:
parent
54fa83f1c5
commit
a0e9ebfb83
|
@ -15,7 +15,7 @@ export const DI = {
|
|||
//#region Repositories
|
||||
usersRepository: Symbol('usersRepository'),
|
||||
notesRepository: Symbol('notesRepository'),
|
||||
noteScheduleRepository: Symbol('noteScheduleRepository'),
|
||||
scheduledNotesRepository: Symbol('scheduledNotesRepository'),
|
||||
announcementsRepository: Symbol('announcementsRepository'),
|
||||
announcementReadsRepository: Symbol('announcementReadsRepository'),
|
||||
appsRepository: Symbol('appsRepository'),
|
||||
|
|
|
@ -71,7 +71,7 @@ import {
|
|||
MiUserPublickey,
|
||||
MiUserSecurityKey,
|
||||
MiWebhook,
|
||||
MiNoteSchedule,
|
||||
MiScheduledNote,
|
||||
} from './_.js';
|
||||
import type { DataSource } from 'typeorm';
|
||||
import type { Provider } from '@nestjs/common';
|
||||
|
@ -88,9 +88,9 @@ const $notesRepository: Provider = {
|
|||
inject: [DI.db],
|
||||
};
|
||||
|
||||
const $noteScheduleRepository: Provider = {
|
||||
provide: DI.noteScheduleRepository,
|
||||
useFactory: (db: DataSource) => db.getRepository(MiNoteSchedule),
|
||||
const $scheduledNotesRepository: Provider = {
|
||||
provide: DI.scheduledNotesRepository,
|
||||
useFactory: (db: DataSource) => db.getRepository(MiScheduledNote),
|
||||
inject: [DI.db],
|
||||
};
|
||||
|
||||
|
@ -478,7 +478,7 @@ const $userMemosRepository: Provider = {
|
|||
providers: [
|
||||
$usersRepository,
|
||||
$notesRepository,
|
||||
$noteScheduleRepository,
|
||||
$scheduledNotesRepository,
|
||||
$announcementsRepository,
|
||||
$announcementReadsRepository,
|
||||
$appsRepository,
|
||||
|
@ -546,7 +546,7 @@ const $userMemosRepository: Provider = {
|
|||
exports: [
|
||||
$usersRepository,
|
||||
$notesRepository,
|
||||
$noteScheduleRepository,
|
||||
$scheduledNotesRepository,
|
||||
$announcementsRepository,
|
||||
$announcementReadsRepository,
|
||||
$appsRepository,
|
||||
|
|
|
@ -9,7 +9,7 @@ import { id } from './util/id.js';
|
|||
import { MiUser } from './User.js';
|
||||
|
||||
@Entity('note_schedule')
|
||||
export class MiNoteSchedule {
|
||||
export class MiScheduledNote {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
|
@ -68,7 +68,7 @@ import { MiRoleAssignment } from '@/models/RoleAssignment.js';
|
|||
import { MiFlash } from '@/models/Flash.js';
|
||||
import { MiFlashLike } from '@/models/FlashLike.js';
|
||||
import { MiUserListFavorite } from '@/models/UserListFavorite.js';
|
||||
import { MiNoteSchedule } from './NoteSchedule.js';
|
||||
import { MiScheduledNote } from './ScheduledNote.js';
|
||||
import type { Repository } from 'typeorm';
|
||||
|
||||
export {
|
||||
|
@ -105,7 +105,7 @@ export {
|
|||
MiNoteReaction,
|
||||
MiNoteThreadMuting,
|
||||
MiNoteUnread,
|
||||
MiNoteSchedule,
|
||||
MiScheduledNote,
|
||||
MiPage,
|
||||
MiPageLike,
|
||||
MiPasswordResetRequest,
|
||||
|
@ -173,7 +173,7 @@ export type NoteFavoritesRepository = Repository<MiNoteFavorite>;
|
|||
export type NoteReactionsRepository = Repository<MiNoteReaction>;
|
||||
export type NoteThreadMutingsRepository = Repository<MiNoteThreadMuting>;
|
||||
export type NoteUnreadsRepository = Repository<MiNoteUnread>;
|
||||
export type NoteScheduleRepository = Repository<MiNoteSchedule>;
|
||||
export type ScheduledNotesRepository = Repository<MiScheduledNote>;
|
||||
export type PagesRepository = Repository<MiPage>;
|
||||
export type PageLikesRepository = Repository<MiPageLike>;
|
||||
export type PasswordResetRequestsRepository = Repository<MiPasswordResetRequest>;
|
||||
|
|
|
@ -76,7 +76,7 @@ import { MiRoleAssignment } from '@/models/RoleAssignment.js';
|
|||
import { MiFlash } from '@/models/Flash.js';
|
||||
import { MiFlashLike } from '@/models/FlashLike.js';
|
||||
import { MiUserMemo } from '@/models/UserMemo.js';
|
||||
import { MiNoteSchedule } from '@/models/NoteSchedule.js';
|
||||
import { MiScheduledNote } from '@/models/ScheduledNote.js';
|
||||
|
||||
import { Config } from '@/config.js';
|
||||
import MisskeyLogger from '@/logger.js';
|
||||
|
@ -150,7 +150,7 @@ export const entities = [
|
|||
MiRenoteMuting,
|
||||
MiBlocking,
|
||||
MiNote,
|
||||
MiNoteSchedule,
|
||||
MiScheduledNote,
|
||||
MiNoteFavorite,
|
||||
MiNoteReaction,
|
||||
MiNoteThreadMuting,
|
||||
|
|
|
@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
|||
import type Logger from '@/logger.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { NoteCreateService } from '@/core/NoteCreateService.js';
|
||||
import type { NoteScheduleRepository, UsersRepository } from '@/models/_.js';
|
||||
import type { ScheduledNotesRepository, UsersRepository } from '@/models/_.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||
import type * as Bull from 'bullmq';
|
||||
|
@ -18,8 +18,8 @@ export class ScheduleNotePostProcessorService {
|
|||
private logger: Logger;
|
||||
|
||||
constructor(
|
||||
@Inject(DI.noteScheduleRepository)
|
||||
private noteScheduleRepository: NoteScheduleRepository,
|
||||
@Inject(DI.scheduledNotesRepository)
|
||||
private scheduledNotesRepository: ScheduledNotesRepository,
|
||||
|
||||
@Inject(DI.usersRepository)
|
||||
private usersRepository: UsersRepository,
|
||||
|
@ -32,14 +32,14 @@ export class ScheduleNotePostProcessorService {
|
|||
|
||||
@bindThis
|
||||
public async process(job: Bull.Job<ScheduleNotePostJobData>): Promise<void> {
|
||||
this.noteScheduleRepository.findOneBy({ id: job.data.scheduleNoteId }).then(async (data) => {
|
||||
this.scheduledNotesRepository.findOneBy({ id: job.data.scheduleNoteId }).then(async (data) => {
|
||||
if (!data) {
|
||||
this.logger.warn(`Schedule note ${job.data.scheduleNoteId} not found`);
|
||||
} else {
|
||||
data.note.createdAt = new Date();
|
||||
const me = await this.usersRepository.findOneByOrFail({ id: data.userId });
|
||||
await this.noteCreateService.create(me, data.note);
|
||||
await this.noteScheduleRepository.remove(data);
|
||||
await this.scheduledNotesRepository.remove(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import type { MiLocalUser, MiUser } from '@/models/User.js';
|
|||
import type { MiWebhook } from '@/models/Webhook.js';
|
||||
import type { IActivity } from '@/core/activitypub/type.js';
|
||||
import { IPoll } from '@/models/Poll.js';
|
||||
import { MiNoteSchedule } from '@/models/NoteSchedule.js';
|
||||
import { MiScheduledNote } from '@/models/ScheduledNote.js';
|
||||
import { MiChannel } from '@/models/Channel.js';
|
||||
import { MiApp } from '@/models/App.js';
|
||||
import type httpSignature from '@peertube/http-signature';
|
||||
|
|
|
@ -16,7 +16,7 @@ import type {
|
|||
BlockingsRepository,
|
||||
DriveFilesRepository,
|
||||
ChannelsRepository,
|
||||
NoteScheduleRepository,
|
||||
ScheduledNotesRepository,
|
||||
} from '@/models/_.js';
|
||||
import type { MiNoteCreateOption } from '@/types.js';
|
||||
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
|
||||
|
@ -205,8 +205,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
@Inject(DI.notesRepository)
|
||||
private notesRepository: NotesRepository,
|
||||
|
||||
@Inject(DI.noteScheduleRepository)
|
||||
private noteScheduleRepository: NoteScheduleRepository,
|
||||
@Inject(DI.scheduledNotesRepository)
|
||||
private scheduledNotesRepository: ScheduledNotesRepository,
|
||||
|
||||
@Inject(DI.blockingsRepository)
|
||||
private blockingsRepository: BlockingsRepository,
|
||||
|
@ -366,7 +366,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
if (ps.schedule && ps.schedule.expiresAt) {
|
||||
me.token = null;
|
||||
const scheduleNoteId = this.idService.gen(new Date().getTime());
|
||||
await this.noteScheduleRepository.insert({
|
||||
await this.scheduledNotesRepository.insert({
|
||||
id: scheduleNoteId,
|
||||
note: note,
|
||||
userId: me.id,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import ms from 'ms';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import type { NoteScheduleRepository } from '@/models/_.js';
|
||||
import type { ScheduledNotesRepository } from '@/models/_.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
|
||||
|
@ -39,11 +39,11 @@ export const paramDef = {
|
|||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||
constructor(
|
||||
@Inject(DI.noteScheduleRepository)
|
||||
private noteScheduleRepository: NoteScheduleRepository,
|
||||
@Inject(DI.scheduledNotesRepository)
|
||||
private scheduledNotesRepository: ScheduledNotesRepository,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
await this.noteScheduleRepository.delete({ id: ps.noteId });
|
||||
await this.scheduledNotesRepository.delete({ id: ps.noteId });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import ms from 'ms';
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { NoteScheduleRepository } from '@/models/_.js';
|
||||
import type { ScheduledNotesRepository } from '@/models/_.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
|
||||
export const meta = {
|
||||
|
@ -62,12 +62,12 @@ export const paramDef = {
|
|||
@Injectable()
|
||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||
constructor(
|
||||
@Inject(DI.noteScheduleRepository)
|
||||
private noteScheduleRepository: NoteScheduleRepository,
|
||||
@Inject(DI.scheduledNotesRepository)
|
||||
private scheduledNotesRepository: ScheduledNotesRepository,
|
||||
private userEntityService: UserEntityService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const scheduleNotes = await this.noteScheduleRepository.findBy({ userId: me.id });
|
||||
const scheduleNotes = await this.scheduledNotesRepository.findBy({ userId: me.id });
|
||||
const user = await this.userEntityService.pack(me, me);
|
||||
const scheduleNotesPack: {
|
||||
id: string;
|
||||
|
|
|
@ -9,7 +9,7 @@ import type { MiChannel } from '@/models/Channel.js';
|
|||
import type { MiApp } from '@/models/App.js';
|
||||
import type { MiUser } from '@/models/User.js';
|
||||
import type { MiNote } from '@/models/Note.js';
|
||||
import type { MiNoteSchedule } from '@/models/NoteSchedule.js';
|
||||
import type { MiScheduledNote } from '@/models/ScheduledNote.js';
|
||||
|
||||
/**
|
||||
* note - 通知オンにしているユーザーが投稿した
|
||||
|
@ -262,7 +262,7 @@ export type MiNoteCreateOption = {
|
|||
renote?: MiNote | null;
|
||||
files?: MiDriveFile[] | null;
|
||||
poll?: IPoll | null;
|
||||
schedule?: MiNoteSchedule | null;
|
||||
schedule?: MiScheduledNote | null;
|
||||
localOnly?: boolean | null;
|
||||
reactionAcceptance?: MiNote['reactionAcceptance'];
|
||||
cw?: string | null;
|
||||
|
|
Loading…
Reference in New Issue