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

make addUidToExistUser #67

Merged
merged 1 commit into from
May 31, 2024
Merged

Conversation

Sawawa42
Copy link
Member

This PR is to resolve #64 .

スマートなテストケースの実装を思いつかなかったため、このようなものを作ってテストしました。(プルリクの内容にこれは含まれてません)

func testFunc(c *gin.Context) {
	if userExists("syamasaw") {
		if addUidToExistUser("syamasaw", "uid") == false {
			c.JSON(http.StatusConflict, gin.H{"error": "User with this login is already associated with a uid"})
			return
		}
	} else {
		if err := addUserToDB("uid", "syamasaw", ""); err != nil {
			c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
			return
		}
	}

	response := make(gin.H)

	response["login"] = "syamasaw"
	response["uid"] = "uid"

	c.JSON(http.StatusOK, response)
	return
}

@Sawawa42 Sawawa42 requested a review from ShotaTanemura May 24, 2024 08:57
@Sawawa42 Sawawa42 self-assigned this May 24, 2024
@Sawawa42 Sawawa42 linked an issue May 24, 2024 that may be closed by this pull request
@ShotaTanemura ShotaTanemura merged commit e142646 into main May 31, 2024
1 check passed
@ShotaTanemura ShotaTanemura deleted the 64-update-a-user-record-with-uid branch May 31, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update a user record with uid
2 participants