summaryrefslogtreecommitdiff
path: root/packages/backend/src/models
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/models')
-rw-r--r--packages/backend/src/models/UserProfile.ts28
-rw-r--r--packages/backend/src/models/json-schema/user.ts10
2 files changed, 22 insertions, 16 deletions
diff --git a/packages/backend/src/models/UserProfile.ts b/packages/backend/src/models/UserProfile.ts
index e4405c9da7..d6d85c5609 100644
--- a/packages/backend/src/models/UserProfile.ts
+++ b/packages/backend/src/models/UserProfile.ts
@@ -8,6 +8,7 @@ import { obsoleteNotificationTypes, ffVisibility, notificationTypes } from '@/ty
import { id } from './util/id.js';
import { MiUser } from './User.js';
import { MiPage } from './Page.js';
+import { MiUserList } from './UserList.js';
// TODO: このテーブルで管理している情報すべてレジストリで管理するようにしても良いかも
// ただ、「emailVerified が true なユーザーを find する」のようなクエリは書けなくなるからウーン
@@ -222,16 +223,25 @@ export class MiUserProfile {
})
public mutedInstances: string[];
- @Column('enum', {
- enum: [
- ...notificationTypes,
- // マイグレーションで削除が困難なので古いenumは残しておく
- ...obsoleteNotificationTypes,
- ],
- array: true,
- default: [],
+ @Column('jsonb', {
+ default: {},
})
- public mutingNotificationTypes: typeof notificationTypes[number][];
+ public notificationRecieveConfig: {
+ [notificationType in typeof notificationTypes[number]]?: {
+ type: 'all';
+ } | {
+ type: 'never';
+ } | {
+ type: 'following';
+ } | {
+ type: 'follower';
+ } | {
+ type: 'mutualFollow';
+ } | {
+ type: 'list';
+ userListId: MiUserList['id'];
+ };
+ };
@Column('varchar', {
length: 32, array: true, default: '{}',
diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts
index f15b225a30..0181ea50e8 100644
--- a/packages/backend/src/models/json-schema/user.ts
+++ b/packages/backend/src/models/json-schema/user.ts
@@ -387,13 +387,9 @@ export const packedMeDetailedOnlySchema = {
nullable: false, optional: false,
},
},
- mutingNotificationTypes: {
- type: 'array',
- nullable: true, optional: false,
- items: {
- type: 'string',
- nullable: false, optional: false,
- },
+ notificationRecieveConfig: {
+ type: 'object',
+ nullable: false, optional: false,
},
emailNotificationTypes: {
type: 'array',