Compare commits
3 Commits
e5a65086be
...
c71bac5bd2
| Author | SHA1 | Date |
|---|---|---|
|
|
c71bac5bd2 | |
|
|
d2f42d397f | |
|
|
ec01ee98b2 |
|
|
@ -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": []
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -3,18 +3,32 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@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",
|
||||
"@reduxjs/toolkit": "^2.1.0",
|
||||
"axios": "^1.6.7",
|
||||
"match-sorter": "^6.3.3",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-redux": "^9.1.0",
|
||||
"react-router-dom": "^6.22.0",
|
||||
"react-scripts": "5.0.1",
|
||||
"sort-by": "^1.2.0",
|
||||
"typescript": "^4.9.5",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^5.17.0",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"@types/axios": "^0.14.0",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/node": "^16.18.77",
|
||||
"@types/react": "^18.2.48",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-scripts": "5.0.1",
|
||||
"typescript": "^4.9.5",
|
||||
"web-vitals": "^2.1.4"
|
||||
"@types/react-dom": "^18.2.18"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
||||
|
|
@ -0,0 +1 @@
|
|||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
.gitignore
|
||||
.npmignore
|
||||
.openapi-generator-ignore
|
||||
api.ts
|
||||
base.ts
|
||||
common.ts
|
||||
configuration.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
|
|
@ -0,0 +1 @@
|
|||
7.2.0
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,86 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* DevSpace API
|
||||
* API for DevSpace
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import type { Configuration } from './configuration';
|
||||
// Some imports not used depending on template conditions
|
||||
// @ts-ignore
|
||||
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
||||
import globalAxios from 'axios';
|
||||
|
||||
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const COLLECTION_FORMATS = {
|
||||
csv: ",",
|
||||
ssv: " ",
|
||||
tsv: "\t",
|
||||
pipes: "|",
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface RequestArgs
|
||||
*/
|
||||
export interface RequestArgs {
|
||||
url: string;
|
||||
options: RawAxiosRequestConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class BaseAPI
|
||||
*/
|
||||
export class BaseAPI {
|
||||
protected configuration: Configuration | undefined;
|
||||
|
||||
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = configuration.basePath ?? basePath;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class RequiredError
|
||||
* @extends {Error}
|
||||
*/
|
||||
export class RequiredError extends Error {
|
||||
constructor(public field: string, msg?: string) {
|
||||
super(msg);
|
||||
this.name = "RequiredError"
|
||||
}
|
||||
}
|
||||
|
||||
interface ServerMap {
|
||||
[key: string]: {
|
||||
url: string,
|
||||
description: string,
|
||||
}[];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const operationServerMap: ServerMap = {
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* DevSpace API
|
||||
* API for DevSpace
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import type { Configuration } from "./configuration";
|
||||
import type { RequestArgs } from "./base";
|
||||
import type { AxiosInstance, AxiosResponse } from 'axios';
|
||||
import { RequiredError } from "./base";
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const DUMMY_BASE_URL = 'https://example.com'
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws {RequiredError}
|
||||
* @export
|
||||
*/
|
||||
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
|
||||
if (paramValue === null || paramValue === undefined) {
|
||||
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
|
||||
if (configuration && configuration.apiKey) {
|
||||
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
||||
? await configuration.apiKey(keyParamName)
|
||||
: await configuration.apiKey;
|
||||
object[keyParamName] = localVarApiKeyValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
|
||||
if (configuration && (configuration.username || configuration.password)) {
|
||||
object["auth"] = { username: configuration.username, password: configuration.password };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const accessToken = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken()
|
||||
: await configuration.accessToken;
|
||||
object["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
|
||||
if (configuration && configuration.accessToken) {
|
||||
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
||||
? await configuration.accessToken(name, scopes)
|
||||
: await configuration.accessToken;
|
||||
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
|
||||
}
|
||||
}
|
||||
|
||||
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
|
||||
if (parameter == null) return;
|
||||
if (typeof parameter === "object") {
|
||||
if (Array.isArray(parameter)) {
|
||||
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
|
||||
}
|
||||
else {
|
||||
Object.keys(parameter).forEach(currentKey =>
|
||||
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (urlSearchParams.has(key)) {
|
||||
urlSearchParams.append(key, parameter);
|
||||
}
|
||||
else {
|
||||
urlSearchParams.set(key, parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const setSearchParams = function (url: URL, ...objects: any[]) {
|
||||
const searchParams = new URLSearchParams(url.search);
|
||||
setFlattenedQueryParams(searchParams, objects);
|
||||
url.search = searchParams.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
|
||||
const nonString = typeof value !== 'string';
|
||||
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
||||
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
||||
: nonString;
|
||||
return needsSerialization
|
||||
? JSON.stringify(value !== undefined ? value : {})
|
||||
: (value || "");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const toPathString = function (url: URL) {
|
||||
return url.pathname + url.search + url.hash
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* DevSpace API
|
||||
* API for DevSpace
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface ConfigurationParameters {
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
basePath?: string;
|
||||
serverIndex?: number;
|
||||
baseOptions?: any;
|
||||
formDataCtor?: new () => any;
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
/**
|
||||
* parameter for apiKey security
|
||||
* @param name security name
|
||||
* @memberof Configuration
|
||||
*/
|
||||
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
||||
/**
|
||||
* parameter for basic security
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* parameter for basic security
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* parameter for oauth2 security
|
||||
* @param name security name
|
||||
* @param scopes oauth2 scope
|
||||
* @memberof Configuration
|
||||
*/
|
||||
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
||||
/**
|
||||
* override base path
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
basePath?: string;
|
||||
/**
|
||||
* override server index
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
serverIndex?: number;
|
||||
/**
|
||||
* base options for axios calls
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof Configuration
|
||||
*/
|
||||
baseOptions?: any;
|
||||
/**
|
||||
* The FormData constructor that will be used to create multipart form data
|
||||
* requests. You can inject this here so that execution environments that
|
||||
* do not support the FormData class can still run the generated client.
|
||||
*
|
||||
* @type {new () => FormData}
|
||||
*/
|
||||
formDataCtor?: new () => any;
|
||||
|
||||
constructor(param: ConfigurationParameters = {}) {
|
||||
this.apiKey = param.apiKey;
|
||||
this.username = param.username;
|
||||
this.password = param.password;
|
||||
this.accessToken = param.accessToken;
|
||||
this.basePath = param.basePath;
|
||||
this.serverIndex = param.serverIndex;
|
||||
this.baseOptions = param.baseOptions;
|
||||
this.formDataCtor = param.formDataCtor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=$(git remote)
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* DevSpace API
|
||||
* API for DevSpace
|
||||
*
|
||||
* The version of the OpenAPI document: 0.1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export * from "./api";
|
||||
export * from "./configuration";
|
||||
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
import { createSlice } from "@reduxjs/toolkit";
|
||||
import { Status } from "../util/types";
|
||||
import {
|
||||
AuthLoginPostRequest,
|
||||
AuthSignupPostRequest,
|
||||
AuthenticationApi,
|
||||
Configuration,
|
||||
} from "../api";
|
||||
import { AppThunk } from "./store";
|
||||
import { Axios, AxiosError } from "axios";
|
||||
|
||||
interface loginState {
|
||||
loggedIn: boolean;
|
||||
status: Status;
|
||||
error: string | null;
|
||||
userInfo: {
|
||||
firstName: string;
|
||||
jwt: string;
|
||||
};
|
||||
}
|
||||
|
||||
const initialState: loginState = {
|
||||
loggedIn: false,
|
||||
status: Status.idle,
|
||||
error: null,
|
||||
userInfo: {
|
||||
firstName: "",
|
||||
jwt: "",
|
||||
},
|
||||
};
|
||||
|
||||
export const loginSlice = createSlice({
|
||||
name: "login",
|
||||
initialState,
|
||||
reducers: {
|
||||
login: (state, action) => {
|
||||
state.loggedIn = true;
|
||||
state.userInfo.jwt = action.payload;
|
||||
},
|
||||
logoff: (state) => {
|
||||
state.loggedIn = false;
|
||||
state.userInfo = initialState.userInfo;
|
||||
},
|
||||
setStatus: (state, action) => {
|
||||
state.status = action.payload;
|
||||
},
|
||||
setError: (state, action) => {
|
||||
state.error = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const api = new AuthenticationApi(
|
||||
new Configuration({
|
||||
basePath: process.env.REACT_APP_BACKEND_URL,
|
||||
})
|
||||
);
|
||||
|
||||
export const postLogin =
|
||||
(params: AuthLoginPostRequest): AppThunk =>
|
||||
async (dispatch) => {
|
||||
let response;
|
||||
try {
|
||||
dispatch(setStatus(Status.loading));
|
||||
response = await api.authLoginPost(params);
|
||||
|
||||
dispatch(login(response.data.token));
|
||||
await addJWT(response.data.token || "");
|
||||
|
||||
dispatch(setError(""));
|
||||
dispatch(setStatus(Status.succeeded));
|
||||
} catch (error) {
|
||||
dispatch(setStatus(Status.failed));
|
||||
const errorMessage = "Invalid email or password";
|
||||
dispatch(setError(errorMessage));
|
||||
}
|
||||
};
|
||||
|
||||
export const postSignup =
|
||||
(params: AuthSignupPostRequest): AppThunk =>
|
||||
async (dispatch) => {
|
||||
let response;
|
||||
console.log(params);
|
||||
try {
|
||||
dispatch(setStatus(Status.loading));
|
||||
response = await api.authSignupPost(params);
|
||||
|
||||
dispatch(postLogin({ email: params.email, password: params.password }));
|
||||
} catch (error) {
|
||||
dispatch(setStatus(Status.failed));
|
||||
const errorMessage = "Change this pls";
|
||||
dispatch(setError(errorMessage));
|
||||
}
|
||||
};
|
||||
|
||||
export const postLogout = (): AppThunk => async (dispatch) => {
|
||||
localStorage.removeItem("jwt");
|
||||
sessionStorage.removeItem("jwt");
|
||||
dispatch(logoff());
|
||||
await api.authLogoutGet();
|
||||
};
|
||||
|
||||
const addJWT = async (token: string) => {
|
||||
localStorage.setItem("jwt", token);
|
||||
};
|
||||
|
||||
export const { login, logoff, setStatus, setError } = loginSlice.actions;
|
||||
|
||||
export default loginSlice.reducer;
|
||||
|
||||
export const selectLoggedIn = (state: { login: loginState }) =>
|
||||
state.login.loggedIn;
|
||||
|
||||
export const selectUserInfo = (state: { login: loginState }) =>
|
||||
state.login.userInfo;
|
||||
|
||||
export const selectErrorMessage = (state: { login: loginState }) =>
|
||||
state.login.error;
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
import { Action, ThunkAction, configureStore } from "@reduxjs/toolkit";
|
||||
import { useDispatch } from "react-redux";
|
||||
import loginReducer from "./loginSlice";
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
login: loginReducer,
|
||||
},
|
||||
});
|
||||
|
||||
export type AppDispatch = typeof store.dispatch;
|
||||
export type RootState = ReturnType<typeof store.getState>;
|
||||
export type AppThunk<ReturnType = void> = ThunkAction<
|
||||
ReturnType,
|
||||
RootState,
|
||||
unknown,
|
||||
Action<string>
|
||||
>;
|
||||
|
||||
export const useAppDispatch: () => AppDispatch = useDispatch;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import { Link, Typography } from "@mui/material";
|
||||
|
||||
export function Copyright(props: any) {
|
||||
return (
|
||||
<Typography
|
||||
variant="body2"
|
||||
color="text.secondary"
|
||||
align="center"
|
||||
{...props}
|
||||
>
|
||||
{"Copyright © "}
|
||||
<Link color="inherit" href="https://tutrastero.com/">
|
||||
Tu Trastero Tu Otro Espacio S.L
|
||||
</Link>{" "}
|
||||
{new Date().getFullYear()}.
|
||||
</Typography>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
import {Grid, Hidden, Typography, Drawer, Box} from "@mui/material";
|
||||
|
||||
export default function ResponsiveDrawer(){
|
||||
const drawer = (
|
||||
<div>
|
||||
<Grid container direction="column">
|
||||
<Grid item>
|
||||
<Typography variant="h6">Home</Typography>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="h6">Search</Typography>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="h6">Notifications</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex' }}>
|
||||
{/* The implementation can be swapped with js to avoid SEO duplication of links. */}
|
||||
<Hidden smUp implementation="css">
|
||||
<Drawer
|
||||
variant="temporary"
|
||||
anchor={'bottom'}
|
||||
open={true}
|
||||
ModalProps={{
|
||||
keepMounted: true, // Better open performance on mobile.
|
||||
}}
|
||||
>
|
||||
{drawer}
|
||||
</Drawer>
|
||||
</Hidden>
|
||||
<Hidden xsDown implementation="css">
|
||||
<Drawer
|
||||
variant="permanent"
|
||||
open
|
||||
>
|
||||
{drawer}
|
||||
</Drawer>
|
||||
</Hidden>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import { Divider, styled } from "@mui/material";
|
||||
|
||||
export const StyledDivider = styled(Divider)({
|
||||
marginBottom: "2%",
|
||||
});
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
import {useRouteError} from "react-router-dom";
|
||||
import {Box, Typography} from "@mui/material";
|
||||
|
||||
export default function ErrorPage() {
|
||||
const error = useRouteError() as any;
|
||||
console.error(error);
|
||||
|
||||
return (
|
||||
<div id="error-page">
|
||||
<Box sx={{
|
||||
marginTop: 16,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center"
|
||||
}}>
|
||||
<Typography component={"h1"} variant={"h1"}>
|
||||
Whoops!
|
||||
</Typography>
|
||||
<Typography component={"p"}>
|
||||
Something went wrong :(
|
||||
</Typography>
|
||||
<span style={{height: 16}}/>
|
||||
<Typography component={"p"}>
|
||||
<i>{error.message || error.statusText}</i>
|
||||
</Typography>
|
||||
</Box>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,15 +1,59 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
import "./index.css";
|
||||
import reportWebVitals from "./reportWebVitals";
|
||||
import "@fontsource/roboto";
|
||||
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
||||
import Root from "./routes/root";
|
||||
import ErrorPage from "./error-page";
|
||||
import { createTheme, CssBaseline, ThemeProvider } from "@mui/material";
|
||||
import Login from "./routes/Auth/login";
|
||||
import Register from "./routes/Auth/register";
|
||||
import AuthRoot from "./routes/Auth/authRoot";
|
||||
import { Provider } from "react-redux";
|
||||
import { store } from "./app/store";
|
||||
|
||||
const root = ReactDOM.createRoot(
|
||||
document.getElementById('root') as HTMLElement
|
||||
document.getElementById("root") as HTMLElement
|
||||
);
|
||||
|
||||
const defaultTheme = createTheme({
|
||||
palette: {
|
||||
mode: "dark",
|
||||
},
|
||||
});
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <Root />,
|
||||
errorElement: <ErrorPage />,
|
||||
},
|
||||
{
|
||||
path: "/auth",
|
||||
element: <AuthRoot />,
|
||||
errorElement: <ErrorPage />,
|
||||
children: [
|
||||
{
|
||||
path: "login",
|
||||
element: <Login />,
|
||||
},
|
||||
{
|
||||
path: "register",
|
||||
element: <Register />,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
<Provider store={store}>
|
||||
<ThemeProvider theme={defaultTheme}>
|
||||
<CssBaseline />
|
||||
<RouterProvider router={router} />
|
||||
</ThemeProvider>
|
||||
</Provider>
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
import { Copyright } from "@mui/icons-material";
|
||||
import { Grid, Paper, Typography } from "@mui/material";
|
||||
import { Outlet, useNavigate } from "react-router-dom";
|
||||
import { StyledDivider } from "../../components/StyledComponents";
|
||||
import { useSelector } from "react-redux";
|
||||
import { selectLoggedIn } from "../../app/loginSlice";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function AuthRoot() {
|
||||
const loggedIn = useSelector(selectLoggedIn);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
if (loggedIn) {
|
||||
return navigate("/");
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<Grid
|
||||
container
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
sx={{
|
||||
minHeight: "100vh",
|
||||
backgroundColor: (theme) =>
|
||||
theme.palette.mode === "light"
|
||||
? theme.palette.grey[100]
|
||||
: theme.palette.grey[900],
|
||||
}}
|
||||
direction="column"
|
||||
spacing={5}
|
||||
>
|
||||
<Grid
|
||||
item
|
||||
container
|
||||
alignItems="center"
|
||||
direction="column"
|
||||
justifyContent="center"
|
||||
>
|
||||
<Typography variant="h1" fontSize={"4.5rem"}>
|
||||
DevSpace
|
||||
<StyledDivider />
|
||||
</Typography>
|
||||
<Grid item>
|
||||
<Outlet />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Copyright />
|
||||
</Grid>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
import {
|
||||
Box,
|
||||
Button,
|
||||
Checkbox,
|
||||
Container,
|
||||
FormControlLabel,
|
||||
Grid,
|
||||
Paper,
|
||||
TextField,
|
||||
Typography,
|
||||
styled,
|
||||
} from "@mui/material";
|
||||
import { StyledDivider } from "../../components/StyledComponents";
|
||||
import { Link } from "@mui/material";
|
||||
import { useAppDispatch } from "../../app/store";
|
||||
import { postLogin, selectErrorMessage } from "../../app/loginSlice";
|
||||
import { AuthLoginPostRequest } from "../../api";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
export default function Login() {
|
||||
const dispatch = useAppDispatch();
|
||||
const errorMessage = useSelector(selectErrorMessage);
|
||||
|
||||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
const data = new FormData(event.currentTarget);
|
||||
const paramsObject = {
|
||||
email: data.get("email"),
|
||||
password: data.get("password"),
|
||||
longExpiration: data.get("longExpiration"),
|
||||
};
|
||||
|
||||
dispatch(postLogin(paramsObject as unknown as AuthLoginPostRequest));
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<Container maxWidth="sm" sx={{ marginTop: "15%" }}>
|
||||
<Grid
|
||||
container
|
||||
direction="column"
|
||||
justifyContent={"center"}
|
||||
alignItems={"center"}
|
||||
spacing={2}
|
||||
sx={{ padding: "10%" }}
|
||||
>
|
||||
<Grid item xs={12}>
|
||||
<Grid
|
||||
item
|
||||
component="form"
|
||||
onSubmit={handleSubmit}
|
||||
container
|
||||
direction="column"
|
||||
spacing={3}
|
||||
>
|
||||
<Grid item>
|
||||
<StyledTypography>Email:</StyledTypography>
|
||||
<TextField
|
||||
fullWidth
|
||||
required
|
||||
label="Email"
|
||||
name="email"
|
||||
variant="outlined"
|
||||
autoComplete="email"
|
||||
autoFocus
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<StyledTypography>Password:</StyledTypography>
|
||||
<TextField
|
||||
fullWidth
|
||||
required
|
||||
label="Password"
|
||||
name="password"
|
||||
type="password"
|
||||
variant="outlined"
|
||||
error={!!errorMessage}
|
||||
helperText={errorMessage}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<FormControlLabel
|
||||
id="longExpiration"
|
||||
control={<Checkbox value="remember" color="primary" />}
|
||||
label="Remember me"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Button type="submit" variant="contained" fullWidth={true}>
|
||||
Login
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<StyledDivider />
|
||||
<Typography variant="h5" fontSize={"1.5rem"}>
|
||||
Don't have an account yet?
|
||||
</Typography>
|
||||
</Grid>
|
||||
<StyledGrid item>
|
||||
<Link href="../auth/register" variant="body2">
|
||||
Register now!
|
||||
</Link>
|
||||
</StyledGrid>
|
||||
</Grid>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const StyledGrid = styled(Grid)({
|
||||
width: "50%",
|
||||
});
|
||||
|
||||
const StyledTypography = styled(Typography)({
|
||||
marginBottom: "5%",
|
||||
});
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
import {
|
||||
Button,
|
||||
Container,
|
||||
Grid,
|
||||
Link,
|
||||
Paper,
|
||||
TextField,
|
||||
Typography,
|
||||
styled,
|
||||
} from "@mui/material";
|
||||
import { useAppDispatch } from "../../app/store";
|
||||
import { postSignup } from "../../app/loginSlice";
|
||||
import { AuthSignupPostRequest } from "../../api";
|
||||
|
||||
export default function Register() {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
const data = new FormData(event.currentTarget);
|
||||
const paramsObject = {
|
||||
email: data.get("email"),
|
||||
password: data.get("password"),
|
||||
passwordValidation: data.get("passwordConfirmation"),
|
||||
firstName: data.get("firstName"),
|
||||
lastName: data.get("lastName"),
|
||||
longExpiration: true,
|
||||
};
|
||||
dispatch(postSignup(paramsObject as unknown as AuthSignupPostRequest));
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Container maxWidth="sm" sx={{ marginTop: "5%" }}>
|
||||
<Grid
|
||||
component="form"
|
||||
onSubmit={handleSubmit}
|
||||
container
|
||||
direction="column"
|
||||
justifyContent={"center"}
|
||||
alignItems={"center"}
|
||||
spacing={2}
|
||||
sx={{ paddingBottom: "10%" }}
|
||||
>
|
||||
<Grid item container xs={12} spacing={2} sx={{ width: "70%" }}>
|
||||
<Grid item xs={12}>
|
||||
<StyledTypography>First Name:</StyledTypography>
|
||||
<TextField
|
||||
fullWidth
|
||||
label="First Name"
|
||||
name="firstName"
|
||||
required
|
||||
variant="outlined"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<StyledTypography>Last Name:</StyledTypography>
|
||||
<TextField
|
||||
fullWidth
|
||||
name="lastName"
|
||||
required
|
||||
label="Last Name"
|
||||
variant="outlined"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<StyledTypography>Email:</StyledTypography>
|
||||
<TextField
|
||||
fullWidth
|
||||
label="Email"
|
||||
name="email"
|
||||
required
|
||||
variant="outlined"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<StyledTypography>Password:</StyledTypography>
|
||||
<TextField
|
||||
type="password"
|
||||
name="password"
|
||||
required
|
||||
label="Password"
|
||||
fullWidth
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<StyledTypography>Password Confirmation:</StyledTypography>
|
||||
<TextField
|
||||
type="password"
|
||||
name="passwordConfirmation"
|
||||
label="Password Confirmation"
|
||||
fullWidth
|
||||
required
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<StyledGrid item xs={12}>
|
||||
<Button type="submit" variant="contained" fullWidth={true}>
|
||||
Register
|
||||
</Button>
|
||||
</StyledGrid>
|
||||
<Grid item>
|
||||
<Typography variant="h5" fontSize={"1.5rem"}>
|
||||
Already have an account?
|
||||
</Typography>
|
||||
</Grid>
|
||||
<StyledGrid item>
|
||||
<Link href="../auth/login" variant="body2">
|
||||
Login
|
||||
</Link>
|
||||
</StyledGrid>
|
||||
</Grid>
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const StyledGrid = styled(Grid)({
|
||||
width: "50%",
|
||||
});
|
||||
const StyledTypography = styled(Typography)({
|
||||
marginBottom: "5%",
|
||||
});
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
import ResponsiveDrawer from "../components/Drawer";
|
||||
import { Outlet, useActionData, useNavigate } from "react-router-dom";
|
||||
import { Button, Grid } from "@mui/material";
|
||||
import { postLogout, selectLoggedIn, selectUserInfo } from "../app/loginSlice";
|
||||
import { useAppDispatch } from "../app/store";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function Root() {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useAppDispatch();
|
||||
const loggedIn = useSelector(selectLoggedIn);
|
||||
const userInfo = useSelector(selectUserInfo);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loggedIn) {
|
||||
navigate("/auth/login");
|
||||
}
|
||||
}, [loggedIn, navigate]);
|
||||
|
||||
const handleClick = () => {
|
||||
dispatch(postLogout());
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button color="primary" variant="contained" onClick={handleClick}>
|
||||
Log Off
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
export enum Status {
|
||||
idle = "idle",
|
||||
loading = "loading",
|
||||
succeeded = "succeeded",
|
||||
failed = "failed",
|
||||
}
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
|
|
@ -20,7 +16,5 @@
|
|||
"noEmit": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
"include": ["src"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ services:
|
|||
build: ./client
|
||||
environment:
|
||||
NODE_ENV: development
|
||||
REACT_APP_BACKEND_URL: http://localhost:3000
|
||||
ports:
|
||||
- "8080:3000"
|
||||
server:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||
"spaces": 2,
|
||||
"generator-cli": {
|
||||
"version": "7.2.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
"dependencies": {
|
||||
"bcrypt": "^5.1.1",
|
||||
"body-parser": "^1.19.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.2",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"ms": "^2.1.3",
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/bcrypt": "^5.0.2",
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/jsonwebtoken": "^9.0.5",
|
||||
"@types/ms": "^0.7.34",
|
||||
|
|
@ -214,6 +216,15 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/cors": {
|
||||
"version": "2.8.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz",
|
||||
"integrity": "sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/express": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz",
|
||||
|
|
@ -885,6 +896,18 @@
|
|||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||
},
|
||||
"node_modules/cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
"type": "commonjs",
|
||||
"devDependencies": {
|
||||
"@types/bcrypt": "^5.0.2",
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/jsonwebtoken": "^9.0.5",
|
||||
"@types/ms": "^0.7.34",
|
||||
|
|
@ -17,6 +18,7 @@
|
|||
"dependencies": {
|
||||
"bcrypt": "^5.1.1",
|
||||
"body-parser": "^1.19.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.2",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"ms": "^2.1.3",
|
||||
|
|
|
|||
|
|
@ -7,34 +7,36 @@ import {UserRoutes} from "./routes/userRoutes";
|
|||
import {AuthController} from "./controller/authController";
|
||||
import {PostRoutes} from "./routes/postRoutes";
|
||||
import {swaggerRouter} from "./routes/swaggerRoutes";
|
||||
import * as cors from "cors";
|
||||
|
||||
AppDataSource.initialize().then(async () => {
|
||||
|
||||
AppDataSource.initialize()
|
||||
.then(async () => {
|
||||
// create express app
|
||||
const app = express()
|
||||
app.use(bodyParser.json())
|
||||
const app = express();
|
||||
app.use(bodyParser.json());
|
||||
app.use(cors());
|
||||
|
||||
// register express routes from defined application routes
|
||||
// Auth Routes
|
||||
app.use('/auth', AuthRoutes)
|
||||
app.use("/auth", AuthRoutes);
|
||||
|
||||
// Swagger Routes
|
||||
app.use('/docs', swaggerRouter);
|
||||
app.use("/docs", swaggerRouter);
|
||||
|
||||
// All routes after this one require authentication
|
||||
const authController = new AuthController();
|
||||
app.use(authController.protect)
|
||||
app.use(authController.protect);
|
||||
|
||||
app.use('/users', UserRoutes)
|
||||
app.use('/posts', PostRoutes)
|
||||
app.use("/users", UserRoutes);
|
||||
app.use("/posts", PostRoutes);
|
||||
|
||||
// setup express app here
|
||||
app.use(errorHandler)
|
||||
app.use(errorHandler);
|
||||
// start express server
|
||||
app.listen(3000)
|
||||
app.listen(3000);
|
||||
|
||||
|
||||
|
||||
console.log("Express server has started on port 3000. Open http://localhost:3000/users to see results")
|
||||
|
||||
}).catch(error => console.log(error))
|
||||
console.log(
|
||||
"Express server has started on port 3000. Open http://localhost:3000/users to see results"
|
||||
);
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
|
|
|
|||
|
|
@ -83,59 +83,59 @@ const swaggerOptions = {
|
|||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
User: {
|
||||
type: "object",
|
||||
properties: {
|
||||
id: {
|
||||
type: "integer",
|
||||
description: "User ID",
|
||||
},
|
||||
firstName: {
|
||||
type: "string",
|
||||
description: "User first name",
|
||||
},
|
||||
lastName: {
|
||||
type: "string",
|
||||
description: "User last name",
|
||||
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",
|
||||
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", // Assuming you have a Comment schema
|
||||
comments: {
|
||||
type: "array",
|
||||
items: {
|
||||
$ref: "#/components/schemas/Comment", // Assuming you have a Comment schema
|
||||
},
|
||||
},
|
||||
},
|
||||
followed: {
|
||||
type: "array",
|
||||
items: {
|
||||
$ref: "#/components/schemas/User",
|
||||
followed: {
|
||||
type: "array",
|
||||
items: {
|
||||
$ref: "#/components/schemas/User",
|
||||
},
|
||||
},
|
||||
},
|
||||
followers: {
|
||||
type: "array",
|
||||
items: {
|
||||
$ref: "#/components/schemas/User",
|
||||
followers: {
|
||||
type: "array",
|
||||
items: {
|
||||
$ref: "#/components/schemas/User",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue