fix invite
This commit is contained in:
1 parent
3c71583324
commit
b88c46a6a1
9 files changed
+507
-184
No files matched your search
@@ -0,0 +1,407 @@
|
||||
{
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "Checkmate API",
|
||||
"version": "1.0.0",
|
||||
"description": "OpenAPI specification for the Checkmate server endpoints (v1)."
|
||||
},
|
||||
"servers": [
|
||||
{ "url": "http://localhost:52345/api/v1", "description": "Local dev" }
|
||||
],
|
||||
"security": [ { "cookieAuth": [] } ],
|
||||
"components": {
|
||||
"securitySchemes": {
|
||||
"cookieAuth": {
|
||||
"type": "apiKey",
|
||||
"in": "cookie",
|
||||
"name": "token",
|
||||
"description": "HTTP-only auth cookie named 'token'. Send automatically by browser on same-origin requests."
|
||||
}
|
||||
},
|
||||
"schemas": {
|
||||
"Login": {
|
||||
"type": "object",
|
||||
"required": ["email", "password"],
|
||||
"properties": {
|
||||
"email": { "type": "string", "format": "email" },
|
||||
"password": { "type": "string", "minLength": 6 }
|
||||
}
|
||||
},
|
||||
"Register": {
|
||||
"type": "object",
|
||||
"required": ["email", "firstName", "lastName", "password"],
|
||||
"properties": {
|
||||
"email": { "type": "string", "format": "email" },
|
||||
"firstName": { "type": "string" },
|
||||
"lastName": { "type": "string" },
|
||||
"password": { "type": "string", "minLength": 6 }
|
||||
}
|
||||
},
|
||||
"RegisterWithInvite": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"firstName": { "type": "string" },
|
||||
"lastName": { "type": "string" },
|
||||
"password": { "type": "string", "minLength": 6 },
|
||||
"confirmPassword": { "type": "string", "minLength": 6 }
|
||||
}
|
||||
},
|
||||
"MonitorCreate": {
|
||||
"type": "object",
|
||||
"required": ["type", "url", "name", "n", "interval"],
|
||||
"properties": {
|
||||
"type": { "type": "string", "example": "http" },
|
||||
"url": { "type": "string", "format": "uri" },
|
||||
"name": { "type": "string" },
|
||||
"port": { "type": "integer", "minimum": 1, "maximum": 65535 },
|
||||
"n": { "type": "integer", "minimum": 1, "maximum": 25 },
|
||||
"notificationChannels": { "type": "array", "items": { "type": "string" } },
|
||||
"secret": { "type": "string" },
|
||||
"interval": { "type": "integer", "minimum": 1 }
|
||||
}
|
||||
},
|
||||
"MonitorPatch": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"MonitorImport": {
|
||||
"type": "object",
|
||||
"required": ["monitors"],
|
||||
"properties": {
|
||||
"monitors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["name", "url", "type", "interval", "n"],
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"url": { "type": "string" },
|
||||
"port": { "type": "integer", "minimum": 1, "maximum": 65535 },
|
||||
"secret": { "type": "string" },
|
||||
"type": { "type": "string", "example": "http" },
|
||||
"interval": { "type": "integer", "minimum": 1 },
|
||||
"n": { "type": "integer", "minimum": 1 }
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"minItems": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"NotificationChannel": {
|
||||
"type": "object",
|
||||
"required": ["name", "type", "config"],
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"type": { "type": "string", "enum": ["email", "slack", "discord", "webhook"] },
|
||||
"config": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"url": { "type": "string" },
|
||||
"emailAddress": { "type": "string", "format": "email" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"StatusPage": {
|
||||
"type": "object",
|
||||
"required": ["name", "url", "isPublished"],
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"url": { "type": "string" },
|
||||
"description": { "type": "string" },
|
||||
"isPublished": { "type": "boolean" },
|
||||
"monitors": { "type": "array", "items": { "type": "string" } }
|
||||
}
|
||||
},
|
||||
"ProfilePatch": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"firstName": { "type": "string" },
|
||||
"lastName": { "type": "string" },
|
||||
"password": { "type": "string", "minLength": 6 },
|
||||
"confirmPassword": { "type": "string", "minLength": 6 }
|
||||
}
|
||||
},
|
||||
"SystemSettings": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"systemEmailHost": { "type": "string" },
|
||||
"systemEmailPort": { "type": "integer" },
|
||||
"systemEmailAddress": { "type": "string", "format": "email" },
|
||||
"systemEmailPassword": { "type": "string" },
|
||||
"systemEmailUser": { "type": "string" },
|
||||
"systemEmailConnectionHost": { "type": "string" },
|
||||
"systemEmailTLSServername": { "type": "string" },
|
||||
"systemEmailSecure": { "type": "boolean" },
|
||||
"systemEmailPool": { "type": "boolean" },
|
||||
"systemEmailIgnoreTLS": { "type": "boolean" },
|
||||
"systemEmailRequireTLS": { "type": "boolean" },
|
||||
"systemEmailRejectUnauthorized": { "type": "boolean" }
|
||||
}
|
||||
},
|
||||
"RecoveryRequest": {
|
||||
"type": "object",
|
||||
"required": ["email"],
|
||||
"properties": { "email": { "type": "string", "format": "email" } }
|
||||
},
|
||||
"ResetPassword": {
|
||||
"type": "object",
|
||||
"required": ["token", "password"],
|
||||
"properties": {
|
||||
"token": { "type": "string" },
|
||||
"password": { "type": "string", "minLength": 6 }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"paths": {
|
||||
"/auth/register": {
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Register" } } } },
|
||||
"responses": { "200": { "description": "Registered" } },
|
||||
"security": []
|
||||
}
|
||||
},
|
||||
"/auth/register/invite/{token}": {
|
||||
"post": {
|
||||
"parameters": [ { "name": "token", "in": "path", "required": true, "schema": { "type": "string" } } ],
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RegisterWithInvite" } } } },
|
||||
"responses": { "200": { "description": "Registered via invite" } },
|
||||
"security": []
|
||||
}
|
||||
},
|
||||
"/auth/login": {
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Login" } } } },
|
||||
"responses": { "200": { "description": "Logged in" } },
|
||||
"security": []
|
||||
}
|
||||
},
|
||||
"/auth/logout": { "post": { "responses": { "200": { "description": "Logged out" } } } },
|
||||
"/auth/me": { "get": { "responses": { "200": { "description": "Current user" } } } },
|
||||
"/auth/cleanup": { "post": { "responses": { "200": { "description": "Cleanup executed" } } } },
|
||||
"/auth/cleanup-monitors": { "post": { "responses": { "200": { "description": "Monitor cleanup executed" } } } },
|
||||
|
||||
"/monitors": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{ "name": "page", "in": "query", "schema": { "type": "integer", "minimum": 0 } },
|
||||
{ "name": "rowsPerPage", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100 } },
|
||||
{ "name": "sortField", "in": "query", "schema": { "type": "string" } },
|
||||
{ "name": "sortOrder", "in": "query", "schema": { "type": "string", "enum": ["asc", "desc"] } },
|
||||
{ "name": "type", "in": "query", "schema": { "type": "array", "items": { "type": "string" } }, "style": "form", "explode": true },
|
||||
{ "name": "status", "in": "query", "schema": { "type": "array", "items": { "type": "string" } }, "style": "form", "explode": true }
|
||||
],
|
||||
"responses": { "200": { "description": "List monitors" } }
|
||||
},
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MonitorCreate" } } } },
|
||||
"responses": { "200": { "description": "Created monitor" } }
|
||||
}
|
||||
},
|
||||
"/monitors/export": { "get": { "responses": { "200": { "description": "Export monitors (JSON)" } } } },
|
||||
"/monitors/import": {
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MonitorImport" } } } },
|
||||
"responses": { "200": { "description": "Import summary" } }
|
||||
}
|
||||
},
|
||||
"/monitors/{id}": {
|
||||
"get": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Monitor" } } },
|
||||
"patch": {
|
||||
"parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ],
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MonitorPatch" } } } },
|
||||
"responses": { "200": { "description": "Updated" } }
|
||||
},
|
||||
"delete": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Deleted" } } }
|
||||
},
|
||||
"/monitors/{id}/checks": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" } },
|
||||
{ "name": "page", "in": "query", "required": true, "schema": { "type": "integer", "minimum": 0 } },
|
||||
{ "name": "rowsPerPage", "in": "query", "required": true, "schema": { "type": "integer", "minimum": 1, "maximum": 100 } }
|
||||
],
|
||||
"responses": { "200": { "description": "Monitor checks" } }
|
||||
}
|
||||
},
|
||||
"/monitors/{id}/notifications/test": {
|
||||
"post": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Test sent" } } }
|
||||
},
|
||||
"/monitors/{id}/active": {
|
||||
"patch": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Toggled" } } }
|
||||
},
|
||||
|
||||
"/notification-channels": {
|
||||
"get": { "responses": { "200": { "description": "List channels" } } },
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationChannel" } } } },
|
||||
"responses": { "200": { "description": "Created" } }
|
||||
}
|
||||
},
|
||||
"/notification-channels/{id}": {
|
||||
"get": { "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Channel" } } },
|
||||
"patch": {
|
||||
"parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ],
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationChannel" } } } },
|
||||
"responses": { "200": { "description": "Updated" } }
|
||||
},
|
||||
"delete": { "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Deleted" } } }
|
||||
},
|
||||
"/notification-channels/{id}/active": {
|
||||
"patch": { "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Toggled" } } }
|
||||
},
|
||||
"/notification-channels/test": {
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NotificationChannel" } } } },
|
||||
"responses": { "200": { "description": "Test queued" } }
|
||||
}
|
||||
},
|
||||
|
||||
"/status-pages": {
|
||||
"get": { "responses": { "200": { "description": "List" } } },
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StatusPage" } } } },
|
||||
"responses": { "200": { "description": "Created" } }
|
||||
}
|
||||
},
|
||||
"/status-pages/{id}": {
|
||||
"get": { "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Status page" } } },
|
||||
"patch": {
|
||||
"parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ],
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StatusPage" } } } },
|
||||
"responses": { "200": { "description": "Updated" } }
|
||||
},
|
||||
"delete": { "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Deleted" } } }
|
||||
},
|
||||
"/status-pages/public/{url}": {
|
||||
"get": {
|
||||
"parameters": [ { "in": "path", "name": "url", "required": true, "schema": { "type": "string" } } ],
|
||||
"responses": { "200": { "description": "Public status page" } },
|
||||
"security": []
|
||||
}
|
||||
},
|
||||
|
||||
"/checks": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{ "name": "status", "in": "query", "required": true, "schema": { "type": "string" } },
|
||||
{ "name": "monitorId", "in": "query", "schema": { "type": "string" } },
|
||||
{ "name": "page", "in": "query", "required": true, "schema": { "type": "integer", "minimum": 0 } },
|
||||
{ "name": "rowsPerPage", "in": "query", "required": true, "schema": { "type": "integer", "minimum": 1, "maximum": 100 } },
|
||||
{ "name": "range", "in": "query", "required": true, "schema": { "type": "string" } }
|
||||
],
|
||||
"responses": { "200": { "description": "Checks list" } }
|
||||
}
|
||||
},
|
||||
|
||||
"/incidents": {
|
||||
"get": {
|
||||
"parameters": [
|
||||
{ "name": "resolutionType", "in": "query", "schema": { "type": "string" } },
|
||||
{ "name": "resolved", "in": "query", "schema": { "type": "boolean" } },
|
||||
{ "name": "page", "in": "query", "schema": { "type": "integer", "minimum": 0 } },
|
||||
{ "name": "rowsPerPage", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 100 } }
|
||||
],
|
||||
"responses": { "200": { "description": "Incidents list" } }
|
||||
}
|
||||
},
|
||||
"/incidents/{id}/resolve": {
|
||||
"patch": {
|
||||
"parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ],
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } },
|
||||
"responses": { "200": { "description": "Resolved" } }
|
||||
}
|
||||
},
|
||||
|
||||
"/invite": {
|
||||
"get": { "responses": { "200": { "description": "Invites list" } } },
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["email", "teamId", "teamRoleId"], "properties": { "email": { "type": "string", "format": "email" }, "teamId": { "type": "string" }, "teamRoleId": { "type": "string" }, "orgRoleId": { "type": "string" } } } } } },
|
||||
"responses": { "200": { "description": "Invite created" } }
|
||||
}
|
||||
},
|
||||
"/invite/{id}": {
|
||||
"get": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Invite" } } },
|
||||
"delete": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Deleted" } } }
|
||||
},
|
||||
|
||||
"/maintenance": {
|
||||
"get": { "responses": { "200": { "description": "List windows" } } },
|
||||
"post": { "responses": { "200": { "description": "Created" } } }
|
||||
},
|
||||
"/maintenance/{id}": {
|
||||
"get": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Window" } } },
|
||||
"patch": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Updated" } } },
|
||||
"delete": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Deleted" } } }
|
||||
},
|
||||
"/maintenance/{id}/active": { "patch": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Toggled" } } } },
|
||||
|
||||
"/profile": {
|
||||
"get": { "responses": { "200": { "description": "Profile" } } },
|
||||
"patch": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProfilePatch" } } } },
|
||||
"responses": { "200": { "description": "Updated" } }
|
||||
}
|
||||
},
|
||||
|
||||
"/queue/jobs": { "get": { "responses": { "200": { "description": "Jobs" } } } },
|
||||
"/queue/metrics": { "get": { "responses": { "200": { "description": "Metrics" } } } },
|
||||
"/queue/flush": { "post": { "responses": { "200": { "description": "Flushed" } } } },
|
||||
|
||||
"/recovery": {
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RecoveryRequest" } } } },
|
||||
"responses": { "200": { "description": "Recovery email sent" } },
|
||||
"security": []
|
||||
}
|
||||
},
|
||||
"/recovery/reset": {
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResetPassword" } } } },
|
||||
"responses": { "200": { "description": "Password reset" } },
|
||||
"security": []
|
||||
}
|
||||
},
|
||||
|
||||
"/roles": { "get": { "responses": { "200": { "description": "Roles" } } } },
|
||||
"/roles/team/{id}": { "get": { "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Team roles" } } } },
|
||||
"/roles/{id}": { "get": { "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Role" } } } },
|
||||
|
||||
"/settings": { "get": { "responses": { "200": { "description": "System settings" } } } },
|
||||
"/settings/email": {
|
||||
"patch": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SystemSettings" } } } },
|
||||
"responses": { "200": { "description": "Updated" } }
|
||||
}
|
||||
},
|
||||
"/settings/test-transport": {
|
||||
"post": {
|
||||
"requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SystemSettings" } } } },
|
||||
"responses": { "200": { "description": "Transport test result" } }
|
||||
}
|
||||
},
|
||||
|
||||
"/teams": {
|
||||
"get": { "responses": { "200": { "description": "Org teams" } } },
|
||||
"post": { "responses": { "200": { "description": "Created" } } }
|
||||
},
|
||||
"/teams/joined": { "get": { "responses": { "200": { "description": "Joined teams" } } } },
|
||||
"/teams/{id}": {
|
||||
"get": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Team" } } },
|
||||
"patch": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Updated" } } },
|
||||
"delete": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Deleted" } } }
|
||||
},
|
||||
|
||||
"/team-members": {
|
||||
"get": { "responses": { "200": { "description": "Team members" } } },
|
||||
"post": { "responses": { "200": { "description": "Created" } } }
|
||||
},
|
||||
"/team-members/{id}": {
|
||||
"get": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Member" } } },
|
||||
"patch": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Updated" } } },
|
||||
"delete": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Deleted" } } }
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+36
-3
@@ -21,6 +21,7 @@
|
||||
"nodemailer": "7.0.9",
|
||||
"ping": "1.0.0",
|
||||
"super-simple-scheduler": "1.4.6",
|
||||
"swagger-ui-express": "5.0.1",
|
||||
"winston": "3.18.3",
|
||||
"zod": "4.1.12"
|
||||
},
|
||||
@@ -3047,6 +3048,13 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/@scarf/scarf": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.4.0.tgz",
|
||||
"integrity": "sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ==",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@sec-ant/readable-stream": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz",
|
||||
@@ -5359,6 +5367,7 @@
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
|
||||
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.0",
|
||||
@@ -8540,9 +8549,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "3.14.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
|
||||
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
|
||||
"version": "3.14.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
|
||||
"integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -10299,6 +10308,30 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-ui-dist": {
|
||||
"version": "5.30.2",
|
||||
"resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.30.2.tgz",
|
||||
"integrity": "sha512-HWCg1DTNE/Nmapt+0m2EPXFwNKNeKK4PwMjkwveN/zn1cV2Kxi9SURd+m0SpdcSgWEK/O64sf8bzXdtUhigtHA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scarf/scarf": "=1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/swagger-ui-express": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/swagger-ui-express/-/swagger-ui-express-5.0.1.tgz",
|
||||
"integrity": "sha512-SrNU3RiBGTLLmFU8GIJdOdanJTl4TOmT27tt3bWWHppqYmAZ6IDuEuBvMU6nZq0zLEe6b/1rACXCgLZqO6ZfrA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"swagger-ui-dist": ">=5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= v0.10.32"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"express": ">=4.0.0 || >=5.0.0-beta"
|
||||
}
|
||||
},
|
||||
"node_modules/test-exclude": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"typescript": "5.9.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"swagger-ui-express": "5.0.1",
|
||||
"bcryptjs": "3.0.2",
|
||||
"cacheable-lookup": "7.0.0",
|
||||
"cookie-parser": "1.4.7",
|
||||
|
||||
@@ -9,6 +9,9 @@ import { config } from "@/config/index.js";
|
||||
import { getChildLogger } from "@/logger/Logger.js";
|
||||
import ApiError from "./utils/ApiError.js";
|
||||
const indexLogger = getChildLogger("index");
|
||||
import swaggerUi from "swagger-ui-express";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const createApp = async () => {
|
||||
await connectDatabase();
|
||||
@@ -26,6 +29,16 @@ const createApp = async () => {
|
||||
})
|
||||
);
|
||||
const routes = initRoutes(controllers, app);
|
||||
// Swagger UI at /api-docs
|
||||
try {
|
||||
// Load OpenAPI doc from project root within server folder
|
||||
const openapiPath = path.resolve(process.cwd(), "openapi.json");
|
||||
const openapiJson = JSON.parse(fs.readFileSync(openapiPath, "utf-8"));
|
||||
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(openapiJson));
|
||||
indexLogger.info("Swagger UI available at /api-docs");
|
||||
} catch (e) {
|
||||
indexLogger.error("Failed to load OpenAPI document for Swagger UI", e);
|
||||
}
|
||||
app.use("/api/v1/health", verifyToken, addUserContext, (req, res) => {
|
||||
res.json({
|
||||
status: "OK",
|
||||
|
||||
@@ -33,7 +33,7 @@ class InviteRoutes {
|
||||
this.controller.getAll
|
||||
);
|
||||
|
||||
this.router.get("/:id", verifyToken, this.controller.get);
|
||||
this.router.get("/:id", this.controller.get);
|
||||
|
||||
this.router.delete(
|
||||
"/:id",
|
||||
|
||||
Reference in new issue
Block a user