123 lines
2.7 KiB
TypeScript
123 lines
2.7 KiB
TypeScript
import type { OpenAPIV3_1 } from "openapi-types";
|
|
|
|
export const prodLoginSpec: OpenAPIV3_1.PathsObject = {
|
|
"/api/authentication/login": {
|
|
post: {
|
|
summary: "Login",
|
|
description:
|
|
"Allows login by username and password and returns the user object to get the session data.",
|
|
tags: ["Auth"],
|
|
requestBody: {
|
|
required: true,
|
|
content: {
|
|
"application/json": {
|
|
schema: {
|
|
type: "object",
|
|
required: ["username", "password"],
|
|
properties: {
|
|
username: {
|
|
type: "string",
|
|
example: "jdoe",
|
|
},
|
|
password: {
|
|
type: "string",
|
|
format: "password",
|
|
example: "superSecretPassword",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
responses: {
|
|
"200": {
|
|
description: "User info",
|
|
content: {
|
|
"application/json": {
|
|
schema: {
|
|
type: "object",
|
|
properties: {
|
|
success: {
|
|
type: "boolean",
|
|
|
|
example: true,
|
|
},
|
|
message: {
|
|
type: "string",
|
|
example: "Welcome back jdoe123",
|
|
},
|
|
level: {
|
|
type: "string",
|
|
},
|
|
module: {
|
|
type: "string",
|
|
},
|
|
subModule: {
|
|
type: "string",
|
|
},
|
|
data: {
|
|
type: "array",
|
|
items: {
|
|
type: "object",
|
|
properties: {
|
|
redirect: { type: "boolean" },
|
|
token: { type: "string" },
|
|
user: {
|
|
type: "object",
|
|
properties: {
|
|
id: { type: "string" },
|
|
name: { type: "string" },
|
|
email: { type: "string", format: "email" },
|
|
username: { type: "string" },
|
|
role: { type: "string" },
|
|
createdAt: { type: "string", format: "date-time" },
|
|
updatedAt: { type: "string", format: "date-time" },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
"401": {
|
|
description: "Login failed",
|
|
content: {
|
|
"application/json": {
|
|
schema: {
|
|
type: "object",
|
|
properties: {
|
|
success: {
|
|
type: "boolean",
|
|
|
|
example: false,
|
|
},
|
|
message: {
|
|
type: "string",
|
|
example:
|
|
"jdoe1234 dose not appear to be a valid username please try again",
|
|
},
|
|
level: {
|
|
type: "string",
|
|
example: "error",
|
|
},
|
|
module: {
|
|
type: "string",
|
|
example: "routes",
|
|
},
|
|
subModule: {
|
|
type: "string",
|
|
example: "auth",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|