add notifications for shared access granted/revoked/login

This commit is contained in:
Hazelnoot 2025-06-21 22:01:23 -04:00
parent 2a13e97863
commit 35a167701f
10 changed files with 260 additions and 12 deletions

View file

@ -152,6 +152,22 @@ export type MiNotification = {
id: string;
createdAt: string;
noteId: MiNote['id'];
} | {
type: 'sharedAccessGranted';
id: string;
createdAt: string;
notifierId: MiUser['id'];
tokenId: MiAccessToken['id'];
} | {
type: 'sharedAccessRevoked';
id: string;
createdAt: string;
notifierId: MiUser['id'];
} | {
type: 'sharedAccessLogin';
id: string;
createdAt: string;
notifierId: MiUser['id'];
};
export type MiGroupedNotification = MiNotification | {

View file

@ -460,6 +460,88 @@ export const packedNotificationSchema = {
optional: false, nullable: false,
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['sharedAccessGranted'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
token: {
type: 'object',
optional: false, nullable: true,
properties: {
id: {
type: 'string',
optional: false, nullable: false,
},
permission: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'string',
},
},
rank: {
type: 'string',
enum: ['admin', 'mod', 'user'],
optional: false, nullable: true,
},
},
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['sharedAccessRevoked'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
}, {
type: 'object',
properties: {
...baseSchema.properties,
type: {
type: 'string',
optional: false, nullable: false,
enum: ['sharedAccessLogin'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
}, {
type: 'object',
properties: {