summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-08-27 15:59:39 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-08-27 15:59:39 +0900
commit87d09f255dd702627bbc6fa58692eebba3830889 (patch)
treeb5defcefd421adcc24c56708ea3393b91c788c93 /packages/backend/src/server/api
parentperf(frontend): use WeakMap (diff)
downloadmisskey-87d09f255dd702627bbc6fa58692eebba3830889.tar.gz
misskey-87d09f255dd702627bbc6fa58692eebba3830889.tar.bz2
misskey-87d09f255dd702627bbc6fa58692eebba3830889.zip
refactor
Diffstat (limited to 'packages/backend/src/server/api')
-rw-r--r--packages/backend/src/server/api/endpoints/i/webhooks/list.ts48
-rw-r--r--packages/backend/src/server/api/endpoints/i/webhooks/show.ts24
2 files changed, 13 insertions, 59 deletions
diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/list.ts b/packages/backend/src/server/api/endpoints/i/webhooks/list.ts
index 394c178f2a..8a3ba9e026 100644
--- a/packages/backend/src/server/api/endpoints/i/webhooks/list.ts
+++ b/packages/backend/src/server/api/endpoints/i/webhooks/list.ts
@@ -21,29 +21,7 @@ export const meta = {
type: 'array',
items: {
type: 'object',
- properties: {
- id: {
- type: 'string',
- format: 'misskey:id',
- },
- userId: {
- type: 'string',
- format: 'misskey:id',
- },
- name: { type: 'string' },
- on: {
- type: 'array',
- items: {
- type: 'string',
- enum: webhookEventTypes,
- },
- },
- url: { type: 'string' },
- secret: { type: 'string' },
- active: { type: 'boolean' },
- latestSentAt: { type: 'string', format: 'date-time', nullable: true },
- latestStatus: { type: 'integer', nullable: true },
- },
+ ref: 'UserWebhook',
},
},
} as const;
@@ -65,19 +43,17 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
userId: me.id,
});
- return webhooks.map(webhook => (
- {
- id: webhook.id,
- userId: webhook.userId,
- name: webhook.name,
- on: webhook.on,
- url: webhook.url,
- secret: webhook.secret,
- active: webhook.active,
- latestSentAt: webhook.latestSentAt ? webhook.latestSentAt.toISOString() : null,
- latestStatus: webhook.latestStatus,
- }
- ));
+ return webhooks.map(webhook => ({
+ id: webhook.id,
+ userId: webhook.userId,
+ name: webhook.name,
+ on: webhook.on,
+ url: webhook.url,
+ secret: webhook.secret,
+ active: webhook.active,
+ latestSentAt: webhook.latestSentAt ? webhook.latestSentAt.toISOString() : null,
+ latestStatus: webhook.latestStatus,
+ }));
});
}
}
diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/show.ts b/packages/backend/src/server/api/endpoints/i/webhooks/show.ts
index 4a0c09ff0c..1c19081c98 100644
--- a/packages/backend/src/server/api/endpoints/i/webhooks/show.ts
+++ b/packages/backend/src/server/api/endpoints/i/webhooks/show.ts
@@ -28,29 +28,7 @@ export const meta = {
res: {
type: 'object',
- properties: {
- id: {
- type: 'string',
- format: 'misskey:id',
- },
- userId: {
- type: 'string',
- format: 'misskey:id',
- },
- name: { type: 'string' },
- on: {
- type: 'array',
- items: {
- type: 'string',
- enum: webhookEventTypes,
- },
- },
- url: { type: 'string' },
- secret: { type: 'string' },
- active: { type: 'boolean' },
- latestSentAt: { type: 'string', format: 'date-time', nullable: true },
- latestStatus: { type: 'integer', nullable: true },
- },
+ ref: 'UserWebhook',
},
} as const;