🚧 Client Setup and api docs

Signed-off-by: Pau Costa <mico@micodev.es>
pull/2/head
Pau Costa Ferrer 2024-02-07 11:09:25 +01:00
parent e5a65086be
commit ec01ee98b2
10 changed files with 8668 additions and 45 deletions

840
DevSpaceOApi.json Normal file
View File

@ -0,0 +1,840 @@
{
"openapi": "3.0.0",
"info": {
"title": "DevSpace API",
"description": "API for DevSpace",
"version": "0.1.0"
},
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
},
"schemas": {
"Post": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Post ID"
},
"title": {
"type": "string",
"description": "Post title"
},
"content": {
"type": "string",
"description": "Post content"
},
"createdAt": {
"type": "string",
"description": "Post creation date"
},
"createdBy": {
"$ref": "#/components/schemas/User"
},
"likedBy": {
"type": "array",
"items": {
"$ref": "#/components/schemas/User"
}
},
"comments": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Comment"
}
}
}
},
"Comment": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Comment ID"
},
"content": {
"type": "string",
"description": "Comment content"
},
"createdAt": {
"type": "string",
"description": "Comment creation date"
},
"createdBy": {
"$ref": "#/components/schemas/User"
},
"likedBy": {
"type": "array",
"items": {
"$ref": "#/components/schemas/User"
}
}
}
},
"User": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "User ID"
},
"firstName": {
"type": "string",
"description": "User first name"
},
"lastName": {
"type": "string",
"description": "User last name"
}
}
},
"UserWithRelations": {
"allOf": [
{
"$ref": "#/components/schemas/User"
},
{
"type": "object",
"properties": {
"posts": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Post"
}
},
"comments": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Comment"
}
},
"followed": {
"type": "array",
"items": {
"$ref": "#/components/schemas/User"
}
},
"followers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/User"
}
}
}
}
]
}
}
},
"paths": {
"/auth/signup": {
"post": {
"tags": [
"Authentication"
],
"summary": "Sign up a new user",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "The email of the user"
},
"password": {
"type": "string",
"description": "The password of the user"
},
"passwordValidation": {
"type": "string",
"description": "Password validation field"
},
"firstName": {
"type": "string",
"description": "The first name of the user"
},
"lastName": {
"type": "string",
"description": "The last name of the user"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully signed up the user",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
},
"400": {
"description": "Invalid input or user already exists"
}
}
}
},
"/auth/login": {
"post": {
"tags": [
"Authentication"
],
"summary": "Log in a user",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "The email of the user"
},
"password": {
"type": "string",
"description": "The password of the user"
},
"longExpiration": {
"type": "boolean",
"description": "Whether to keep the user logged in for a long time"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successfully logged in the user",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success"
},
"token": {
"type": "string",
"description": "The JWT token for the user"
}
}
}
}
}
},
"400": {
"description": "Missing email or password"
},
"401": {
"description": "Incorrect email or password"
}
}
}
},
"/auth/logout": {
"get": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Authentication"
],
"summary": "Log out the user",
"responses": {
"200": {
"description": "Successfully logged out the user",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success"
}
}
}
}
}
}
}
}
},
"/posts": {
"get": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Posts"
],
"operationId": "getAllPosts",
"summary": "Get all posts",
"responses": {
"200": {
"description": "A list of all posts",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Post"
}
}
}
}
}
}
},
"post": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Posts"
],
"operationId": "createPost",
"summary": "Create a post",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Post title"
},
"content": {
"type": "string",
"description": "Post content"
}
}
}
}
}
},
"responses": {
"201": {
"description": "A post",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Post"
}
}
}
},
"400": {
"description": "Title and content are required"
}
}
}
},
"/posts/{id}": {
"get": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Posts"
],
"operationId": "getPost",
"summary": "Get a post by ID",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "ID of the post",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "A post",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Post"
}
}
}
},
"400": {
"description": "Invalid ID"
},
"404": {
"description": "No post found with that ID"
}
}
},
"patch": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Posts"
],
"operationId": "updatePost",
"summary": "Update a post by ID",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "ID of the post",
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Post title"
},
"content": {
"type": "string",
"description": "Post content"
}
}
}
}
}
},
"responses": {
"200": {
"description": "A post",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Post"
}
}
}
},
"400": {
"description": "Invalid ID or Title and content are required"
},
"404": {
"description": "No post found with that ID"
}
}
},
"delete": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Posts"
],
"operationId": "deletePost",
"summary": "Delete a post by ID",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "ID of the post",
"schema": {
"type": "integer"
}
}
],
"responses": {
"204": {
"description": "No content"
},
"400": {
"description": "Invalid ID"
},
"404": {
"description": "No post found with that ID"
}
}
}
},
"/posts/followed": {
"get": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Posts"
],
"operationId": "getFollowedPosts",
"summary": "Get posts of followed users",
"responses": {
"200": {
"description": "A list of posts",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Post"
}
}
}
}
}
}
}
},
"/posts/{id}/like": {
"post": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Posts"
],
"operationId": "likePost",
"summary": "Like a post by ID",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "ID of the post",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "A post",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Post"
}
}
}
},
"400": {
"description": "Invalid ID or You have already liked this post"
},
"404": {
"description": "No post found with that ID"
}
}
},
"delete": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Posts"
],
"operationId": "unlikePost",
"summary": "Unlike a post by ID",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "ID of the post",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "A post",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Post"
}
}
}
},
"400": {
"description": "Invalid ID or You have not liked this post"
},
"404": {
"description": "No post found with that ID"
}
}
}
},
"/posts/{id}/comment": {
"post": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Posts"
],
"operationId": "commentPost",
"summary": "Comment on a post by ID",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "ID of the post",
"schema": {
"type": "integer"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "Comment content"
}
}
}
}
}
},
"responses": {
"201": {
"description": "A comment",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Comment"
}
}
}
},
"400": {
"description": "Invalid Request"
},
"404": {
"description": "No post found with that ID"
}
}
}
},
"/users": {
"get": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Users"
],
"summary": "Get all users",
"responses": {
"200": {
"description": "A list of all users",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/User"
}
}
}
}
}
}
}
},
"/users/{id}": {
"get": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Users"
],
"summary": "Get a single user",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "ID of the user",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "A single user",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserWithRelations"
}
}
}
}
}
}
},
"/users/me": {
"get": {
"tags": [
"Users"
],
"summary": "Get the currently logged in user",
"security": [
{
"bearerAuth": []
}
],
"responses": {
"200": {
"description": "The currently logged in user",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserWithRelations"
}
}
}
}
}
}
},
"/users/{id}/follow": {
"post": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Users"
],
"summary": "Follow a user",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer",
"description": "The ID of the user to follow"
}
}
],
"responses": {
"200": {
"description": "Successfully followed the user",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserWithRelations"
}
}
}
},
"400": {
"description": "Invalid ID"
},
"404": {
"description": "No user found with that ID"
}
}
},
"delete": {
"security": [
{
"bearerAuth": []
}
],
"tags": [
"Users"
],
"summary": "Unfollow a user",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer",
"description": "The ID of the user to unfollow"
}
}
],
"responses": {
"200": {
"description": "Successfully unfollowed the user",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserWithRelations"
}
}
}
},
"400": {
"description": "Invalid ID"
},
"404": {
"description": "No user found with that ID"
}
}
}
}
},
"tags": []
}

11
client/.api/api.json Normal file
View File

@ -0,0 +1,11 @@
{
"version": "1.0",
"apis": [
{
"identifier": "devspace",
"source": "../DevSpaceOApi.json",
"integrity": "sha512-ZenepSHe2uzlizeb4kIdt/ifcmSRCqqyUp8UDuK4aveYeckooMss3ijWyGeem77CRSAspaOPx8uvlxGWJ805jw==",
"installerVersion": "6.1.1"
}
]
}

File diff suppressed because it is too large Load Diff

2480
client/.api/apis/devspace/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
{
"name": "@api/devspace",
"version": "0.1.0",
"main": "./index.ts",
"types": "./index.d.ts",
"resolveJsonModule": true,
"dependencies": {
"api": "^6.1.1",
"json-schema-to-ts": "^2.8.0-beta.0",
"oas": "^20.10.3"
}
}

View File

@ -0,0 +1,35 @@
const CommentPost = {"body":{"type":"object","properties":{"content":{"type":"string","description":"Comment content"}},"$schema":"http://json-schema.org/draft-04/schema#"},"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","$schema":"http://json-schema.org/draft-04/schema#","description":"ID of the post"}},"required":["id"]}]},"response":{"201":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const CreatePost = {"body":{"type":"object","properties":{"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"}},"$schema":"http://json-schema.org/draft-04/schema#"},"response":{"201":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const DeletePost = {"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","$schema":"http://json-schema.org/draft-04/schema#","description":"ID of the post"}},"required":["id"]}]}} as const
;
const DeleteUsersIdFollow = {"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","description":"The ID of the user to unfollow","$schema":"http://json-schema.org/draft-04/schema#"}},"required":["id"]}]},"response":{"200":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"},"posts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}},"followed":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"followers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const GetAllPosts = {"response":{"200":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const GetAuthLogout = {"response":{"200":{"type":"object","properties":{"status":{"type":"string","examples":["success"]}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const GetFollowedPosts = {"response":{"200":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const GetPost = {"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","$schema":"http://json-schema.org/draft-04/schema#","description":"ID of the post"}},"required":["id"]}]},"response":{"200":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const GetUsers = {"response":{"200":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const GetUsersId = {"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","$schema":"http://json-schema.org/draft-04/schema#","description":"ID of the user"}},"required":["id"]}]},"response":{"200":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"},"posts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}},"followed":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"followers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const GetUsersMe = {"response":{"200":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"},"posts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}},"followed":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"followers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const LikePost = {"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","$schema":"http://json-schema.org/draft-04/schema#","description":"ID of the post"}},"required":["id"]}]},"response":{"200":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const PostAuthLogin = {"body":{"type":"object","properties":{"email":{"type":"string","description":"The email of the user"},"password":{"type":"string","description":"The password of the user"},"longExpiration":{"type":"boolean","description":"Whether to keep the user logged in for a long time"}},"$schema":"http://json-schema.org/draft-04/schema#"},"response":{"200":{"type":"object","properties":{"status":{"type":"string","examples":["success"]},"token":{"type":"string","description":"The JWT token for the user"}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const PostAuthSignup = {"body":{"type":"object","properties":{"email":{"type":"string","description":"The email of the user"},"password":{"type":"string","description":"The password of the user"},"passwordValidation":{"type":"string","description":"Password validation field"},"firstName":{"type":"string","description":"The first name of the user"},"lastName":{"type":"string","description":"The last name of the user"}},"$schema":"http://json-schema.org/draft-04/schema#"},"response":{"200":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const PostUsersIdFollow = {"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","description":"The ID of the user to follow","$schema":"http://json-schema.org/draft-04/schema#"}},"required":["id"]}]},"response":{"200":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"},"posts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}},"followed":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"followers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const UnlikePost = {"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","$schema":"http://json-schema.org/draft-04/schema#","description":"ID of the post"}},"required":["id"]}]},"response":{"200":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
const UpdatePost = {"body":{"type":"object","properties":{"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"}},"$schema":"http://json-schema.org/draft-04/schema#"},"metadata":{"allOf":[{"type":"object","properties":{"id":{"type":"integer","$schema":"http://json-schema.org/draft-04/schema#","description":"ID of the post"}},"required":["id"]}]},"response":{"200":{"type":"object","properties":{"id":{"type":"integer","description":"Post ID"},"title":{"type":"string","description":"Post title"},"content":{"type":"string","description":"Post content"},"createdAt":{"type":"string","description":"Post creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Comment ID"},"content":{"type":"string","description":"Comment content"},"createdAt":{"type":"string","description":"Comment creation date"},"createdBy":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}},"likedBy":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"User ID"},"firstName":{"type":"string","description":"User first name"},"lastName":{"type":"string","description":"User last name"}}}}}}}},"$schema":"http://json-schema.org/draft-04/schema#"}}} as const
;
export { CommentPost, CreatePost, DeletePost, DeleteUsersIdFollow, GetAllPosts, GetAuthLogout, GetFollowedPosts, GetPost, GetUsers, GetUsersId, GetUsersMe, LikePost, PostAuthLogin, PostAuthSignup, PostUsersIdFollow, UnlikePost, UpdatePost }

View File

@ -0,0 +1,33 @@
import type { FromSchema } from 'json-schema-to-ts';
import * as schemas from './schemas';
export type CommentPostBodyParam = FromSchema<typeof schemas.CommentPost.body>;
export type CommentPostMetadataParam = FromSchema<typeof schemas.CommentPost.metadata>;
export type CommentPostResponse201 = FromSchema<typeof schemas.CommentPost.response['201']>;
export type CreatePostBodyParam = FromSchema<typeof schemas.CreatePost.body>;
export type CreatePostResponse201 = FromSchema<typeof schemas.CreatePost.response['201']>;
export type DeletePostMetadataParam = FromSchema<typeof schemas.DeletePost.metadata>;
export type DeleteUsersIdFollowMetadataParam = FromSchema<typeof schemas.DeleteUsersIdFollow.metadata>;
export type DeleteUsersIdFollowResponse200 = FromSchema<typeof schemas.DeleteUsersIdFollow.response['200']>;
export type GetAllPostsResponse200 = FromSchema<typeof schemas.GetAllPosts.response['200']>;
export type GetAuthLogoutResponse200 = FromSchema<typeof schemas.GetAuthLogout.response['200']>;
export type GetFollowedPostsResponse200 = FromSchema<typeof schemas.GetFollowedPosts.response['200']>;
export type GetPostMetadataParam = FromSchema<typeof schemas.GetPost.metadata>;
export type GetPostResponse200 = FromSchema<typeof schemas.GetPost.response['200']>;
export type GetUsersIdMetadataParam = FromSchema<typeof schemas.GetUsersId.metadata>;
export type GetUsersIdResponse200 = FromSchema<typeof schemas.GetUsersId.response['200']>;
export type GetUsersMeResponse200 = FromSchema<typeof schemas.GetUsersMe.response['200']>;
export type GetUsersResponse200 = FromSchema<typeof schemas.GetUsers.response['200']>;
export type LikePostMetadataParam = FromSchema<typeof schemas.LikePost.metadata>;
export type LikePostResponse200 = FromSchema<typeof schemas.LikePost.response['200']>;
export type PostAuthLoginBodyParam = FromSchema<typeof schemas.PostAuthLogin.body>;
export type PostAuthLoginResponse200 = FromSchema<typeof schemas.PostAuthLogin.response['200']>;
export type PostAuthSignupBodyParam = FromSchema<typeof schemas.PostAuthSignup.body>;
export type PostAuthSignupResponse200 = FromSchema<typeof schemas.PostAuthSignup.response['200']>;
export type PostUsersIdFollowMetadataParam = FromSchema<typeof schemas.PostUsersIdFollow.metadata>;
export type PostUsersIdFollowResponse200 = FromSchema<typeof schemas.PostUsersIdFollow.response['200']>;
export type UnlikePostMetadataParam = FromSchema<typeof schemas.UnlikePost.metadata>;
export type UnlikePostResponse200 = FromSchema<typeof schemas.UnlikePost.response['200']>;
export type UpdatePostBodyParam = FromSchema<typeof schemas.UpdatePost.body>;
export type UpdatePostMetadataParam = FromSchema<typeof schemas.UpdatePost.metadata>;
export type UpdatePostResponse200 = FromSchema<typeof schemas.UpdatePost.response['200']>;

2236
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,12 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@api/devspace": "file:.api/apis/devspace",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@fontsource/roboto": "^5.0.8",
"@mui/icons-material": "^5.15.7",
"@mui/material": "^5.15.7",
"@testing-library/jest-dom": "^5.17.0", "@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0", "@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^13.5.0",
@ -10,9 +16,12 @@
"@types/node": "^16.18.77", "@types/node": "^16.18.77",
"@types/react": "^18.2.48", "@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18", "@types/react-dom": "^18.2.18",
"match-sorter": "^6.3.3",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.22.0",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"sort-by": "^1.2.0",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },

View File

@ -83,7 +83,6 @@ const swaggerOptions = {
}, },
}, },
}, },
},
User: { User: {
type: "object", type: "object",
properties: { properties: {
@ -139,6 +138,7 @@ const swaggerOptions = {
}, },
}, },
}, },
},
apis: ["**/controller/*.ts"], apis: ["**/controller/*.ts"],
}; };