From bb1e0eebf54d3b6230274b1c95ab4ae2894d68c2 Mon Sep 17 00:00:00 2001 From: Kilian Hofmann Date: Thu, 25 Jul 2024 20:55:35 +0200 Subject: [PATCH] Initial Post list --- exam/api/docs/api.yaml | 2 +- exam/api/docs/index.html | 4 +- exam/classes/Models/Post/Post.php | 19 ++- exam/classes/Models/User/User.php | 6 +- exam/react/package.json | 1 + exam/react/pnpm-lock.yaml | 8 ++ exam/react/src/api/Api.ts | 44 ++++++- .../src/components/Forms/Login/Login.tsx | 17 ++- exam/react/src/components/Header/Header.tsx | 122 +++++++++++------- exam/react/src/components/Post/Post.tsx | 38 ++++++ exam/react/src/main.tsx | 6 + exam/react/src/routes/__root.tsx | 24 ++-- exam/react/src/routes/index.tsx | 52 +++++++- exam/react/src/store/store.ts | 24 +++- exam/react/src/types/Post.ts | 29 +++++ exam/react/src/utils/errors.ts | 27 ++-- 16 files changed, 327 insertions(+), 96 deletions(-) create mode 100644 exam/react/src/components/Post/Post.tsx create mode 100644 exam/react/src/types/Post.ts diff --git a/exam/api/docs/api.yaml b/exam/api/docs/api.yaml index 7003808..9b9af57 100644 --- a/exam/api/docs/api.yaml +++ b/exam/api/docs/api.yaml @@ -124,7 +124,7 @@ paths: [ { "id": 0, - "user": { "username": "string" }, + "user": { "username": "string", "image": "string" }, "content": "string", "postedAt": { diff --git a/exam/api/docs/index.html b/exam/api/docs/index.html index b47c4d3..55f8f01 100644 --- a/exam/api/docs/index.html +++ b/exam/api/docs/index.html @@ -428,7 +428,7 @@ data-styled.g137[id="sc-kvXgyf"]{content:"fBvPoH,"}/*!sc*/ " class="sc-euGpHm sc-exayXG fwfkcU jYGAQp">

The number of items to return.

Responses

Response samples

Content type
application/json
Example
{
  • "pages": 0,
  • "data": [
    ]
}

New post

Response samples

Content type
application/json
Example
{
  • "pages": 0,
  • "data": [
    ]
}

New post

Create a new post.

Authorizations:
BasicAuth
Request Body schema: application/json
required
content
required
string

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "username": "string",
  • "status": 0,
  • "email": "string",
  • "image": "string",
  • "isAdmin": true,
  • "memberSince": {
    },
  • "postCount": 0
}