Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DisplayNameを追加 #741

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .tbls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ comments:
description: 自己紹介文
check: "氏名を公開するかどうかの可否 (0: 停止, 1: 有効, 2: 一時停止)"
name: ユーザー名
display_name: ユーザー表示名
state: traQのユーザーアカウント状態
- table: event_level_relations
tableComment: knoQイベントと公開レベルの関係テーブル
Expand Down
16 changes: 8 additions & 8 deletions docs/dbschema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
| [group_user_belongings](group_user_belongings.md) | 8 | グループとユーザー関係テーブル | BASE TABLE |
| [migrations](migrations.md) | 1 | gormigrate用のデータベースバージョンテーブル | BASE TABLE |
| [projects](projects.md) | 10 | プロジェクトテーブル | BASE TABLE |
| [project_members](project_members.md) | 9 | プロジェクト所属者テーブル | BASE TABLE |
| [users](users.md) | 7 | ユーザーテーブル | BASE TABLE |
| [project_members](project_members.md) | 8 | プロジェクト所属者テーブル | BASE TABLE |
| [users](users.md) | 8 | ユーザーテーブル | BASE TABLE |

## Relations

Expand Down Expand Up @@ -44,7 +44,7 @@ erDiagram
}
"contests" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
datetime_6_ since
Expand All @@ -55,7 +55,7 @@ erDiagram
"contest_teams" {
char_36_ id PK
char_36_ contest_id FK
varchar_32_ name
varchar_128_ name
text description
text result
text link
Expand Down Expand Up @@ -103,7 +103,7 @@ erDiagram
}
"projects" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
smallint_4_ since_year
Expand All @@ -114,9 +114,8 @@ erDiagram
datetime_6_ updated_at
}
"project_members" {
char_36_ id PK
char_36_ project_id FK
char_36_ user_id FK
char_36_ project_id PK
char_36_ user_id PK
smallint_4_ since_year
tinyint_1_ since_semester
smallint_4_ until_year
Expand All @@ -129,6 +128,7 @@ erDiagram
text description
tinyint_1_ check
varchar_32_ name
varchar_32_ display_name
tinyint_1_ state
datetime_6_ created_at
datetime_6_ updated_at
Expand Down
1 change: 1 addition & 0 deletions docs/dbschema/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ erDiagram
text description
tinyint_1_ check
varchar_32_ name
varchar_32_ display_name
tinyint_1_ state
datetime_6_ created_at
datetime_6_ updated_at
Expand Down
3 changes: 2 additions & 1 deletion docs/dbschema/contest_team_user_belongings.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ erDiagram
"contest_teams" {
char_36_ id PK
char_36_ contest_id FK
varchar_32_ name
varchar_128_ name
text description
text result
text link
Expand All @@ -75,6 +75,7 @@ erDiagram
text description
tinyint_1_ check
varchar_32_ name
varchar_32_ display_name
tinyint_1_ state
datetime_6_ created_at
datetime_6_ updated_at
Expand Down
8 changes: 4 additions & 4 deletions docs/dbschema/contest_teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
CREATE TABLE `contest_teams` (
`id` char(36) NOT NULL,
`contest_id` char(36) NOT NULL,
`name` varchar(32) DEFAULT NULL,
`name` varchar(128) DEFAULT NULL,
`description` text DEFAULT NULL,
`result` text DEFAULT NULL,
`link` text DEFAULT NULL,
Expand All @@ -31,7 +31,7 @@ CREATE TABLE `contest_teams` (
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | char(36) | | false | [contest_team_user_belongings](contest_team_user_belongings.md) | | コンテストチームUUID |
| contest_id | char(36) | | false | | [contests](contests.md) | コンテストUUID |
| name | varchar(32) | NULL | true | | | チーム名 |
| name | varchar(128) | NULL | true | | | チーム名 |
| description | text | NULL | true | | | チーム情報 |
| result | text | NULL | true | | | 順位などの結果 |
| link | text | NULL | true | | | コンテストチームの詳細が載っているページへのリンク |
Expand Down Expand Up @@ -63,7 +63,7 @@ erDiagram
"contest_teams" {
char_36_ id PK
char_36_ contest_id FK
varchar_32_ name
varchar_128_ name
text description
text result
text link
Expand All @@ -78,7 +78,7 @@ erDiagram
}
"contests" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
datetime_6_ since
Expand Down
8 changes: 4 additions & 4 deletions docs/dbschema/contests.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
```sql
CREATE TABLE `contests` (
`id` char(36) NOT NULL,
`name` varchar(32) DEFAULT NULL,
`name` varchar(128) DEFAULT NULL,
`description` text DEFAULT NULL,
`link` text DEFAULT NULL,
`since` datetime(6) DEFAULT NULL,
Expand All @@ -28,7 +28,7 @@ CREATE TABLE `contests` (
| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | char(36) | | false | [contest_teams](contest_teams.md) | | コンテストUUID |
| name | varchar(32) | NULL | true | | | コンテスト名 |
| name | varchar(128) | NULL | true | | | コンテスト名 |
| description | text | NULL | true | | | コンテスト説明 |
| link | text | NULL | true | | | コンテスト情報のリンク |
| since | datetime(6) | NULL | true | | | 期間始まり |
Expand Down Expand Up @@ -57,7 +57,7 @@ erDiagram

"contests" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
datetime_6_ since
Expand All @@ -68,7 +68,7 @@ erDiagram
"contest_teams" {
char_36_ id PK
char_36_ contest_id FK
varchar_32_ name
varchar_128_ name
text description
text result
text link
Expand Down
1 change: 1 addition & 0 deletions docs/dbschema/group_user_belongings.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ erDiagram
text description
tinyint_1_ check
varchar_32_ name
varchar_32_ display_name
tinyint_1_ state
datetime_6_ created_at
datetime_6_ updated_at
Expand Down
18 changes: 7 additions & 11 deletions docs/dbschema/project_members.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

```sql
CREATE TABLE `project_members` (
`id` char(36) NOT NULL,
`project_id` char(36) NOT NULL,
`user_id` char(36) NOT NULL,
`since_year` smallint(4) NOT NULL,
Expand All @@ -18,8 +17,7 @@ CREATE TABLE `project_members` (
`until_semester` tinyint(1) NOT NULL,
`created_at` datetime(6) DEFAULT NULL,
`updated_at` datetime(6) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_project_members_project` (`project_id`),
PRIMARY KEY (`project_id`,`user_id`),
KEY `fk_project_members_user` (`user_id`),
CONSTRAINT `fk_project_members_project` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_project_members_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
Expand All @@ -32,7 +30,6 @@ CREATE TABLE `project_members` (

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | char(36) | | false | | | |
| project_id | char(36) | | false | | [projects](projects.md) | プロジェクトUUID |
| user_id | char(36) | | false | | [users](users.md) | ユーザーUUID |
| since_year | smallint(4) | | false | | | プロジェクト所属開始年 |
Expand All @@ -48,15 +45,14 @@ CREATE TABLE `project_members` (
| ---- | ---- | ---------- |
| fk_project_members_project | FOREIGN KEY | FOREIGN KEY (project_id) REFERENCES projects (id) |
| fk_project_members_user | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users (id) |
| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) |
| PRIMARY | PRIMARY KEY | PRIMARY KEY (project_id, user_id) |

## Indexes

| Name | Definition |
| ---- | ---------- |
| fk_project_members_project | KEY fk_project_members_project (project_id) USING BTREE |
| fk_project_members_user | KEY fk_project_members_user (user_id) USING BTREE |
| PRIMARY | PRIMARY KEY (id) USING BTREE |
| PRIMARY | PRIMARY KEY (project_id, user_id) USING BTREE |

## Relations

Expand All @@ -67,9 +63,8 @@ erDiagram
"project_members" }o--|| "users" : "FOREIGN KEY (user_id) REFERENCES users (id)"

"project_members" {
char_36_ id PK
char_36_ project_id FK
char_36_ user_id FK
char_36_ project_id PK
char_36_ user_id PK
smallint_4_ since_year
tinyint_1_ since_semester
smallint_4_ until_year
Expand All @@ -79,7 +74,7 @@ erDiagram
}
"projects" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
smallint_4_ since_year
Expand All @@ -94,6 +89,7 @@ erDiagram
text description
tinyint_1_ check
varchar_32_ name
varchar_32_ display_name
tinyint_1_ state
datetime_6_ created_at
datetime_6_ updated_at
Expand Down
11 changes: 5 additions & 6 deletions docs/dbschema/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
```sql
CREATE TABLE `projects` (
`id` char(36) NOT NULL,
`name` varchar(32) DEFAULT NULL,
`name` varchar(128) DEFAULT NULL,
`description` text DEFAULT NULL,
`link` text DEFAULT NULL,
`since_year` smallint(4) NOT NULL,
Expand All @@ -30,7 +30,7 @@ CREATE TABLE `projects` (
| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | char(36) | | false | [project_members](project_members.md) | | プロジェクトUUID |
| name | varchar(32) | NULL | true | | | プロジェクト名 |
| name | varchar(128) | NULL | true | | | プロジェクト名 |
| description | text | NULL | true | | | プロジェクト説明 |
| link | text | NULL | true | | | プロジェクト情報のリンク |
| since_year | smallint(4) | | false | | | プロジェクト開始年 |
Expand Down Expand Up @@ -61,7 +61,7 @@ erDiagram

"projects" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
smallint_4_ since_year
Expand All @@ -72,9 +72,8 @@ erDiagram
datetime_6_ updated_at
}
"project_members" {
char_36_ id PK
char_36_ project_id FK
char_36_ user_id FK
char_36_ project_id PK
char_36_ user_id PK
smallint_4_ since_year
tinyint_1_ since_semester
smallint_4_ until_year
Expand Down
2 changes: 1 addition & 1 deletion docs/dbschema/schema.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions docs/dbschema/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CREATE TABLE `users` (
`description` text NOT NULL,
`check` tinyint(1) NOT NULL DEFAULT 0,
`name` varchar(32) NOT NULL,
`display_name` varchar(32) DEFAULT NULL,
`state` tinyint(1) NOT NULL,
`created_at` datetime(6) DEFAULT NULL,
`updated_at` datetime(6) DEFAULT NULL,
Expand All @@ -31,6 +32,7 @@ CREATE TABLE `users` (
| description | text | | false | | | 自己紹介文 |
| check | tinyint(1) | 0 | false | | | 氏名を公開するかどうかの可否 (0: 停止, 1: 有効, 2: 一時停止) |
| name | varchar(32) | | false | | | ユーザー名 |
| display_name | varchar(32) | NULL | true | | | ユーザー表示名 |
| state | tinyint(1) | | false | | | traQのユーザーアカウント状態 |
| created_at | datetime(6) | NULL | true | | | |
| updated_at | datetime(6) | NULL | true | | | |
Expand Down Expand Up @@ -64,6 +66,7 @@ erDiagram
text description
tinyint_1_ check
varchar_32_ name
varchar_32_ display_name
tinyint_1_ state
datetime_6_ created_at
datetime_6_ updated_at
Expand Down Expand Up @@ -95,9 +98,8 @@ erDiagram
datetime_6_ updated_at
}
"project_members" {
char_36_ id PK
char_36_ project_id FK
char_36_ user_id FK
char_36_ project_id PK
char_36_ user_id PK
smallint_4_ since_year
tinyint_1_ since_semester
smallint_4_ until_year
Expand Down
7 changes: 7 additions & 0 deletions docs/swagger/traPortfolio.v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,14 @@ components:
realName:
type: string
description: 本名
displayName:
type: string
description: 表示名
required:
- id
- name
- realName
- displayName
UserDetail:
title: UserDetail
type: object
Expand Down Expand Up @@ -1292,6 +1296,9 @@ components:
bio:
type: string
description: 自己紹介(biography)
displayName:
type: string
description: 表示名
check:
type: boolean
description: |-
Expand Down
20 changes: 11 additions & 9 deletions internal/domain/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@
)

type User struct {
ID uuid.UUID
Name string
realName string
Check bool
ID uuid.UUID
Name string
realName string
DisplayName string
Check bool
}

func NewUser(id uuid.UUID, name string, realName string, check bool) *User {
func NewUser(id uuid.UUID, name string, realName string, displayName string, check bool) *User {

Check warning on line 22 in internal/domain/user.go

View check run for this annotation

Codecov / codecov/patch

internal/domain/user.go#L22

Added line #L22 was not covered by tests
return &User{
ID: id,
Name: name,
realName: realName,
Check: check,
ID: id,
Name: name,
realName: realName,
DisplayName: displayName,
Check: check,

Check warning on line 28 in internal/domain/user.go

View check run for this annotation

Codecov / codecov/patch

internal/domain/user.go#L24-L28

Added lines #L24 - L28 were not covered by tests
}
}

Expand Down
Loading
Loading