BLOG-43 Post related api endpoints #55

Merged
squid merged 9 commits from BLOG-43_post_crud_api into main 2025-06-07 21:26:10 +08:00
Owner

Description

  • GET /post_info

    Get all the info of the posts.

    • 200 Without any post

      []
      
    • 200 With posts

      [
          {
              "description": "This is the first post.",
              "id": 1,
              "labels": [
                  {
                      "color": "#FF666666",
                      "id": 2,
                      "name": "Rust"
                  }
              ],
              "preview_image_url": "https://squidspirit.com/icon/logo-light.svg",
              "published_time": null,
              "title": "The First Post"
          }
      ]
      
  • GET /post/{id}

    Get the full post content with the given id

    • 200 With result

      {
          "content": "Hello! I'm Squid!!",
          "id": 1,
          "info": {
              "description": "This is the first post.",
              "id": 1,
              "labels": [
                  {
                      "color": "#FF666666",
                      "id": 2,
                      "name": "Rust"
                  }
              ],
              "preview_image_url": "https://squidspirit.com/icon/logo-light.svg",
              "published_time": null,
              "title": "The First Post"
          }
      }
      
    • 404 There is no post with the id

Package Changes

[workspace.package]
version = "0.1.1"
edition = "2024"

[workspace.dependencies]
actix-web = "4.10.2"
async-trait = "0.1.88"
chrono = "0.4.41"
dotenv = "0.15.0"
env_logger = "0.11.8"
futures = "0.3.31"
log = "0.4.27"
serde = { version = "1.0.219", features = ["derive"] }
sqlx = { version = "0.8.5", features = [
    "chrono",
    "macros",
    "postgres",
    "runtime-tokio-rustls",
] }
tokio = { version = "1.45.0", features = ["full"] }

Screenshots

No response

Reference

Resolves #43

Checklist

  • A milestone is set
  • The related issuse has been linked to this branch
### Description - `GET` `/post_info` Get all the info of the posts. - `200` Without any post ```json [] ``` - `200` With posts ```json [ { "description": "This is the first post.", "id": 1, "labels": [ { "color": "#FF666666", "id": 2, "name": "Rust" } ], "preview_image_url": "https://squidspirit.com/icon/logo-light.svg", "published_time": null, "title": "The First Post" } ] ``` - `GET` `/post/{id}` Get the full post content with the given `id` - `200` With result ```json { "content": "Hello! I'm Squid!!", "id": 1, "info": { "description": "This is the first post.", "id": 1, "labels": [ { "color": "#FF666666", "id": 2, "name": "Rust" } ], "preview_image_url": "https://squidspirit.com/icon/logo-light.svg", "published_time": null, "title": "The First Post" } } ``` - `404` There is no post with the `id` ### Package Changes ```toml [workspace.package] version = "0.1.1" edition = "2024" [workspace.dependencies] actix-web = "4.10.2" async-trait = "0.1.88" chrono = "0.4.41" dotenv = "0.15.0" env_logger = "0.11.8" futures = "0.3.31" log = "0.4.27" serde = { version = "1.0.219", features = ["derive"] } sqlx = { version = "0.8.5", features = [ "chrono", "macros", "postgres", "runtime-tokio-rustls", ] } tokio = { version = "1.45.0", features = ["full"] } ``` ### Screenshots _No response_ ### Reference Resolves #43 ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch
squid added this to the 0.2.0 milestone 2025-05-22 16:29:53 +08:00
squid added the
dev
backend
label 2025-05-22 16:29:53 +08:00
squid added 6 commits 2025-05-22 16:29:53 +08:00
BLOG-43 init: actix-web project
All checks were successful
Frontend CI / build (push) Successful in 1m30s
98a9ecfd86
BLOG-43 refactor: workspace and package
All checks were successful
Frontend CI / build (push) Successful in 1m30s
74d709b036
BLOG-43 feat: post info usecase
All checks were successful
Frontend CI / build (push) Successful in 1m29s
c08bc659b9
BLOG-43 feat: connect to database
All checks were successful
Frontend CI / build (push) Successful in 1m29s
e72f5a5a8e
BLOG-43 feat: get full post
All checks were successful
Frontend CI / build (push) Successful in 1m29s
PR Title Check / pr-title-check (pull_request) Successful in 16s
e49c5b888a
squid added this to the Pre-release Development Plan project 2025-05-22 16:29:54 +08:00
zoe was assigned by squid 2025-05-22 16:32:09 +08:00
squid added 1 commit 2025-05-22 16:34:53 +08:00
BLOG-43 feat: created_time defult value & updated_time trigger
All checks were successful
Frontend CI / build (push) Successful in 1m28s
PR Title Check / pr-title-check (pull_request) Successful in 16s
3b374b2d75
squid added 1 commit 2025-05-23 02:34:23 +08:00
BLOG-43 feat: using join table & is published query
All checks were successful
Frontend CI / build (push) Successful in 1m29s
PR Title Check / pr-title-check (pull_request) Successful in 16s
c73ce31e01
zoe requested review from zoe 2025-05-31 12:45:07 +08:00
zoe approved these changes 2025-06-07 21:18:16 +08:00
Dismissed
@ -0,0 +8,4 @@
"sqlx",
"squidspirit"
],
"java.project.sourcePaths": [
Collaborator

Please remove it

Please remove it
zoe marked this conversation as resolved
squid added 1 commit 2025-06-07 21:23:27 +08:00
BLOG-43 refactor: remove unused setting
All checks were successful
Frontend CI / build (push) Successful in 1m30s
PR Title Check / pr-title-check (pull_request) Successful in 16s
3d2418d893
zoe approved these changes 2025-06-07 21:25:07 +08:00
zoe left a comment
Collaborator

LGTM

LGTM
squid merged commit c39a800b6b into main 2025-06-07 21:26:10 +08:00
squid moved this to Done in Pre-release Development Plan on 2025-06-30 15:06:03 +08:00
squid moved this to In Progress in Pre-release Development Plan on 2025-06-30 15:06:10 +08:00
squid moved this to Done in Pre-release Development Plan on 2025-06-30 15:06:12 +08:00
squid removed this from the Pre-release Development Plan project 2025-06-30 15:09:27 +08:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: squid/blog#55
No description provided.