summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/RoleService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-01-25 11:18:16 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-01-25 11:18:16 +0900
commit520ed8cb4d04004717e25185a8805e05ece413d7 (patch)
treec6385de2170dc7796bc2974c7dbe04c158d60e34 /packages/backend/src/core/RoleService.ts
parentfix(server): /api/signin always returns 429 when request header x-forwarded-f... (diff)
downloadmisskey-520ed8cb4d04004717e25185a8805e05ece413d7.tar.gz
misskey-520ed8cb4d04004717e25185a8805e05ece413d7.tar.bz2
misskey-520ed8cb4d04004717e25185a8805e05ece413d7.zip
refactor(server): fix type errors
Diffstat (limited to 'packages/backend/src/core/RoleService.ts')
-rw-r--r--packages/backend/src/core/RoleService.ts26
1 files changed, 16 insertions, 10 deletions
diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts
index c0f5eae3d7..f8f9231cdd 100644
--- a/packages/backend/src/core/RoleService.ts
+++ b/packages/backend/src/core/RoleService.ts
@@ -91,10 +91,12 @@ export class RoleService implements OnApplicationShutdown {
case 'roleCreated': {
const cached = this.rolesCache.get(null);
if (cached) {
- body.createdAt = new Date(body.createdAt);
- body.updatedAt = new Date(body.updatedAt);
- body.lastUsedAt = new Date(body.lastUsedAt);
- cached.push(body);
+ cached.push({
+ ...body,
+ createdAt: new Date(body.createdAt),
+ updatedAt: new Date(body.updatedAt),
+ lastUsedAt: new Date(body.lastUsedAt),
+ });
}
break;
}
@@ -103,10 +105,12 @@ export class RoleService implements OnApplicationShutdown {
if (cached) {
const i = cached.findIndex(x => x.id === body.id);
if (i > -1) {
- body.createdAt = new Date(body.createdAt);
- body.updatedAt = new Date(body.updatedAt);
- body.lastUsedAt = new Date(body.lastUsedAt);
- cached[i] = body;
+ cached[i] = {
+ ...body,
+ createdAt: new Date(body.createdAt),
+ updatedAt: new Date(body.updatedAt),
+ lastUsedAt: new Date(body.lastUsedAt),
+ };
}
}
break;
@@ -121,8 +125,10 @@ export class RoleService implements OnApplicationShutdown {
case 'userRoleAssigned': {
const cached = this.roleAssignmentByUserIdCache.get(body.userId);
if (cached) {
- body.createdAt = new Date(body.createdAt);
- cached.push(body);
+ cached.push({
+ ...body,
+ createdAt: new Date(body.createdAt),
+ });
}
break;
}