Skip to content

Commit 27bf518

Browse files
committed
Add format tags
1 parent 6947021 commit 27bf518

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

coderd/userauth.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,7 @@ type GithubOAuth2Config struct {
372372
// @Success 200 {object} codersdk.AuthMethods
373373
// @Router /users/authmethods [get]
374374
func (api *API) userAuthMethods(rw http.ResponseWriter, r *http.Request) {
375-
var (
376-
key, ok = httpmw.APIKeyOptional(r)
377-
)
375+
key, ok := httpmw.APIKeyOptional(r)
378376
var currentUserLoginType codersdk.LoginType
379377
if ok {
380378
user, err := api.Database.GetUserByID(r.Context(), key.UserID)

codersdk/users.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ type LoginWithPasswordResponse struct {
112112

113113
type OauthConversionResponse struct {
114114
StateString string `json:"state_string"`
115-
ExpiresAt time.Time `json:"expires_at"`
115+
ExpiresAt time.Time `json:"expires_at" format:"date-time"`
116116
ToLoginType LoginType `json:"to_login_type"`
117-
UserID uuid.UUID `json:"user_id"`
117+
UserID uuid.UUID `json:"user_id" format:"uuid"`
118118
}
119119

120120
type CreateOrganizationRequest struct {

site/src/api/api.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@ export const convertToOauth = async (
120120
})
121121

122122
try {
123-
const response = await axios.post<TypesGen.OauthConversionResponse>("/api/v2/users/convert-login",
124-
payload,
125-
{
126-
headers: { ...CONTENT_TYPE_JSON },
127-
})
123+
const response = await axios.post<TypesGen.OauthConversionResponse>(
124+
"/api/v2/users/convert-login",
125+
payload,
126+
{
127+
headers: { ...CONTENT_TYPE_JSON },
128+
},
129+
)
128130
return response.data
129131
} catch (error) {
130132
if (axios.isAxiosError(error) && error.response?.status === 401) {

site/src/testHelpers/entities.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,32 +1517,31 @@ export const MockAuditOauthConvert: TypesGen.AuditLog = {
15171517
created_at: {
15181518
old: "0001-01-01T00:00:00Z",
15191519
new: "2023-06-20T20:44:54.243019Z",
1520-
secret: false
1520+
secret: false,
15211521
},
15221522
expires_at: {
1523-
old: "0001-01-01T00:00:00Z",
1524-
new: "2023-06-20T20:49:54.243019Z",
1525-
secret: false
1523+
old: "0001-01-01T00:00:00Z",
1524+
new: "2023-06-20T20:49:54.243019Z",
1525+
secret: false,
15261526
},
15271527
state_string: {
1528-
old: "",
1529-
new: "",
1530-
secret: true
1528+
old: "",
1529+
new: "",
1530+
secret: true,
15311531
},
15321532
to_login_type: {
1533-
old: "",
1534-
new: "oidc",
1535-
secret: false
1533+
old: "",
1534+
new: "oidc",
1535+
secret: false,
15361536
},
15371537
user_id: {
1538-
old: "",
1539-
new: "dc790496-eaec-4f88-a53f-8ce1f61a1fff",
1540-
secret: false
1541-
}
1538+
old: "",
1539+
new: "dc790496-eaec-4f88-a53f-8ce1f61a1fff",
1540+
secret: false,
1541+
},
15421542
},
15431543
}
15441544

1545-
15461545
export const MockAuditLogSuccessfulLogin: TypesGen.AuditLog = {
15471546
...MockAuditLog,
15481547
resource_type: "api_key",

0 commit comments

Comments
 (0)