9 Commits

Author SHA1 Message Date
d349fd672c BLOG-94 refactor: rename db mapper
All checks were successful
Frontend CI / build (push) Successful in 1m9s
Auto Comment On PR / add_improve_comment (pull_request) Successful in 16s
PR Title Check / pr-title-check (pull_request) Successful in 16s
2025-08-01 12:52:48 +08:00
8f8857ee8e BLOG-94 refactor: change image ID from Option<i32> to i32 in Image struct and related mappers
All checks were successful
Frontend CI / build (push) Successful in 1m12s
2025-08-01 12:49:36 +08:00
e8f7f96677 BLOG-94 feat: create user when first login through OIDC
- Introduced UserDbService and UserDbServiceImpl for user data handling.
- Added UserMapper for converting between User and UserRecord.
- Implemented user creation and retrieval in the database.
- Updated AuthRepository to include user-related methods.
- Enhanced OIDC claims processing to include issuer information.
- Created user table in the database with necessary fields and indexes.
2025-08-01 12:48:11 +08:00
dd0567c937 BLOG-85 Implement OIDC authentication (#93)
All checks were successful
Frontend CI / build (push) Successful in 1m7s
### Description

- Login with configured OIDC issuer, and then save the logged in information in server session.
- Endpoints:
  - GET `/auth/login`
  - GET `/auth/callback`
  - GET `/auth/logout`

### Package Changes

```toml
actix-session = { version = "0.10.1", features = ["redis-session"] }
hex = "0.4.3"
openidconnect = { version = "4.0.1", features = [
    "reqwest",
    "reqwest-blocking",
] }
```

### Screenshots

<video src="attachments/8b15b576-61db-41b9-8587-b4b885018c93" title="Screencast From 2025-07-30 03-34-26.mp4" controls></video>

### Reference

Resolves #85

### Checklist

- [x] A milestone is set
- [x] The related issuse has been linked to this branch

Reviewed-on: #93
Co-authored-by: SquidSpirit <squid@squidspirit.com>
Co-committed-by: SquidSpirit <squid@squidspirit.com>
2025-07-30 03:46:49 +08:00
ab3050db69 BLOG-78 Backend image upload and download (#84)
All checks were successful
Frontend CI / build (push) Successful in 1m4s
### Description

- Add some endpoints about image:
  - POST `/image/upload`
  - GET `/image/{id}`

> [!NOTE]
> Since there isn't identity authentication, the `/image` endpoints should be restricted to private network in nginx.

> [!NOTE]
> Volume for backend should be configured in `pod.yaml`.

### Package Changes

```toml
actix-multipart = "0.7.2"
```

### Screenshots

_No response_

### Reference

Resolves #78

### Checklist

- [x] A milestone is set
- [x] The related issuse has been linked to this branch

Reviewed-on: #84
Co-authored-by: SquidSpirit <squid@squidspirit.com>
Co-committed-by: SquidSpirit <squid@squidspirit.com>
2025-07-27 13:10:46 +08:00
3cb69f6e7c BLOG-45 Post content page (#67)
All checks were successful
Frontend CI / build (push) Successful in 1m8s
### Description

- Implement the content page
  - Parse markdown formant content to html by `markdown-it`
  - Use `sanitize-html` to prevent from XSS attack
  - Style the html with `tailwindcss-typography`
- Fix the issue when backend parse the password to url
- Fix and make the post info list from backend always sorted by id

### Package Changes

### Rust

```toml
percent-encoding = "2.3.1"
```

### Node

```json
{
  "@types/markdown-it": "^14.1.2",
  "@types/sanitize-html": "^2.16.0",
  "markdown-it": "^14.1.0",
  "sanitize-html": "^2.17.0"
}
```

### Screenshots

|Desktop|Mobile|
|-|-|
|![image.png](/attachments/0ec5718a-f804-432f-8e4b-e9dc22c080d2)|![beta.squidspirit.com_post(iPhone 12 Pro) (1).png](/attachments/b30d1b96-d4a4-4b2b-b9bd-90fd2592ab52)|

### Reference

Resolves #45

### Checklist

- [x] A milestone is set
- [x] The related issuse has been linked to this branch

Reviewed-on: #67
Co-authored-by: SquidSpirit <squid@squidspirit.com>
Co-committed-by: SquidSpirit <squid@squidspirit.com>
2025-07-24 22:20:58 +08:00
c2462fe537 BLOG-44 Post overall page (#64)
All checks were successful
Frontend CI / build (push) Successful in 1m6s
### Description

- Change the format of color response

  ```json
  {
    "red": 0,
    "green": 255,
    "blue": 128,
    "alpha": 255
  }
  ```

- The relationship between the label's background color and its highlight color is calculated. The method involves first converting the RGB color value to HSL, then decreasing the L (lightness) component, and finally converting it back to RGB.

### Package Changes

```json
{
  "zod": "^4.0.5"
}
```

### Screenshots

|Desktop|Mobile|
|-|-|
|![image.png](/attachments/851450c4-0975-4b66-9bf7-606d0114c03e)|![image.png](/attachments/f263d65c-89e9-4439-8d50-ae92ae9482ac)|

### Reference

Resolves #44

### Checklist

- [x] A milestone is set
- [x] The related issuse has been linked to this branch

Reviewed-on: #64
Co-authored-by: SquidSpirit <squid@squidspirit.com>
Co-committed-by: SquidSpirit <squid@squidspirit.com>
2025-07-24 00:32:20 +08:00
d74107a0f9 BLOG-56 Align clean architecture (#57)
All checks were successful
Frontend CI / build (push) Successful in 1m53s
### Description

- As the description in the issue

  > - ~~Use case should be stateless~~
  >   > The value unwrapped from `web::Data` must be `Arc` type
  > - Initializing shouldn't be done in Container
  > - Rename the functions as xxx_handler in routes

### Package Changes

_No response_

### Screenshots

_No response_

### Reference

Resolves #56

### Checklist

- [x] A milestone is set
- [x] The related issuse has been linked to this branch

Co-authored-by: Yu Squire[ Yu, Tsung-Ying ] <squire.yu@linecorp.com>
Reviewed-on: #57
2025-07-22 23:35:54 +08:00
c39a800b6b BLOG-43 Post related api endpoints (#55)
All checks were successful
Frontend CI / build (push) Successful in 2m18s
### 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

Reviewed-on: #55
Reviewed-by: zoe <zoe@noreply.localhost>
Co-authored-by: SquidSpirit <squid@squidspirit.com>
Co-committed-by: SquidSpirit <squid@squidspirit.com>
2025-06-07 21:26:10 +08:00