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