enhance(role): ロールの割り当て時メモを残せるように (MisskeyIO#842)

This commit is contained in:
あわわわとーにゅ 2024-12-25 09:42:59 +09:00 committed by GitHub
parent 346c848134
commit 6542ad4a12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 72 additions and 7 deletions

View file

@ -49,6 +49,7 @@ export const paramDef = {
properties: {
roleId: { type: 'string', format: 'misskey:id' },
userId: { type: 'string', format: 'misskey:id' },
memo: { type: 'string' },
expiresAt: {
type: 'integer',
nullable: true,
@ -90,7 +91,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
return;
}
await this.roleService.assign(user.id, role.id, ps.expiresAt ? new Date(ps.expiresAt) : null, me);
await this.roleService.assign(user.id, role.id, ps.memo, ps.expiresAt ? new Date(ps.expiresAt) : null, me);
});
}
}

View file

@ -36,6 +36,7 @@ export const meta = {
id: { type: 'string', format: 'misskey:id' },
createdAt: { type: 'string', format: 'date-time' },
user: { ref: 'UserDetailed' },
memo: { type: 'string', nullable: true },
expiresAt: { type: 'string', format: 'date-time', nullable: true },
},
required: ['id', 'createdAt', 'user'],
@ -93,6 +94,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
id: assign.id,
createdAt: this.idService.parse(assign.id).date.toISOString(),
user: await this.userEntityService.pack(assign.user!, me, { schema: 'UserDetailed' }),
memo: assign.memo,
expiresAt: assign.expiresAt?.toISOString() ?? null,
})));
});

View file

@ -177,6 +177,10 @@ export const meta = {
type: 'string',
optional: false, nullable: false,
},
memo: {
type: 'string',
optional: false, nullable: true,
}
},
},
},
@ -262,6 +266,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
createdAt: this.idService.parse(a.id).date.toISOString(),
expiresAt: a.expiresAt ? a.expiresAt.toISOString() : null,
roleId: a.roleId,
memo: a.memo,
})),
};
});