From 14d07f2ebb78bd3234eb6d8ae66d277a727f369a Mon Sep 17 00:00:00 2001 From: MAOZ <118872701+maooz4426@users.noreply.github.com> Date: Sat, 14 Dec 2024 09:13:03 +0900 Subject: [PATCH 01/14] =?UTF-8?q?profile=E3=81=8B=E3=82=89=E7=94=B0?= =?UTF-8?q?=E4=B8=AD=E8=A7=92=E6=A0=84=E3=82=92=E5=89=8A=E9=99=A4=20(#76)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/features/profile/components/Profile.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/client/src/features/profile/components/Profile.tsx b/client/src/features/profile/components/Profile.tsx index 933b76e..f81b8a3 100644 --- a/client/src/features/profile/components/Profile.tsx +++ b/client/src/features/profile/components/Profile.tsx @@ -117,22 +117,18 @@ export const ProfileDetailCard = (props: ProfileDetailCardProps) => {
タグず
-

{detail?.name || "田中角栄"}

+

{detail?.name || "データなし"}

CN -

{detail?.mem1 || "立命館大学"}

+

{detail?.mem1 || "データなし"}

{detail?.self || ` - 上手くいって欲しい……そんなのは当たり前のごとく思ってますけれども、やっぱりこの界隈で簡単に許されることでは無い - 単純にスパンが短すぎて、この前ボロ泣きした私や大勢のファン、ホロメンたちが浮かばれない気がしてさ - まぁさ、嬉しいんだけれども。 - さすがに1,2年は空けて欲しかった気持ち - 激重厄介ファンだからこそ、大好きだったからこそ容易には受け入れられない壁があるんや…… + データなし ` .split("\n") .map(line => ( From e850bc8b18a4fef3fc6a57f8b55ac205b8572978 Mon Sep 17 00:00:00 2001 From: MAOZ <118872701+maooz4426@users.noreply.github.com> Date: Sat, 14 Dec 2024 09:13:32 +0900 Subject: [PATCH 02/14] =?UTF-8?q?tbls=E3=82=BB=E3=83=83=E3=83=88=E3=82=A2?= =?UTF-8?q?=E3=83=83=E3=83=97=E3=83=86=E3=82=B9=E3=83=88=20(#74)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * tblsセットアップテスト * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix (#75) Co-authored-by: MAOZ <118872701+maooz4426@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/workflows/tbls.yml | 65 +++++++++++++++ docs/schema/README.md | 129 +++++++++++++++++++++++++++++ docs/schema/communities.md | 114 +++++++++++++++++++++++++ docs/schema/events.md | 96 +++++++++++++++++++++ docs/schema/members.md | 51 ++++++++++++ docs/schema/messages.md | 84 +++++++++++++++++++ docs/schema/schema_migrations.md | 51 ++++++++++++ docs/schema/scout_lists.md | 118 ++++++++++++++++++++++++++ docs/schema/sessions.md | 71 ++++++++++++++++ docs/schema/tag_click_histories.md | 66 +++++++++++++++ docs/schema/tags.md | 54 ++++++++++++ docs/schema/threads.md | 63 ++++++++++++++ docs/schema/users.md | 95 +++++++++++++++++++++ server/config/.tbls.yml | 11 +++ 14 files changed, 1068 insertions(+) create mode 100644 .github/workflows/tbls.yml create mode 100644 docs/schema/README.md create mode 100644 docs/schema/communities.md create mode 100644 docs/schema/events.md create mode 100644 docs/schema/members.md create mode 100644 docs/schema/messages.md create mode 100644 docs/schema/schema_migrations.md create mode 100644 docs/schema/scout_lists.md create mode 100644 docs/schema/sessions.md create mode 100644 docs/schema/tag_click_histories.md create mode 100644 docs/schema/tags.md create mode 100644 docs/schema/threads.md create mode 100644 docs/schema/users.md create mode 100644 server/config/.tbls.yml diff --git a/.github/workflows/tbls.yml b/.github/workflows/tbls.yml new file mode 100644 index 0000000..39e1335 --- /dev/null +++ b/.github/workflows/tbls.yml @@ -0,0 +1,65 @@ +name: tbls-gen + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - closed + +jobs: + gen: + name: tbls-gen + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + timeout-minutes: 10 + services: + mysql: + image: mysql:8.0 + ports: + - 3306:3306 + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: db + options: >- + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-timeout=5s + --health-retries=3 + steps: + - name: checkout + uses: actions/checkout@v4.2.2 + - name: Set up Go + uses: actions/setup-go@v5.1.0 + with: + go-version-file: './server/go.mod' + cache: false + check-latest: true + id: go + - name: Ensure go.mod is tidied + working-directory: server + run: go mod tidy + - name: install golang-migrate + run: go install -tags 'mysql' github.com/golang-migrate/migrate/v4/cmd/migrate@latest + - name: mysql wakeup + run: | + until (echo 'SELECT 1' | mysql -h 127.0.0.1 -P 3306 -uroot --silent &> /dev/null); do echo "waiting for mysql to be connectable" && sleep 2; done + - name: mysql migrate for tbls + working-directory: server + run: | + mysql -h 127.0.0.1 -P 3306 -u root -e "CREATE DATABASE IF NOT EXISTS db DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin" + migrate -path db/migrations -database "mysql://root:@tcp(127.0.0.1:3306)/db?parseTime=true" up + - name: install tbls + uses: k1low/setup-tbls@v1 + - name: run tbls + run: | + TBLS_DSN=mysql://root:@localhost:3306/db tbls doc --rm-dist --config server/config/.tbls.yml + - name: fix tbls + uses: dev-hato/actions-diff-pr-management@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + branch-name-prefix: fix-tbls + diff --git a/docs/schema/README.md b/docs/schema/README.md new file mode 100644 index 0000000..b010831 --- /dev/null +++ b/docs/schema/README.md @@ -0,0 +1,129 @@ +# db + +## Tables + +| Name | Columns | Comment | Type | +| ---- | ------- | ------- | ---- | +| [communities](communities.md) | 14 | | BASE TABLE | +| [events](events.md) | 10 | | BASE TABLE | +| [members](members.md) | 2 | | BASE TABLE | +| [messages](messages.md) | 8 | | BASE TABLE | +| [schema_migrations](schema_migrations.md) | 2 | | BASE TABLE | +| [scout_lists](scout_lists.md) | 8 | | BASE TABLE | +| [sessions](sessions.md) | 3 | | BASE TABLE | +| [tag_click_histories](tag_click_histories.md) | 7 | | BASE TABLE | +| [tags](tags.md) | 3 | | BASE TABLE | +| [threads](threads.md) | 6 | | BASE TABLE | +| [users](users.md) | 10 | | BASE TABLE | + +## Relations + +```mermaid +erDiagram + +"events" }o--o| "communities" : "FOREIGN KEY (community_uuid) REFERENCES communities (uuid)" +"messages" }o--|| "scout_lists" : "FOREIGN KEY (room_id) REFERENCES scout_lists (id)" +"scout_lists" }o--|| "users" : "FOREIGN KEY (user_uuid) REFERENCES users (uuid)" +"scout_lists" }o--|| "communities" : "FOREIGN KEY (community_uuid) REFERENCES communities (uuid)" +"sessions" }o--|| "users" : "FOREIGN KEY (user_uuid) REFERENCES users (uuid)" + +"communities" { + varchar_36_ uuid PK + varchar_255_ name + varchar_255_ email + varchar_255_ password + text img + text self + int_unsigned mem1 + int_unsigned mem2 + int_unsigned mem3 + json tags + json MemRange + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"events" { + int id PK + varchar_36_ community_uuid FK + varchar_255_ title + varchar_255_ img + text detailed + datetime date + json tags + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"members" { + int_unsigned id PK + varchar_255_ name +} +"messages" { + int_unsigned id PK + int_unsigned room_id FK + varchar_255_ message + char_36_ user_id + tinyint_1_ looked + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"schema_migrations" { + bigint version PK + tinyint_1_ dirty +} +"scout_lists" { + int_unsigned id PK + char_36_ user_uuid FK + enum__unread___read___approve___reject__ status + char_36_ community_uuid FK + date scoutdate + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"sessions" { + int_unsigned id PK + varchar_36_ user_uuid FK + varchar_255_ session_key +} +"tag_click_histories" { + int id PK + varchar_36_ uuid + varchar_255_ tag + enum__gpt___click__ action + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"tags" { + int_unsigned id PK + varchar_255_ name + varchar_255_ color +} +"threads" { + int id PK + varchar_36_ uuid + varchar_255_ thread_id + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"users" { + varchar_36_ uuid PK + varchar_255_ name + varchar_255_ email + varchar_255_ password + text img + text self + int_unsigned mem1 + int_unsigned mem2 + int_unsigned mem3 + json tags +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/communities.md b/docs/schema/communities.md new file mode 100644 index 0000000..8d377dc --- /dev/null +++ b/docs/schema/communities.md @@ -0,0 +1,114 @@ +# communities + +## Description + +
+Table Definition + +```sql +CREATE TABLE `communities` ( + `uuid` varchar(36) NOT NULL, + `name` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `img` text, + `self` text, + `mem1` int unsigned DEFAULT NULL, + `mem2` int unsigned DEFAULT NULL, + `mem3` int unsigned DEFAULT NULL, + `tags` json DEFAULT NULL, + `MemRange` json DEFAULT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`uuid`), + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Extra Definition | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | ---------------- | -------- | ------- | ------- | +| uuid | varchar(36) | | false | | [events](events.md) [scout_lists](scout_lists.md) | | | +| name | varchar(255) | | false | | | | | +| email | varchar(255) | | false | | | | | +| password | varchar(255) | | false | | | | | +| img | text | | true | | | | | +| self | text | | true | | | | | +| mem1 | int unsigned | | true | | | | | +| mem2 | int unsigned | | true | | | | | +| mem3 | int unsigned | | true | | | | | +| tags | json | | true | | | | | +| MemRange | json | | true | | | | | +| created_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED | | | | +| updated_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED on update CURRENT_TIMESTAMP | | | | +| deleted_at | timestamp | | true | | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| email | UNIQUE | UNIQUE KEY email (email) | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (uuid) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (uuid) USING BTREE | +| email | UNIQUE KEY email (email) USING BTREE | + +## Relations + +```mermaid +erDiagram + +"events" }o--o| "communities" : "FOREIGN KEY (community_uuid) REFERENCES communities (uuid)" +"scout_lists" }o--|| "communities" : "FOREIGN KEY (community_uuid) REFERENCES communities (uuid)" + +"communities" { + varchar_36_ uuid PK + varchar_255_ name + varchar_255_ email + varchar_255_ password + text img + text self + int_unsigned mem1 + int_unsigned mem2 + int_unsigned mem3 + json tags + json MemRange + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"events" { + int id PK + varchar_36_ community_uuid FK + varchar_255_ title + varchar_255_ img + text detailed + datetime date + json tags + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"scout_lists" { + int_unsigned id PK + char_36_ user_uuid FK + enum__unread___read___approve___reject__ status + char_36_ community_uuid FK + date scoutdate + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/events.md b/docs/schema/events.md new file mode 100644 index 0000000..646c8d9 --- /dev/null +++ b/docs/schema/events.md @@ -0,0 +1,96 @@ +# events + +## Description + +
+Table Definition + +```sql +CREATE TABLE `events` ( + `id` int NOT NULL AUTO_INCREMENT, + `community_uuid` varchar(36) DEFAULT NULL, + `title` varchar(255) NOT NULL, + `img` varchar(255) NOT NULL, + `detailed` text NOT NULL, + `date` datetime NOT NULL, + `tags` json NOT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `community_uuid` (`community_uuid`), + CONSTRAINT `events_ibfk_1` FOREIGN KEY (`community_uuid`) REFERENCES `communities` (`uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Extra Definition | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | ---------------- | -------- | ------- | ------- | +| id | int | | false | auto_increment | | | | +| community_uuid | varchar(36) | | true | | | [communities](communities.md) | | +| title | varchar(255) | | false | | | | | +| img | varchar(255) | | false | | | | | +| detailed | text | | false | | | | | +| date | datetime | | false | | | | | +| tags | json | | false | | | | | +| created_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED | | | | +| updated_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED on update CURRENT_TIMESTAMP | | | | +| deleted_at | timestamp | | true | | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| events_ibfk_1 | FOREIGN KEY | FOREIGN KEY (community_uuid) REFERENCES communities (uuid) | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| community_uuid | KEY community_uuid (community_uuid) USING BTREE | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +```mermaid +erDiagram + +"events" }o--o| "communities" : "FOREIGN KEY (community_uuid) REFERENCES communities (uuid)" + +"events" { + int id PK + varchar_36_ community_uuid FK + varchar_255_ title + varchar_255_ img + text detailed + datetime date + json tags + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"communities" { + varchar_36_ uuid PK + varchar_255_ name + varchar_255_ email + varchar_255_ password + text img + text self + int_unsigned mem1 + int_unsigned mem2 + int_unsigned mem3 + json tags + json MemRange + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/members.md b/docs/schema/members.md new file mode 100644 index 0000000..52253c9 --- /dev/null +++ b/docs/schema/members.md @@ -0,0 +1,51 @@ +# members + +## Description + +
+Table Definition + +```sql +CREATE TABLE `members` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Extra Definition | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | ---------------- | -------- | ------- | ------- | +| id | int unsigned | | false | auto_increment | | | | +| name | varchar(255) | | false | | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +```mermaid +erDiagram + + +"members" { + int_unsigned id PK + varchar_255_ name +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/messages.md b/docs/schema/messages.md new file mode 100644 index 0000000..638b889 --- /dev/null +++ b/docs/schema/messages.md @@ -0,0 +1,84 @@ +# messages + +## Description + +
+Table Definition + +```sql +CREATE TABLE `messages` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `room_id` int unsigned NOT NULL, + `message` varchar(255) NOT NULL, + `user_id` char(36) NOT NULL, + `looked` tinyint(1) DEFAULT '0', + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `room_id` (`room_id`), + CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`room_id`) REFERENCES `scout_lists` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Extra Definition | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | ---------------- | -------- | ------- | ------- | +| id | int unsigned | | false | auto_increment | | | | +| room_id | int unsigned | | false | | | [scout_lists](scout_lists.md) | | +| message | varchar(255) | | false | | | | | +| user_id | char(36) | | false | | | | | +| looked | tinyint(1) | 0 | true | | | | | +| created_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED | | | | +| updated_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED on update CURRENT_TIMESTAMP | | | | +| deleted_at | timestamp | | true | | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| messages_ibfk_1 | FOREIGN KEY | FOREIGN KEY (room_id) REFERENCES scout_lists (id) | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| room_id | KEY room_id (room_id) USING BTREE | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +```mermaid +erDiagram + +"messages" }o--|| "scout_lists" : "FOREIGN KEY (room_id) REFERENCES scout_lists (id)" + +"messages" { + int_unsigned id PK + int_unsigned room_id FK + varchar_255_ message + char_36_ user_id + tinyint_1_ looked + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"scout_lists" { + int_unsigned id PK + char_36_ user_uuid FK + enum__unread___read___approve___reject__ status + char_36_ community_uuid FK + date scoutdate + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/schema_migrations.md b/docs/schema/schema_migrations.md new file mode 100644 index 0000000..670050b --- /dev/null +++ b/docs/schema/schema_migrations.md @@ -0,0 +1,51 @@ +# schema_migrations + +## Description + +
+Table Definition + +```sql +CREATE TABLE `schema_migrations` ( + `version` bigint NOT NULL, + `dirty` tinyint(1) NOT NULL, + PRIMARY KEY (`version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| version | bigint | | false | | | | +| dirty | tinyint(1) | | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (version) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (version) USING BTREE | + +## Relations + +```mermaid +erDiagram + + +"schema_migrations" { + bigint version PK + tinyint_1_ dirty +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/scout_lists.md b/docs/schema/scout_lists.md new file mode 100644 index 0000000..21acd71 --- /dev/null +++ b/docs/schema/scout_lists.md @@ -0,0 +1,118 @@ +# scout_lists + +## Description + +
+Table Definition + +```sql +CREATE TABLE `scout_lists` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `user_uuid` char(36) NOT NULL, + `status` enum('unread','read','approve','reject') NOT NULL DEFAULT 'unread', + `community_uuid` char(36) NOT NULL, + `scoutdate` date NOT NULL, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `user_uuid` (`user_uuid`), + KEY `community_uuid` (`community_uuid`), + CONSTRAINT `scout_lists_ibfk_1` FOREIGN KEY (`user_uuid`) REFERENCES `users` (`uuid`), + CONSTRAINT `scout_lists_ibfk_2` FOREIGN KEY (`community_uuid`) REFERENCES `communities` (`uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Extra Definition | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | ---------------- | -------- | ------- | ------- | +| id | int unsigned | | false | auto_increment | [messages](messages.md) | | | +| user_uuid | char(36) | | false | | | [users](users.md) | | +| status | enum('unread','read','approve','reject') | unread | false | | | | | +| community_uuid | char(36) | | false | | | [communities](communities.md) | | +| scoutdate | date | | false | | | | | +| created_at | timestamp | CURRENT_TIMESTAMP | false | DEFAULT_GENERATED | | | | +| updated_at | timestamp | CURRENT_TIMESTAMP | false | DEFAULT_GENERATED on update CURRENT_TIMESTAMP | | | | +| deleted_at | timestamp | | true | | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | +| scout_lists_ibfk_1 | FOREIGN KEY | FOREIGN KEY (user_uuid) REFERENCES users (uuid) | +| scout_lists_ibfk_2 | FOREIGN KEY | FOREIGN KEY (community_uuid) REFERENCES communities (uuid) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| community_uuid | KEY community_uuid (community_uuid) USING BTREE | +| user_uuid | KEY user_uuid (user_uuid) USING BTREE | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +```mermaid +erDiagram + +"messages" }o--|| "scout_lists" : "FOREIGN KEY (room_id) REFERENCES scout_lists (id)" +"scout_lists" }o--|| "users" : "FOREIGN KEY (user_uuid) REFERENCES users (uuid)" +"scout_lists" }o--|| "communities" : "FOREIGN KEY (community_uuid) REFERENCES communities (uuid)" + +"scout_lists" { + int_unsigned id PK + char_36_ user_uuid FK + enum__unread___read___approve___reject__ status + char_36_ community_uuid FK + date scoutdate + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"messages" { + int_unsigned id PK + int_unsigned room_id FK + varchar_255_ message + char_36_ user_id + tinyint_1_ looked + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"users" { + varchar_36_ uuid PK + varchar_255_ name + varchar_255_ email + varchar_255_ password + text img + text self + int_unsigned mem1 + int_unsigned mem2 + int_unsigned mem3 + json tags +} +"communities" { + varchar_36_ uuid PK + varchar_255_ name + varchar_255_ email + varchar_255_ password + text img + text self + int_unsigned mem1 + int_unsigned mem2 + int_unsigned mem3 + json tags + json MemRange + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/sessions.md b/docs/schema/sessions.md new file mode 100644 index 0000000..b16a6e0 --- /dev/null +++ b/docs/schema/sessions.md @@ -0,0 +1,71 @@ +# sessions + +## Description + +
+Table Definition + +```sql +CREATE TABLE `sessions` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `user_uuid` varchar(36) NOT NULL, + `session_key` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + KEY `user_uuid` (`user_uuid`), + CONSTRAINT `sessions_ibfk_1` FOREIGN KEY (`user_uuid`) REFERENCES `users` (`uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Extra Definition | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | ---------------- | -------- | ------- | ------- | +| id | int unsigned | | false | auto_increment | | | | +| user_uuid | varchar(36) | | false | | | [users](users.md) | | +| session_key | varchar(255) | | false | | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | +| sessions_ibfk_1 | FOREIGN KEY | FOREIGN KEY (user_uuid) REFERENCES users (uuid) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| user_uuid | KEY user_uuid (user_uuid) USING BTREE | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +```mermaid +erDiagram + +"sessions" }o--|| "users" : "FOREIGN KEY (user_uuid) REFERENCES users (uuid)" + +"sessions" { + int_unsigned id PK + varchar_36_ user_uuid FK + varchar_255_ session_key +} +"users" { + varchar_36_ uuid PK + varchar_255_ name + varchar_255_ email + varchar_255_ password + text img + text self + int_unsigned mem1 + int_unsigned mem2 + int_unsigned mem3 + json tags +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/tag_click_histories.md b/docs/schema/tag_click_histories.md new file mode 100644 index 0000000..655614d --- /dev/null +++ b/docs/schema/tag_click_histories.md @@ -0,0 +1,66 @@ +# tag_click_histories + +## Description + +
+Table Definition + +```sql +CREATE TABLE `tag_click_histories` ( + `id` int NOT NULL AUTO_INCREMENT, + `uuid` varchar(36) DEFAULT NULL, + `tag` varchar(255) NOT NULL, + `action` enum('gpt','click') DEFAULT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Extra Definition | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | ---------------- | -------- | ------- | ------- | +| id | int | | false | auto_increment | | | | +| uuid | varchar(36) | | true | | | | | +| tag | varchar(255) | | false | | | | | +| action | enum('gpt','click') | | true | | | | | +| created_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED | | | | +| updated_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED on update CURRENT_TIMESTAMP | | | | +| deleted_at | timestamp | | true | | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +```mermaid +erDiagram + + +"tag_click_histories" { + int id PK + varchar_36_ uuid + varchar_255_ tag + enum__gpt___click__ action + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/tags.md b/docs/schema/tags.md new file mode 100644 index 0000000..9e32092 --- /dev/null +++ b/docs/schema/tags.md @@ -0,0 +1,54 @@ +# tags + +## Description + +
+Table Definition + +```sql +CREATE TABLE `tags` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `color` varchar(255) NOT NULL DEFAULT 'red', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Extra Definition | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | ---------------- | -------- | ------- | ------- | +| id | int unsigned | | false | auto_increment | | | | +| name | varchar(255) | | false | | | | | +| color | varchar(255) | red | false | | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +```mermaid +erDiagram + + +"tags" { + int_unsigned id PK + varchar_255_ name + varchar_255_ color +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/threads.md b/docs/schema/threads.md new file mode 100644 index 0000000..14c6569 --- /dev/null +++ b/docs/schema/threads.md @@ -0,0 +1,63 @@ +# threads + +## Description + +
+Table Definition + +```sql +CREATE TABLE `threads` ( + `id` int NOT NULL AUTO_INCREMENT, + `uuid` varchar(36) DEFAULT NULL, + `thread_id` varchar(255) NOT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Extra Definition | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | ---------------- | -------- | ------- | ------- | +| id | int | | false | auto_increment | | | | +| uuid | varchar(36) | | true | | | | | +| thread_id | varchar(255) | | false | | | | | +| created_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED | | | | +| updated_at | timestamp | CURRENT_TIMESTAMP | true | DEFAULT_GENERATED on update CURRENT_TIMESTAMP | | | | +| deleted_at | timestamp | | true | | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (id) USING BTREE | + +## Relations + +```mermaid +erDiagram + + +"threads" { + int id PK + varchar_36_ uuid + varchar_255_ thread_id + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/schema/users.md b/docs/schema/users.md new file mode 100644 index 0000000..f2e7e27 --- /dev/null +++ b/docs/schema/users.md @@ -0,0 +1,95 @@ +# users + +## Description + +
+Table Definition + +```sql +CREATE TABLE `users` ( + `uuid` varchar(36) NOT NULL, + `name` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `img` text, + `self` text, + `mem1` int unsigned DEFAULT NULL, + `mem2` int unsigned DEFAULT NULL, + `mem3` int unsigned DEFAULT NULL, + `tags` json DEFAULT NULL, + PRIMARY KEY (`uuid`), + UNIQUE KEY `email` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci +``` + +
+ +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| uuid | varchar(36) | | false | [scout_lists](scout_lists.md) [sessions](sessions.md) | | | +| name | varchar(255) | | false | | | | +| email | varchar(255) | | false | | | | +| password | varchar(255) | | false | | | | +| img | text | | true | | | | +| self | text | | true | | | | +| mem1 | int unsigned | | true | | | | +| mem2 | int unsigned | | true | | | | +| mem3 | int unsigned | | true | | | | +| tags | json | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| email | UNIQUE | UNIQUE KEY email (email) | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (uuid) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| PRIMARY | PRIMARY KEY (uuid) USING BTREE | +| email | UNIQUE KEY email (email) USING BTREE | + +## Relations + +```mermaid +erDiagram + +"scout_lists" }o--|| "users" : "FOREIGN KEY (user_uuid) REFERENCES users (uuid)" +"sessions" }o--|| "users" : "FOREIGN KEY (user_uuid) REFERENCES users (uuid)" + +"users" { + varchar_36_ uuid PK + varchar_255_ name + varchar_255_ email + varchar_255_ password + text img + text self + int_unsigned mem1 + int_unsigned mem2 + int_unsigned mem3 + json tags +} +"scout_lists" { + int_unsigned id PK + char_36_ user_uuid FK + enum__unread___read___approve___reject__ status + char_36_ community_uuid FK + date scoutdate + timestamp created_at + timestamp updated_at + timestamp deleted_at +} +"sessions" { + int_unsigned id PK + varchar_36_ user_uuid FK + varchar_255_ session_key +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/server/config/.tbls.yml b/server/config/.tbls.yml new file mode 100644 index 0000000..6be93bb --- /dev/null +++ b/server/config/.tbls.yml @@ -0,0 +1,11 @@ +# .tbls.yml +# DSN (Database Source Name) to connect database +dsn: mysql://test_user:test_db@127.0.0.1:3306/db +# Path to generate document +# Default is `dbdoc` +docPath: docs/schema + +disableOutputSchema: true + +er: + format: mermaid \ No newline at end of file From d46632623f808edd4c9493d9031c9feb5a478f4a Mon Sep 17 00:00:00 2001 From: usamaru33 <143988265+usamaru33@users.noreply.github.com> Date: Sat, 14 Dec 2024 09:29:21 +0900 Subject: [PATCH 03/14] =?UTF-8?q?Tag=E3=81=AEfix=20(#77)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/tags/style.module.scss | 96 +++++++++++++------ .../features/menubar/components/Menubar.tsx | 2 +- .../src/features/tags/components/TagCard.tsx | 21 ++-- client/src/styles/theme.scss | 1 + 4 files changed, 82 insertions(+), 38 deletions(-) diff --git a/client/src/components/tags/style.module.scss b/client/src/components/tags/style.module.scss index 92710e3..cbce2df 100644 --- a/client/src/components/tags/style.module.scss +++ b/client/src/components/tags/style.module.scss @@ -63,79 +63,119 @@ .red { color: theme.$red; border-color: theme.$red; - background-color: rgb(255 246 246); + background-color: mix(theme.$red, theme.$white, 15%); &:hover { color: theme.$red; - background-color: rgb(254 226 226); + background-color: mix(theme.$red, theme.$white, 5%); } &.active { - color: rgb(255 255 255); + color: theme.$white; background-color: theme.$red; &:hover { - background-color: rgb(127 29 29); + background-color: lighten(theme.$red, 10%); } } } .blue { - color: rgb(30 64 175); - border-color: rgb(30 64 175); - background-color: rgb(239 244 254); + color: theme.$blue; + border-color: theme.$blue; + background-color: mix(theme.$blue, theme.$white, 15%); &:hover { - color: rgb(30 64 175); - background-color: rgb(219 234 254); + color: theme.$blue; + background-color: mix(theme.$blue, theme.$white, 5%); } &.active { - color: rgb(255 255 255); - background-color: rgb(30 64 175); + color: theme.$white; + background-color: theme.$blue; &:hover { - background-color: rgb(30 58 138); + background-color: lighten(theme.$blue, 10%); + } + } +} +.yellow{ + color: theme.$yellow; + border-color: theme.$yellow; + background-color: mix(theme.$yellow, theme.$white, 15%); + + &:hover { + color: theme.$yellow; + background-color: mix(theme.$yellow, theme.$white, 5%); + } + + &.active { + color: theme.$white; + background-color: theme.$yellow; + + &:hover { + background-color: lighten(theme.$yellow, 10%); } } } .green { - color: rgb(22 101 52); - border-color: rgb(22 101 52); - background-color: rgb(240 252 241); + color: theme.$green; + border-color: theme.$green; + background-color: mix(theme.$green, theme.$white, 15%); &:hover { - color: rgb(22 101 52); - background-color: rgb(220 252 231); + color: theme.$green; + background-color: mix(theme.$green, theme.$white, 5%); } &.active { - color: rgb(255 255 255); - background-color: rgb(22 101 52); + color: theme.$white; + background-color: theme.$green; &:hover { - background-color: rgb(20 83 45); + background-color: lighten(theme.$green, 10%); } } } .gray { - color: rgb(31 41 55); - border-color: rgb(31 41 55); - background-color: rgb(253 254 255); + color: theme.$gray; + border-color: theme.$black; + background-color: mix(theme.$gray, theme.$white, 15%); + + &:hover { + color: theme.$gray; + background-color: mix(theme.$gray, theme.$white, 5%); + } + + &.active { + color: theme.$white; + background-color: theme.$gray; + + &:hover { + background-color: lighten(theme.$gray, 10%); + } + } +} + + +.purple { + color: theme.$purple; + border-color: theme.$purple; + background-color: mix(theme.$purple, theme.$white, 15%); &:hover { - color: rgb(31 41 55); - background-color: rgb(223 224 226); + color: theme.$purple; + background-color: mix(theme.$purple, theme.$white, 5%); } &.active { - color: rgb(255 255 255); - background-color: rgb(31 41 55); + color: theme.$white; + background-color: theme.$purple; &:hover { - background-color: rgb(17 24 39); + background-color: lighten(theme.$purple, 10%); } } } diff --git a/client/src/features/menubar/components/Menubar.tsx b/client/src/features/menubar/components/Menubar.tsx index d250d67..498d580 100644 --- a/client/src/features/menubar/components/Menubar.tsx +++ b/client/src/features/menubar/components/Menubar.tsx @@ -34,7 +34,7 @@ export const Menubar = () => { const profileURI = `${baseAccountURI}/profile`; const settingURI = `${profileURI}/setting`; const homeURI = `${baseAccountURI}/home`; - const tagregisterURI = `${baseAccountURI}/tag`; //要修正 + const tagregisterURI = `${baseAccountURI}/signup/tags`; //要修正 let accountName = ""; let accountIcon = "https://github.com/shadcn.png"; diff --git a/client/src/features/tags/components/TagCard.tsx b/client/src/features/tags/components/TagCard.tsx index 96bffb6..7cc9029 100644 --- a/client/src/features/tags/components/TagCard.tsx +++ b/client/src/features/tags/components/TagCard.tsx @@ -34,7 +34,6 @@ export const TagCard = ({ type }: TagCardProps) => { const [currentUser] = useAtom(userAtom); const [currentCommunity] = useAtom(communityAtom); - // aiRecommendedTagsの変更を監視 useEffect(() => { console.log("aiRecommendedTags updated:", aiRecommendedTags); }, [aiRecommendedTags]); @@ -125,7 +124,7 @@ export const TagCard = ({ type }: TagCardProps) => { }; }, [type, currentUser?.uuid, currentCommunity?.uuid]); - const handleTagClick = (index: number) => { + const handleTagClick = (index: number, isAiTag: boolean = false) => { setSelectedTags(prev => { const newSet = new Set(prev); if (newSet.has(index)) { @@ -134,8 +133,9 @@ export const TagCard = ({ type }: TagCardProps) => { newSet.add(index); if (ws.current?.readyState === WebSocket.OPEN) { + const tagName = isAiTag ? aiRecommendedTags[index].name : tags[index].name; const message = { - tag: tags[index].name, + tag: tagName, }; ws.current.send(JSON.stringify(message)); } @@ -164,12 +164,14 @@ export const TagCard = ({ type }: TagCardProps) => { return; } - if (selectedTags.size < 3) { - alert("3つ以上のタグを選択してください"); + if (selectedTags.size < 1) { + alert("1つ以上のタグを選択してください"); return; } - const selectedTagNames = Array.from(selectedTags).map(index => tags[index]?.name); + const selectedTagNames = Array.from(selectedTags).map(index => ( + tags[index]?.name || aiRecommendedTags[index]?.name + )).filter(Boolean); try { if (ws.current) { @@ -194,7 +196,7 @@ export const TagCard = ({ type }: TagCardProps) => { タグを探してみよう! - 気になるタグを3個以上選んでみよう! + 気になるタグを1つ以上選んでみよう! @@ -221,7 +223,8 @@ export const TagCard = ({ type }: TagCardProps) => { handleTagClick(index, true)} > {tag.name} @@ -231,7 +234,7 @@ export const TagCard = ({ type }: TagCardProps) => { )} - diff --git a/client/src/styles/theme.scss b/client/src/styles/theme.scss index e3a37b4..04cc8b5 100644 --- a/client/src/styles/theme.scss +++ b/client/src/styles/theme.scss @@ -7,6 +7,7 @@ $gray: #C4BDBD; $background: #F2F2F2; $wheat: #F2F2F2; $blue: #3F7AD5; +$white: #FFFFFF; $theme-user: #434141; $theme-user-sub: #FFFFFF1A; From 3132a45c9292fb00da7dc94dc816708431b3f9d0 Mon Sep 17 00:00:00 2001 From: MAOZ <118872701+maooz4426@users.noreply.github.com> Date: Sat, 14 Dec 2024 10:26:34 +0900 Subject: [PATCH 04/14] =?UTF-8?q?Feature/1053=20profile=E3=81=AE=E8=A9=B3?= =?UTF-8?q?=E7=B4=B0=E3=81=A7=E3=82=BF=E3=82=B0=E3=82=92=E6=8F=8F=E7=94=BB?= =?UTF-8?q?=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=20(#79)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * tagを表示できるように * profileのタグを描画い * lint * fix (#80) Co-authored-by: MAOZ <118872701+maooz4426@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- client/src/app/community/event/page.tsx | 3 +- client/src/app/community/user-detail/page.tsx | 2 +- client/src/app/user/community-detail/page.tsx | 2 +- client/src/app/user/home/page.tsx | 2 +- .../src/features/account/types/community.ts | 2 +- client/src/features/account/types/user.ts | 2 +- .../features/chat/components/ChatRooms.tsx | 2 +- .../features/chat/components/ChatWindow.tsx | 1 - client/src/features/home/community/index.tsx | 2 +- .../features/profile/components/Profile.tsx | 35 ++++++++++++++- .../profile/components/ProfileSetting.tsx | 5 ++- .../profile/components/style.module.scss | 32 ++++++++++++-- .../src/features/signup/components/signup.tsx | 7 ++- .../src/features/tags/components/TagCard.tsx | 8 ++-- docs/swagger/components/community.yml | 10 +++++ docs/swagger/components/user.yml | 10 +++++ docs/swagger/generated.gen.swagger.yml | 20 +++++++++ .../interfaces/handlers/community_handler.go | 19 ++++---- server/interfaces/handlers/user_handler.go | 2 +- server/usecase/community_usecase.go | 44 ++++++++++--------- 20 files changed, 158 insertions(+), 52 deletions(-) diff --git a/client/src/app/community/event/page.tsx b/client/src/app/community/event/page.tsx index f202a2a..49931c1 100644 --- a/client/src/app/community/event/page.tsx +++ b/client/src/app/community/event/page.tsx @@ -59,8 +59,7 @@ const EventPage = () => { }; }, [invitedEvents]); - const handleEventClose = () => { - }; + const handleEventClose = () => {}; return ( <> diff --git a/client/src/app/community/user-detail/page.tsx b/client/src/app/community/user-detail/page.tsx index 564c1cf..da84288 100644 --- a/client/src/app/community/user-detail/page.tsx +++ b/client/src/app/community/user-detail/page.tsx @@ -30,4 +30,4 @@ const ProfileDetailContent = () => { return ; }; -export default ProfileDetailPage; \ No newline at end of file +export default ProfileDetailPage; diff --git a/client/src/app/user/community-detail/page.tsx b/client/src/app/user/community-detail/page.tsx index dff1115..c0a8cc3 100644 --- a/client/src/app/user/community-detail/page.tsx +++ b/client/src/app/user/community-detail/page.tsx @@ -30,4 +30,4 @@ const ProfileDetailContent = () => { return ; }; -export default ProfileDetailPage; \ No newline at end of file +export default ProfileDetailPage; diff --git a/client/src/app/user/home/page.tsx b/client/src/app/user/home/page.tsx index 2a20346..c7f1480 100644 --- a/client/src/app/user/home/page.tsx +++ b/client/src/app/user/home/page.tsx @@ -99,7 +99,7 @@ export default function Home() { uuid={community.uuid} communityname={community.name} icon={community.img} - tags={community.tags} + tags={community.tag_name} tag_colors={community.tag_colors} detail={community.self} university={community.mem1} diff --git a/client/src/features/account/types/community.ts b/client/src/features/account/types/community.ts index 2572721..2c92b9e 100644 --- a/client/src/features/account/types/community.ts +++ b/client/src/features/account/types/community.ts @@ -10,7 +10,7 @@ export const CommunitySchema = z.object({ mem1: z.string(), mem2: z.string().optional(), mem3: z.string().optional(), - tags: z.string().array().optional(), + tag_name: z.string().array().optional(), tag_colors: z.string().array().optional(), }); diff --git a/client/src/features/account/types/user.ts b/client/src/features/account/types/user.ts index 2ec285c..f4e2883 100644 --- a/client/src/features/account/types/user.ts +++ b/client/src/features/account/types/user.ts @@ -10,7 +10,7 @@ export const UserSchema = z.object({ mem1: z.string().optional(), mem2: z.string().optional(), mem3: z.string().optional(), - tags: z.string().array().optional(), + tag_name: z.string().array().optional(), tag_colors: z.string().array().optional(), }); diff --git a/client/src/features/chat/components/ChatRooms.tsx b/client/src/features/chat/components/ChatRooms.tsx index 898baf7..dba8cd3 100644 --- a/client/src/features/chat/components/ChatRooms.tsx +++ b/client/src/features/chat/components/ChatRooms.tsx @@ -16,7 +16,7 @@ interface ChatRoomsProps { const ChatRooms: React.FC = ({ onSelectRoom }) => { const [rooms, setRooms] = useState([]); - const [accountType, ] = useAtom(accountTypeAtom); + const [accountType] = useAtom(accountTypeAtom); const [currentUser] = useAtom(userAtom); const [currentCommunity] = useAtom(communityAtom); diff --git a/client/src/features/chat/components/ChatWindow.tsx b/client/src/features/chat/components/ChatWindow.tsx index 84a41ff..429277e 100644 --- a/client/src/features/chat/components/ChatWindow.tsx +++ b/client/src/features/chat/components/ChatWindow.tsx @@ -54,7 +54,6 @@ export const TagCard = ({ type }: TagCardProps) => { let wsInstance: WebSocket | null = null; let isComponentMounted = true; - const initializeWebSocket = async () => { const uuid = type === "user" ? currentUser?.uuid : currentCommunity?.uuid; if (!uuid) { diff --git a/client/src/features/home/community/index.tsx b/client/src/features/home/community/index.tsx index 2b08cf8..a292386 100644 --- a/client/src/features/home/community/index.tsx +++ b/client/src/features/home/community/index.tsx @@ -11,11 +11,11 @@ import { useAtom } from "jotai"; import { useRouter } from "next/navigation"; import { useEffect, useRef, useState } from "react"; import { toast } from "sonner"; -import { UserList } from "./components/UserList"; import { MessageForm } from "./components/MessageForm"; import { SearchBar } from "./components/SearchBar"; import { SearchTags } from "./components/SearchTags"; import { SelectedUserBadges } from "./components/SelectedUserBadges"; +import { UserList } from "./components/UserList"; export function CommunityHome() { const [users, setUsers] = useState([]); diff --git a/client/src/features/profile/components/Profile.tsx b/client/src/features/profile/components/Profile.tsx index f81b8a3..f7a110c 100644 --- a/client/src/features/profile/components/Profile.tsx +++ b/client/src/features/profile/components/Profile.tsx @@ -1,5 +1,6 @@ "use client"; import Pencil from "@/../public/pencil"; +import CardTag from "@/components/tags/card-tag"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; @@ -10,6 +11,7 @@ import { accountTypeAtom, communityAtom, userAtom } from "@/features/account/sto import { Community } from "@/features/account/types/community"; import { User } from "@/features/account/types/user"; import style from "@/features/profile/components/style.module.scss"; +import { ButtonVariant } from "@/features/tags/types/tag"; import { apiClient } from "@/utils/client"; import { useAtom } from "jotai/index"; import Link from "next/link"; @@ -22,6 +24,8 @@ const profileSchema = z.object({ mem1: z.string(), img: z.string(), self: z.string(), + tag_name: z.string().array().optional(), + tag_colors: z.string().array().optional(), }); type Profile = z.infer; @@ -41,6 +45,8 @@ export const ProfileCard = () => { mem1: res?.data.mem1, img: res?.data.img, self: res?.data.self, + tag_name: res?.data.tag_name, + tag_colors: res?.data.tag_colors, }; setCurrentProfile(userProfileResponse); }); @@ -51,6 +57,8 @@ export const ProfileCard = () => { mem1: res?.data.mem1, img: res?.data.img, self: res?.data.self, + tag_name: res?.data.tag_name, + tag_colors: res?.data.tag_colors, }; setCurrentProfile(userProfileResponse); }); @@ -72,9 +80,23 @@ export const ProfileCard = () => { -

{currentProfile?.self}

+

{currentProfile?.self || "データなし"}

+
+

設定タグ

+
+ {currentProfile?.tag_name?.map((tag, index) => ( + + {tag || "タグなし"} + + ))} +
+
+
); -} +}; diff --git a/client/src/features/tags/components/style.module.scss b/client/src/features/tags/components/style.module.scss index b23bf60..1e4287c 100644 --- a/client/src/features/tags/components/style.module.scss +++ b/client/src/features/tags/components/style.module.scss @@ -40,6 +40,13 @@ font-size: 20px; } +.container { + background-color: theme.$theme-community-sub; + padding: 1rem; + border-radius: 0.5rem; + margin: 1rem 0; +} + .content { display: flex; flex-wrap: wrap; @@ -48,12 +55,15 @@ } .tagContainer { - display: flex; + display: grid; + grid-template-rows: repeat(3, auto); + grid-auto-flow: column; + gap: 0.8rem; + padding: 1rem; flex-wrap: wrap; - justify-content: center; - size: rem; - gap: 10px; - padding: 20px; + min-height: 15rem; + overflow-y: hidden; + align-content: flex-start; } .footer { @@ -72,7 +82,7 @@ .aiRecommendedSection { width: 60%; - margin: auto; + margin: 20px auto; padding: 0.8rem; background: linear-gradient(90deg, #5BC7F9 0%, #FF6FEC 50%, #FF537B 100%); border-radius: 8px; @@ -99,7 +109,6 @@ font-weight: 400; font-size: 2rem; line-height: 2rem; - } .selected { From a9dce7bd3a26fd8c1ef888c2bf6c176e878fb0dd Mon Sep 17 00:00:00 2001 From: MAOZ Date: Sat, 14 Dec 2024 14:40:58 +0900 Subject: [PATCH 14/14] fix --- client/src/app/community/signup/tags/page.tsx | 2 +- client/src/app/user/home/page.tsx | 4 ++-- client/src/app/user/signup/tags/page.tsx | 2 +- .../home/community/components/SearchTags.tsx | 10 +++++----- client/src/features/tags/components/TagCard.tsx | 15 +++++---------- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/client/src/app/community/signup/tags/page.tsx b/client/src/app/community/signup/tags/page.tsx index a341689..211c08b 100644 --- a/client/src/app/community/signup/tags/page.tsx +++ b/client/src/app/community/signup/tags/page.tsx @@ -2,7 +2,7 @@ import { TagCard } from "@/features/tags/components/TagCard"; import style from "./style.module.scss"; const RegisterTags = () => { - const mockData = { + const _mockData = { message: "sign in successful", tags: [ { diff --git a/client/src/app/user/home/page.tsx b/client/src/app/user/home/page.tsx index 915217a..b1603ee 100644 --- a/client/src/app/user/home/page.tsx +++ b/client/src/app/user/home/page.tsx @@ -23,7 +23,7 @@ export default function Home() { const [searchQueryTag, setSearchQueryTag] = useState(""); const filteredTags = tags?.filter(tag => - tag.name.toLowerCase().includes(searchQueryTag.toLowerCase()) + tag.name.toLowerCase().includes(searchQueryTag.toLowerCase()), ); useEffect(() => { @@ -91,7 +91,7 @@ export default function Home() { type="text" placeholder="タグ名で検索..." value={searchQueryTag} - onChange={(e) => setSearchQueryTag(e.target.value)} + onChange={e => setSearchQueryTag(e.target.value)} className="mb-4" /> diff --git a/client/src/app/user/signup/tags/page.tsx b/client/src/app/user/signup/tags/page.tsx index a804aec..bf59ac4 100644 --- a/client/src/app/user/signup/tags/page.tsx +++ b/client/src/app/user/signup/tags/page.tsx @@ -2,7 +2,7 @@ import { TagCard } from "@/features/tags/components/TagCard"; import style from "./style.module.scss"; const RegisterTags = () => { - const mockData = { + const _mockData = { message: "sign in successful", tags: [ { diff --git a/client/src/features/home/community/components/SearchTags.tsx b/client/src/features/home/community/components/SearchTags.tsx index aeee38d..1ffa9b2 100644 --- a/client/src/features/home/community/components/SearchTags.tsx +++ b/client/src/features/home/community/components/SearchTags.tsx @@ -1,7 +1,7 @@ import CardTag from "@/components/tags/card-tag"; -import { TagType } from "@/features/tags/types/tag"; -import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { Input } from "@/components/ui/input"; +import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; +import { TagType } from "@/features/tags/types/tag"; import { useState } from "react"; import style from "../styles/search-tags.module.scss"; @@ -14,7 +14,7 @@ export function SearchTags({ tags, handleTagClick }: SearchTagsProps) { const [searchQuery, setSearchQuery] = useState(""); const filteredTags = tags?.filter(tag => - tag.name.toLowerCase().includes(searchQuery.toLowerCase()) + tag.name.toLowerCase().includes(searchQuery.toLowerCase()), ); return ( @@ -24,7 +24,7 @@ export function SearchTags({ tags, handleTagClick }: SearchTagsProps) { type="text" placeholder="タグ名で検索..." value={searchQuery} - onChange={(e) => setSearchQuery(e.target.value)} + onChange={e => setSearchQuery(e.target.value)} className="mb-4" /> @@ -39,4 +39,4 @@ export function SearchTags({ tags, handleTagClick }: SearchTagsProps) { ); -} \ No newline at end of file +} diff --git a/client/src/features/tags/components/TagCard.tsx b/client/src/features/tags/components/TagCard.tsx index 831b0ab..956ed89 100644 --- a/client/src/features/tags/components/TagCard.tsx +++ b/client/src/features/tags/components/TagCard.tsx @@ -15,14 +15,12 @@ import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { userAtom } from "@/features/account/stores"; import { communityAtom } from "@/features/account/stores"; import { ButtonVariant, TagType } from "@/features/tags/types/tag"; -import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { apiClient } from "@/utils/client"; import { useAtom } from "jotai"; import { useRouter } from "next/navigation"; import { useEffect, useRef, useState } from "react"; import { SearchBar } from "./SearchBar"; import style from "./style.module.scss"; -import { SearchBar } from "./SearchBar"; type TagCardProps = { type: "user" | "community"; @@ -44,7 +42,8 @@ export const TagCard = ({ type }: TagCardProps) => { const totalSelectedTags = new Set([...selectedRegularTags, ...selectedAiTags]); const filteredTags = tags.filter(tag => - tag.name.toLowerCase().includes(searchQuery.toLowerCase()) + tag.name.toLowerCase().includes(searchQuery.toLowerCase()), + ); useEffect(() => { console.log("aiRecommendedTags updated:", aiRecommendedTags); @@ -136,7 +135,7 @@ export const TagCard = ({ type }: TagCardProps) => { }; }, [type, currentUser?.uuid, currentCommunity?.uuid]); - const handleTagClick = (index: number, isAiTag: boolean = false) => { + const handleTagClick = (index: number, isAiTag = false) => { if (isAiTag) { const aiTag = aiRecommendedTags[index]; const regularTagIndex = tags.findIndex(tag => tag.name === aiTag.name); @@ -161,7 +160,6 @@ export const TagCard = ({ type }: TagCardProps) => { return newRegularSet; }); } - } return newSet; }); @@ -213,7 +211,7 @@ export const TagCard = ({ type }: TagCardProps) => { const selectedTagNames = [ ...Array.from(selectedRegularTags).map(index => tags[index]?.name), - ...Array.from(selectedAiTags).map(index => aiRecommendedTags[index]?.name) + ...Array.from(selectedAiTags).map(index => aiRecommendedTags[index]?.name), ].filter(Boolean); try { @@ -243,10 +241,7 @@ export const TagCard = ({ type }: TagCardProps) => { - +
{filteredTags.map((tag, index) => (