Skip to content
Merged
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
3 changes: 3 additions & 0 deletions docs/swagger/traPortfolio.v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ components:
- 9
- 10
- 11
- 12
x-enum-varnames:
- homepage
- blog
Expand All @@ -868,6 +869,7 @@ components:
- soundcloud
- hackthebox
- ctftime
- bluesky
x-enum-descriptions:
- ホームページ (IDはリンクのURLそのまま)
- ブログ (IDはリンクのURLそのまま)
Expand All @@ -881,6 +883,7 @@ components:
- SoundCloud
- HackTheBox
- CTFtime
- Bluesky
x-go-type: uint8
Project:
title: Project
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/handler/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package handler

import (
"encoding/json"
"fmt"
"net/http"
"strings"
"testing"
Expand Down Expand Up @@ -397,7 +398,7 @@ func TestAddUserAccount(t *testing.T) {
Type: schema.AccountType(domain.AccountLimit),
Url: accountURL,
},
httpError(t, "Bad Request: validate error: type: must be no greater than 11."),
httpError(t, fmt.Sprintf("Bad Request: validate error: type: must be no greater than %d.", domain.AccountLimit-1)),
Comment on lines -400 to +401

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ハードコードしてたのか

Comment on lines -400 to +401

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ハードコードしてたのか

},
"409 conflict already exists": {
http.StatusConflict,
Expand Down
2 changes: 2 additions & 0 deletions internal/domain/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
SOUNDCLOUD
HACKTHEBOX
CTFTIME
BLUESKY
AccountLimit
)

Expand Down Expand Up @@ -138,6 +139,7 @@
SOUNDCLOUD: regexp.MustCompile(`^https://soundcloud\.com/[a-z0-9-_]+$`),
HACKTHEBOX: regexp.MustCompile(`^https://app\.hackthebox\.com/users/[a-zA-Z0-9]+$`),
CTFTIME: regexp.MustCompile(`^https://ctftime\.org/user/[0-9]+$`),
BLUESKY: regexp.MustCompile(`^https://bsky\.app/profile/[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](\.[a-zA-Z0-9]+)+$`),

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

View check run for this annotation

Codecov / codecov/patch

internal/domain/user.go#L142

Added line #L142 was not covered by tests
}

if r, ok := urlRegexp[accountType]; ok {
Expand Down
5 changes: 5 additions & 0 deletions internal/pkgs/random/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ func AccountURLString(accountType domain.AccountType) string {
"https://ctftime.org/user/4285429253",
"https://ctftime.org/user/8295210365",
},
domain.BLUESKY: {
"https://bsky.app/profile/bluesky.bsky.social",
"https://bsky.app/profile/tpf.bsky.social",
"https://bsky.app/profile/tpf.example.com",
},
}
if accountType == domain.HOMEPAGE || accountType == domain.BLOG {
return fmt.Sprintf("https://%s", AlphaNumeric())
Expand Down