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

Support basic account action for admin #934

Merged
Merged
Show file tree
Hide file tree
Changes from 12 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
652 changes: 379 additions & 273 deletions api/docs/yorkie/v1/admin.openapi.yaml

Large diffs are not rendered by default.

409 changes: 204 additions & 205 deletions api/docs/yorkie/v1/resources.openapi.yaml

Large diffs are not rendered by default.

453 changes: 226 additions & 227 deletions api/docs/yorkie/v1/yorkie.openapi.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions api/types/signup_fields.go → api/types/user_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ import (
"github.com/yorkie-team/yorkie/internal/validation"
)

// SignupFields is a set of fields that use to sign up to yorkie server.
type SignupFields struct {
// UserFields is a set of fields that use to sign up or change password to yorkie server.
type UserFields struct {
// Username is the name of user.
Username *string `bson:"username" validate:"required,min=2,max=30,slug"`

// Password is the password of user.
Password *string `bson:"password" validate:"required,min=8,max=30,alpha_num_special"`
}

// Validate validates the SignupFields.
func (i *SignupFields) Validate() error {
// Validate validates the UserFields.
func (i *UserFields) Validate() error {
return validation.ValidateStruct(i)
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,56 +31,56 @@ func TestSignupFields(t *testing.T) {
t.Run("password validation test", func(t *testing.T) {
validUsername := "test"
validPassword := "pass123!"
fields := &types.SignupFields{
fields := &types.UserFields{
Username: &validUsername,
Password: &validPassword,
}
assert.NoError(t, fields.Validate())

invalidPassword := "1234"
fields = &types.SignupFields{
fields = &types.UserFields{
Username: &validUsername,
Password: &invalidPassword,
}
assert.ErrorAs(t, fields.Validate(), &structError)

invalidPassword = "abcd"
fields = &types.SignupFields{
fields = &types.UserFields{
Username: &validUsername,
Password: &invalidPassword,
}
assert.ErrorAs(t, fields.Validate(), &structError)

invalidPassword = "!@#$"
fields = &types.SignupFields{
fields = &types.UserFields{
Username: &validUsername,
Password: &invalidPassword,
}
assert.ErrorAs(t, fields.Validate(), &structError)

invalidPassword = "abcd1234"
fields = &types.SignupFields{
fields = &types.UserFields{
Username: &validUsername,
Password: &invalidPassword,
}
assert.ErrorAs(t, fields.Validate(), &structError)

invalidPassword = "abcd!@#$"
fields = &types.SignupFields{
fields = &types.UserFields{
Username: &validUsername,
Password: &invalidPassword,
}
assert.ErrorAs(t, fields.Validate(), &structError)

invalidPassword = "1234!@#$"
fields = &types.SignupFields{
fields = &types.UserFields{
Username: &validUsername,
Password: &invalidPassword,
}
assert.ErrorAs(t, fields.Validate(), &structError)

invalidPassword = "abcd1234!@abcd1234!@abcd1234!@1"
fields = &types.SignupFields{
fields = &types.UserFields{
Username: &validUsername,
Password: &invalidPassword,
}
Expand Down
Loading
Loading