app, messaging-message

This commit is contained in:
tamaina 2021-09-12 22:52:16 +09:00
parent 677a6aae2a
commit 02f6142d01
3 changed files with 6 additions and 10 deletions

View File

@ -1,9 +1,7 @@
import { EntityRepository, Repository } from 'typeorm';
import { App } from '@/models/entities/app';
import { AccessTokens } from '../index';
import { SchemaType } from '@/misc/schema';
export type PackedApp = SchemaType<typeof packedAppSchema>;
import { Packed } from '@/misc/schema';
@EntityRepository(App)
export class AppRepository extends Repository<App> {
@ -15,7 +13,7 @@ export class AppRepository extends Repository<App> {
includeSecret?: boolean,
includeProfileImageIds?: boolean
}
): Promise<PackedApp> {
): Promise<Packed<'App'>> {
const opts = Object.assign({
detail: false,
includeSecret: false,

View File

@ -1,11 +1,9 @@
import { EntityRepository, Repository } from 'typeorm';
import { MessagingMessage } from '@/models/entities/messaging-message';
import { Users, DriveFiles, UserGroups } from '../index';
import { SchemaType } from '@/misc/schema';
import { Packed } from '@/misc/schema';
import { User } from '@/models/entities/user';
export type PackedMessagingMessage = SchemaType<typeof packedMessagingMessageSchema>;
@EntityRepository(MessagingMessage)
export class MessagingMessageRepository extends Repository<MessagingMessage> {
public validateText(text: string): boolean {
@ -19,7 +17,7 @@ export class MessagingMessageRepository extends Repository<MessagingMessage> {
populateRecipient?: boolean,
populateGroup?: boolean,
}
): Promise<PackedMessagingMessage> {
): Promise<Packed<'MessagingMessage'>> {
const opts = options || {
populateRecipient: true,
populateGroup: true,

View File

@ -3,10 +3,10 @@ import config from '@/config/index';
import { SwSubscriptions } from '@/models/index';
import { fetchMeta } from '@/misc/fetch-meta';
import { PackedNotification } from '../models/repositories/notification';
import { PackedMessagingMessage } from '../models/repositories/messaging-message';
import { Packed } from '@/misc/schema';
type notificationType = 'notification' | 'unreadMessagingMessage';
type notificationBody = PackedNotification | PackedMessagingMessage;
type notificationBody = PackedNotification | Packed<'MessagingMessage'>;
export default async function(userId: string, type: notificationType, body: notificationBody) {
const meta = await fetchMeta();