diff --git a/app/media_types.go b/app/media_types.go index 89c5b91..b7a4b3f 100644 --- a/app/media_types.go +++ b/app/media_types.go @@ -18,12 +18,18 @@ import ( // // Identifier: application/microkubes.user-profile+json; view=default type UserProfile struct { + // Company name + Company *string `form:"company,omitempty" json:"company,omitempty" yaml:"company,omitempty" xml:"company,omitempty"` + // Company registration number + CompanyRegistrationNumber *string `form:"companyRegistrationNumber,omitempty" json:"companyRegistrationNumber,omitempty" yaml:"companyRegistrationNumber,omitempty" xml:"companyRegistrationNumber,omitempty"` // User profile created timestamp CreatedOn int `form:"createdOn" json:"createdOn" yaml:"createdOn" xml:"createdOn"` // Email of user Email *string `form:"email,omitempty" json:"email,omitempty" yaml:"email,omitempty" xml:"email,omitempty"` // Full name of the user FullName *string `form:"fullName,omitempty" json:"fullName,omitempty" yaml:"fullName,omitempty" xml:"fullName,omitempty"` + // Tax number + TaxNumber *string `form:"taxNumber,omitempty" json:"taxNumber,omitempty" yaml:"taxNumber,omitempty" xml:"taxNumber,omitempty"` // Unique user ID UserID string `form:"userId" json:"userId" yaml:"userId" xml:"userId"` } diff --git a/app/user_types.go b/app/user_types.go index 36c2fc7..b5771c7 100644 --- a/app/user_types.go +++ b/app/user_types.go @@ -16,10 +16,16 @@ import ( // UserProfile data type userProfilePayload struct { + // Company name + Company *string `form:"company,omitempty" json:"company,omitempty" yaml:"company,omitempty" xml:"company,omitempty"` + // Company registration number + CompanyRegistrationNumber *string `form:"companyRegistrationNumber,omitempty" json:"companyRegistrationNumber,omitempty" yaml:"companyRegistrationNumber,omitempty" xml:"companyRegistrationNumber,omitempty"` // Email of user Email *string `form:"email,omitempty" json:"email,omitempty" yaml:"email,omitempty" xml:"email,omitempty"` // Full name of the user FullName *string `form:"fullName,omitempty" json:"fullName,omitempty" yaml:"fullName,omitempty" xml:"fullName,omitempty"` + // Tax number + TaxNumber *string `form:"taxNumber,omitempty" json:"taxNumber,omitempty" yaml:"taxNumber,omitempty" xml:"taxNumber,omitempty"` } // Validate validates the userProfilePayload type instance. @@ -41,21 +47,36 @@ func (ut *userProfilePayload) Validate() (err error) { // Publicize creates UserProfilePayload from userProfilePayload func (ut *userProfilePayload) Publicize() *UserProfilePayload { var pub UserProfilePayload + if ut.Company != nil { + pub.Company = ut.Company + } + if ut.CompanyRegistrationNumber != nil { + pub.CompanyRegistrationNumber = ut.CompanyRegistrationNumber + } if ut.Email != nil { pub.Email = *ut.Email } if ut.FullName != nil { pub.FullName = *ut.FullName } + if ut.TaxNumber != nil { + pub.TaxNumber = ut.TaxNumber + } return &pub } // UserProfile data type UserProfilePayload struct { + // Company name + Company *string `form:"company,omitempty" json:"company,omitempty" yaml:"company,omitempty" xml:"company,omitempty"` + // Company registration number + CompanyRegistrationNumber *string `form:"companyRegistrationNumber,omitempty" json:"companyRegistrationNumber,omitempty" yaml:"companyRegistrationNumber,omitempty" xml:"companyRegistrationNumber,omitempty"` // Email of user Email string `form:"email" json:"email" yaml:"email" xml:"email"` // Full name of the user FullName string `form:"fullName" json:"fullName" yaml:"fullName" xml:"fullName"` + // Tax number + TaxNumber *string `form:"taxNumber,omitempty" json:"taxNumber,omitempty" yaml:"taxNumber,omitempty" xml:"taxNumber,omitempty"` } // Validate validates the UserProfilePayload type instance. diff --git a/client/media_types.go b/client/media_types.go index faa12d6..e81d4e6 100644 --- a/client/media_types.go +++ b/client/media_types.go @@ -19,12 +19,18 @@ import ( // // Identifier: application/microkubes.user-profile+json; view=default type UserProfile struct { + // Company name + Company *string `form:"company,omitempty" json:"company,omitempty" yaml:"company,omitempty" xml:"company,omitempty"` + // Company registration number + CompanyRegistrationNumber *string `form:"companyRegistrationNumber,omitempty" json:"companyRegistrationNumber,omitempty" yaml:"companyRegistrationNumber,omitempty" xml:"companyRegistrationNumber,omitempty"` // User profile created timestamp CreatedOn int `form:"createdOn" json:"createdOn" yaml:"createdOn" xml:"createdOn"` // Email of user Email *string `form:"email,omitempty" json:"email,omitempty" yaml:"email,omitempty" xml:"email,omitempty"` // Full name of the user FullName *string `form:"fullName,omitempty" json:"fullName,omitempty" yaml:"fullName,omitempty" xml:"fullName,omitempty"` + // Tax number + TaxNumber *string `form:"taxNumber,omitempty" json:"taxNumber,omitempty" yaml:"taxNumber,omitempty" xml:"taxNumber,omitempty"` // Unique user ID UserID string `form:"userId" json:"userId" yaml:"userId" xml:"userId"` } diff --git a/client/user_types.go b/client/user_types.go index 8ecff5d..ec90ce6 100644 --- a/client/user_types.go +++ b/client/user_types.go @@ -16,10 +16,16 @@ import ( // UserProfile data type userProfilePayload struct { + // Company name + Company *string `form:"company,omitempty" json:"company,omitempty" yaml:"company,omitempty" xml:"company,omitempty"` + // Company registration number + CompanyRegistrationNumber *string `form:"companyRegistrationNumber,omitempty" json:"companyRegistrationNumber,omitempty" yaml:"companyRegistrationNumber,omitempty" xml:"companyRegistrationNumber,omitempty"` // Email of user Email *string `form:"email,omitempty" json:"email,omitempty" yaml:"email,omitempty" xml:"email,omitempty"` // Full name of the user FullName *string `form:"fullName,omitempty" json:"fullName,omitempty" yaml:"fullName,omitempty" xml:"fullName,omitempty"` + // Tax number + TaxNumber *string `form:"taxNumber,omitempty" json:"taxNumber,omitempty" yaml:"taxNumber,omitempty" xml:"taxNumber,omitempty"` } // Validate validates the userProfilePayload type instance. @@ -41,21 +47,36 @@ func (ut *userProfilePayload) Validate() (err error) { // Publicize creates UserProfilePayload from userProfilePayload func (ut *userProfilePayload) Publicize() *UserProfilePayload { var pub UserProfilePayload + if ut.Company != nil { + pub.Company = ut.Company + } + if ut.CompanyRegistrationNumber != nil { + pub.CompanyRegistrationNumber = ut.CompanyRegistrationNumber + } if ut.Email != nil { pub.Email = *ut.Email } if ut.FullName != nil { pub.FullName = *ut.FullName } + if ut.TaxNumber != nil { + pub.TaxNumber = ut.TaxNumber + } return &pub } // UserProfile data type UserProfilePayload struct { + // Company name + Company *string `form:"company,omitempty" json:"company,omitempty" yaml:"company,omitempty" xml:"company,omitempty"` + // Company registration number + CompanyRegistrationNumber *string `form:"companyRegistrationNumber,omitempty" json:"companyRegistrationNumber,omitempty" yaml:"companyRegistrationNumber,omitempty" xml:"companyRegistrationNumber,omitempty"` // Email of user Email string `form:"email" json:"email" yaml:"email" xml:"email"` // Full name of the user FullName string `form:"fullName" json:"fullName" yaml:"fullName" xml:"fullName"` + // Tax number + TaxNumber *string `form:"taxNumber,omitempty" json:"taxNumber,omitempty" yaml:"taxNumber,omitempty" xml:"taxNumber,omitempty"` } // Validate validates the UserProfilePayload type instance. diff --git a/db/repository.go b/db/repository.go index 5cfcea9..24da72e 100644 --- a/db/repository.go +++ b/db/repository.go @@ -13,10 +13,13 @@ import ( // User is an object which holds the UserID, FullName, Email and the date of creation type User struct { - UserID string `json:"userId" bson:"userId"` - FullName string `json:"fullname,omitempty" bson:"fullName,omitempty"` - Email string `json:"email,omitempty" bson:"email,omitempty"` - CreatedOn int `json:"createdOn,omitempty" bson:"createdOn"` + UserID string `json:"userId" bson:"userId"` + FullName string `json:"fullname,omitempty" bson:"fullName,omitempty"` + Email string `json:"email,omitempty" bson:"email,omitempty"` + Company string `json:"company,omitempty" bson:"company,omitempty"` + CompanyRegistrationNumber string `json:"companyRegistrationNumber,omitempty" bson:"companyRegistrationNumber,omitempty"` + TaxNumber string `json:"taxNumber,omitempty" bson:"taxNumber,omitempty"` + CreatedOn int `json:"createdOn,omitempty" bson:"createdOn"` } // UserProfileRepository defines the interface for accessing the user profile data @@ -61,7 +64,7 @@ func (r *BackendUserService) UpdateUserProfile(profile *app.UserProfilePayload, fmt.Printf("Error: %s\n", err.Error()) if !backends.IsErrNotFound(err) { return nil, err - } + } } var existing *app.UserProfile @@ -70,17 +73,23 @@ func (r *BackendUserService) UpdateUserProfile(profile *app.UserProfilePayload, if exitingIntf == nil { existing = &app.UserProfile{ - FullName: &profile.FullName, - Email: &profile.Email, - UserID: userID, + FullName: &profile.FullName, + Email: &profile.Email, + UserID: userID, + Company: profile.Company, + CompanyRegistrationNumber: profile.CompanyRegistrationNumber, + TaxNumber: profile.TaxNumber, } } else { existing = exitingIntf.(*app.UserProfile) existing.FullName = &profile.FullName existing.Email = &profile.Email + existing.Company = profile.Company + existing.CompanyRegistrationNumber = profile.CompanyRegistrationNumber + existing.TaxNumber = profile.TaxNumber filter = backends.NewFilter().Match("userId", userID) } - + _, err = r.userRepository.Save(existing, filter) if err != nil { diff --git a/design/design.go b/design/design.go index c3dec8a..d01478d 100644 --- a/design/design.go +++ b/design/design.go @@ -75,6 +75,9 @@ var UserProfileMedia = MediaType("application/microkubes.user-profile+json", fun Attribute("userId", String, "Unique user ID") Attribute("fullName") Attribute("email") + Attribute("company") + Attribute("companyRegistrationNumber") + Attribute("taxNumber") Attribute("createdOn", Integer, "User profile created timestamp") Required("userId", "createdOn") }) @@ -83,6 +86,9 @@ var UserProfileMedia = MediaType("application/microkubes.user-profile+json", fun Attribute("userId") Attribute("fullName") Attribute("email") + Attribute("company") + Attribute("companyRegistrationNumber") + Attribute("taxNumber") Attribute("createdOn") }) }) @@ -95,6 +101,9 @@ var UserProfilePayload = Type("UserProfilePayload", func() { Attribute("email", String, "Email of user", func() { Format("email") }) + Attribute("company", String, "Company name") + Attribute("companyRegistrationNumber", String, "Company registration number") + Attribute("taxNumber", String, "Tax number") Required("fullName", "email") }) diff --git a/go.mod b/go.mod index fc86a07..cad0388 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/Microkubes/microservice-user-profile go 1.13 require ( - github.com/Microkubes/backends v1.1.0 - github.com/Microkubes/microservice-security v1.1.0 + github.com/Microkubes/backends v1.1.1 + github.com/Microkubes/microservice-security v1.1.1 github.com/Microkubes/microservice-tools v1.1.0 github.com/keitaroinc/goa v1.5.0 github.com/spf13/cobra v0.0.5 diff --git a/go.sum b/go.sum index 758eb59..e658ce6 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,9 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/Microkubes/backends v1.1.0 h1:DBQx9rO4l32oWHWlYcvdhBcpaNpheI6TlA/JFYLImm4= -github.com/Microkubes/backends v1.1.0/go.mod h1:bgnvzTuYN8C4wCOFchZSIkDb8W/VDoFtve83UQOyTrw= -github.com/Microkubes/microservice-security v1.1.0 h1:iI5MPmx2KoZEJC6dlfs7509bzE3+LfG9CC/TCRFhkAI= -github.com/Microkubes/microservice-security v1.1.0/go.mod h1:qcBGphki1Z2HQ9LPmu7MRHnG9TqqanBJfx6uQ+/Y0V0= -github.com/Microkubes/microservice-tools v1.0.1/go.mod h1:jTxEBqKe41hggPi5e8qJOcw96rztD8jIXp0qf69LgzE= +github.com/Microkubes/backends v1.1.1 h1:/zOZwSGrPzaw4WuBVGYAY+YR5cYaeJrjfm+EZPR9PaA= +github.com/Microkubes/backends v1.1.1/go.mod h1:w2FSUGVYqtnD5cxPFYXJu65oYNSZOZNNBC9v2FRJjBA= +github.com/Microkubes/microservice-security v1.1.1 h1:qNvcoIdLz1RKOYerV6I/pTAnLmKRQ85FBoe77OC0lWE= +github.com/Microkubes/microservice-security v1.1.1/go.mod h1:FS0mUGDuKY6tlo+4cZ7xRKxtcm49m2si8/4ZdS8PjNQ= github.com/Microkubes/microservice-tools v1.1.0 h1:0kyByC+JqVi/nDDp+eKYhDpgqdA1xvVP68wGIpcJDcQ= github.com/Microkubes/microservice-tools v1.1.0/go.mod h1:9YPuF99237LdC2025udqFF82dzLl0jPvZEnXIAGJXBQ= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 h1:rFw4nCn9iMW+Vajsk51NtYIcwSTkXr+JGrMd36kTDJw= @@ -166,6 +165,7 @@ golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 h1:rOhMmluY6kLMhdnrivzec6lLg golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/swagger/swagger.json b/swagger/swagger.json index 87ddc80..33cb0b0 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"title":"User Profile Microservice","description":"API for managing UserProfile data.","version":"1.0"},"host":"localhost:8082","schemes":["http"],"consumes":["application/json","application/xml","application/gob","application/x-gob"],"produces":["application/json","application/xml","application/gob","application/x-gob"],"paths":{"/profiles/me":{"get":{"tags":["userProfile"],"summary":"GetMyProfile userProfile","description":"Get a UserProfile by UserID","operationId":"userProfile#GetMyProfile","produces":["application/microkubes.user-profile+json","application/vnd.goa.error"],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]},"put":{"tags":["userProfile"],"summary":"UpdateMyProfile userProfile","description":"Update my profile","operationId":"userProfile#UpdateMyProfile","produces":["application/microkubes.user-profile+json","application/vnd.goa.error"],"parameters":[{"name":"payload","in":"body","description":"UserProfile data","required":true,"schema":{"$ref":"#/definitions/UserProfilePayload"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]}},"/profiles/{userId}":{"get":{"tags":["userProfile"],"summary":"GetUserProfile userProfile","description":"Get a UserProfile by UserID","operationId":"userProfile#GetUserProfile","produces":["application/microkubes.user-profile+json","application/vnd.goa.error"],"parameters":[{"name":"userId","in":"path","description":"The user ID","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]},"put":{"tags":["userProfile"],"summary":"UpdateUserProfile userProfile","description":"Update user profile","operationId":"userProfile#UpdateUserProfile","produces":["application/microkubes.user-profile+json","application/vnd.goa.error"],"parameters":[{"name":"userId","in":"path","description":"User ID","required":true,"type":"string"},{"name":"payload","in":"body","description":"UserProfile data","required":true,"schema":{"$ref":"#/definitions/UserProfilePayload"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]}},"/swagger-ui/{filepath}":{"get":{"summary":"Download swagger-ui/dist","operationId":"swagger#/swagger-ui/*filepath","parameters":[{"name":"filepath","in":"path","description":"Relative file path","required":true,"type":"string"}],"responses":{"200":{"description":"File downloaded","schema":{"type":"file"}},"404":{"description":"File not found","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]}},"/swagger.json":{"get":{"summary":"Download swagger/swagger.json","operationId":"swagger#/swagger.json","responses":{"200":{"description":"File downloaded","schema":{"type":"file"}}},"schemes":["http"]}}},"definitions":{"UserProfilePayload":{"title":"UserProfilePayload","type":"object","properties":{"email":{"type":"string","description":"Email of user","example":"seamus@wuckerttorp.com","format":"email"},"fullName":{"type":"string","description":"Full name of the user","example":"Accusamus est exercitationem officia."}},"description":"UserProfile data","example":{"email":"seamus@wuckerttorp.com","fullName":"Accusamus est exercitationem officia."},"required":["fullName","email"]},"error":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"code":{"type":"string","description":"an application-specific error code, expressed as a string value.","example":"invalid_value"},"detail":{"type":"string","description":"a human-readable explanation specific to this occurrence of the problem.","example":"Value of ID must be an integer"},"id":{"type":"string","description":"a unique identifier for this particular occurrence of the problem.","example":"3F1FKVRR"},"meta":{"type":"object","description":"a meta object containing non-standard meta-information about the error.","example":{"timestamp":1458609066},"additionalProperties":true},"status":{"type":"string","description":"the HTTP status code applicable to this problem, expressed as a string value.","example":"400"}},"description":"Error response media type (default view)","example":{"code":"invalid_value","detail":"Value of ID must be an integer","id":"3F1FKVRR","meta":{"timestamp":1458609066},"status":"400"}},"userProfile":{"title":"Mediatype identifier: application/microkubes.user-profile+json; view=default","type":"object","properties":{"createdOn":{"type":"integer","description":"User profile created timestamp","example":4694125368506792031,"format":"int64"},"email":{"type":"string","description":"Email of user","example":"savion.pacocha@lueilwitzmante.org","format":"email"},"fullName":{"type":"string","description":"Full name of the user","example":"Dolor at architecto autem alias eos dolorem."},"userId":{"type":"string","description":"Unique user ID","example":"Veritatis velit assumenda minus rerum in ipsam."}},"description":"userProfile media type (default view)","example":{"createdOn":4694125368506792031,"email":"savion.pacocha@lueilwitzmante.org","fullName":"Dolor at architecto autem alias eos dolorem.","userId":"Veritatis velit assumenda minus rerum in ipsam."},"required":["userId","createdOn"]}},"responses":{"OK":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}}}} \ No newline at end of file +{"swagger":"2.0","info":{"title":"User Profile Microservice","description":"API for managing UserProfile data.","version":"1.0"},"host":"localhost:8082","schemes":["http"],"consumes":["application/json","application/xml","application/gob","application/x-gob"],"produces":["application/json","application/xml","application/gob","application/x-gob"],"paths":{"/profiles/me":{"get":{"tags":["userProfile"],"summary":"GetMyProfile userProfile","description":"Get a UserProfile by UserID","operationId":"userProfile#GetMyProfile","produces":["application/microkubes.user-profile+json","application/vnd.goa.error"],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]},"put":{"tags":["userProfile"],"summary":"UpdateMyProfile userProfile","description":"Update my profile","operationId":"userProfile#UpdateMyProfile","produces":["application/microkubes.user-profile+json","application/vnd.goa.error"],"parameters":[{"name":"payload","in":"body","description":"UserProfile data","required":true,"schema":{"$ref":"#/definitions/UserProfilePayload"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]}},"/profiles/{userId}":{"get":{"tags":["userProfile"],"summary":"GetUserProfile userProfile","description":"Get a UserProfile by UserID","operationId":"userProfile#GetUserProfile","produces":["application/microkubes.user-profile+json","application/vnd.goa.error"],"parameters":[{"name":"userId","in":"path","description":"The user ID","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]},"put":{"tags":["userProfile"],"summary":"UpdateUserProfile userProfile","description":"Update user profile","operationId":"userProfile#UpdateUserProfile","produces":["application/microkubes.user-profile+json","application/vnd.goa.error"],"parameters":[{"name":"userId","in":"path","description":"User ID","required":true,"type":"string"},{"name":"payload","in":"body","description":"UserProfile data","required":true,"schema":{"$ref":"#/definitions/UserProfilePayload"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"500":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]}},"/swagger-ui/{filepath}":{"get":{"summary":"Download swagger-ui/dist","operationId":"swagger#/swagger-ui/*filepath","parameters":[{"name":"filepath","in":"path","description":"Relative file path","required":true,"type":"string"}],"responses":{"200":{"description":"File downloaded","schema":{"type":"file"}},"404":{"description":"File not found","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]}},"/swagger.json":{"get":{"summary":"Download swagger/swagger.json","operationId":"swagger#/swagger.json","responses":{"200":{"description":"File downloaded","schema":{"type":"file"}}},"schemes":["http"]}}},"definitions":{"UserProfilePayload":{"title":"UserProfilePayload","type":"object","properties":{"company":{"type":"string","description":"Company name","example":"Enim et saepe voluptate."},"companyRegistrationNumber":{"type":"string","description":"Company registration number","example":"Nulla iste aliquam."},"email":{"type":"string","description":"Email of user","example":"hermann@waelchi.biz","format":"email"},"fullName":{"type":"string","description":"Full name of the user","example":"Molestias sint."},"taxNumber":{"type":"string","description":"Tax number","example":"Dolore sit."}},"description":"UserProfile data","example":{"company":"Enim et saepe voluptate.","companyRegistrationNumber":"Nulla iste aliquam.","email":"hermann@waelchi.biz","fullName":"Molestias sint.","taxNumber":"Dolore sit."},"required":["fullName","email"]},"error":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"code":{"type":"string","description":"an application-specific error code, expressed as a string value.","example":"invalid_value"},"detail":{"type":"string","description":"a human-readable explanation specific to this occurrence of the problem.","example":"Value of ID must be an integer"},"id":{"type":"string","description":"a unique identifier for this particular occurrence of the problem.","example":"3F1FKVRR"},"meta":{"type":"object","description":"a meta object containing non-standard meta-information about the error.","example":{"timestamp":1458609066},"additionalProperties":true},"status":{"type":"string","description":"the HTTP status code applicable to this problem, expressed as a string value.","example":"400"}},"description":"Error response media type (default view)","example":{"code":"invalid_value","detail":"Value of ID must be an integer","id":"3F1FKVRR","meta":{"timestamp":1458609066},"status":"400"}},"userProfile":{"title":"Mediatype identifier: application/microkubes.user-profile+json; view=default","type":"object","properties":{"company":{"type":"string","description":"Company name","example":"Reprehenderit enim doloribus molestiae."},"companyRegistrationNumber":{"type":"string","description":"Company registration number","example":"Dolorem illum aut."},"createdOn":{"type":"integer","description":"User profile created timestamp","example":7249765961036167632,"format":"int64"},"email":{"type":"string","description":"Email of user","example":"fatima@stracke.name","format":"email"},"fullName":{"type":"string","description":"Full name of the user","example":"Velit assumenda."},"taxNumber":{"type":"string","description":"Tax number","example":"Rerum in ipsam odio beatae possimus harum."},"userId":{"type":"string","description":"Unique user ID","example":"Vel repudiandae omnis iste possimus possimus."}},"description":"userProfile media type (default view)","example":{"company":"Reprehenderit enim doloribus molestiae.","companyRegistrationNumber":"Dolorem illum aut.","createdOn":7249765961036167632,"email":"fatima@stracke.name","fullName":"Velit assumenda.","taxNumber":"Rerum in ipsam odio beatae possimus harum.","userId":"Vel repudiandae omnis iste possimus possimus."},"required":["userId","createdOn"]}},"responses":{"OK":{"description":"OK","schema":{"$ref":"#/definitions/userProfile"}}}} \ No newline at end of file diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index 385e621..80576a4 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -7,17 +7,32 @@ definitions: UserProfilePayload: description: UserProfile data example: - email: seamus@wuckerttorp.com - fullName: Accusamus est exercitationem officia. + company: Enim et saepe voluptate. + companyRegistrationNumber: Nulla iste aliquam. + email: hermann@waelchi.biz + fullName: Molestias sint. + taxNumber: Dolore sit. properties: + company: + description: Company name + example: Enim et saepe voluptate. + type: string + companyRegistrationNumber: + description: Company registration number + example: Nulla iste aliquam. + type: string email: description: Email of user - example: seamus@wuckerttorp.com + example: hermann@waelchi.biz format: email type: string fullName: description: Full name of the user - example: Accusamus est exercitationem officia. + example: Molestias sint. + type: string + taxNumber: + description: Tax number + example: Dolore sit. type: string required: - fullName @@ -31,7 +46,7 @@ definitions: detail: Value of ID must be an integer id: 3F1FKVRR meta: - timestamp: 1.458609066e+09 + timestamp: 1458609066 status: "400" properties: code: @@ -52,7 +67,7 @@ definitions: description: a meta object containing non-standard meta-information about the error. example: - timestamp: 1.458609066e+09 + timestamp: 1458609066 type: object status: description: the HTTP status code applicable to this problem, expressed as @@ -64,28 +79,43 @@ definitions: userProfile: description: userProfile media type (default view) example: - createdOn: 4.694125368506792e+18 - email: savion.pacocha@lueilwitzmante.org - fullName: Dolor at architecto autem alias eos dolorem. - userId: Veritatis velit assumenda minus rerum in ipsam. + company: Reprehenderit enim doloribus molestiae. + companyRegistrationNumber: Dolorem illum aut. + createdOn: 7249765961036167632 + email: fatima@stracke.name + fullName: Velit assumenda. + taxNumber: Rerum in ipsam odio beatae possimus harum. + userId: Vel repudiandae omnis iste possimus possimus. properties: + company: + description: Company name + example: Reprehenderit enim doloribus molestiae. + type: string + companyRegistrationNumber: + description: Company registration number + example: Dolorem illum aut. + type: string createdOn: description: User profile created timestamp - example: 4.694125368506792e+18 + example: 7249765961036167632 format: int64 type: integer email: description: Email of user - example: savion.pacocha@lueilwitzmante.org + example: fatima@stracke.name format: email type: string fullName: description: Full name of the user - example: Dolor at architecto autem alias eos dolorem. + example: Velit assumenda. + type: string + taxNumber: + description: Tax number + example: Rerum in ipsam odio beatae possimus harum. type: string userId: description: Unique user ID - example: Veritatis velit assumenda minus rerum in ipsam. + example: Vel repudiandae omnis iste possimus possimus. type: string required: - userId diff --git a/tool/cli/commands.go b/tool/cli/commands.go index 26bdec0..38c3701 100644 --- a/tool/cli/commands.go +++ b/tool/cli/commands.go @@ -108,8 +108,11 @@ func RegisterCommands(app *cobra.Command, c *client.Client) { Payload example: { - "email": "seamus@wuckerttorp.com", - "fullName": "Accusamus est exercitationem officia." + "company": "Enim et saepe voluptate.", + "companyRegistrationNumber": "Nulla iste aliquam.", + "email": "hermann@waelchi.biz", + "fullName": "Molestias sint.", + "taxNumber": "Dolore sit." }`, RunE: func(cmd *cobra.Command, args []string) error { return tmp3.Run(c, args) }, } @@ -130,8 +133,11 @@ Payload example: Payload example: { - "email": "seamus@wuckerttorp.com", - "fullName": "Accusamus est exercitationem officia." + "company": "Enim et saepe voluptate.", + "companyRegistrationNumber": "Nulla iste aliquam.", + "email": "hermann@waelchi.biz", + "fullName": "Molestias sint.", + "taxNumber": "Dolore sit." }`, RunE: func(cmd *cobra.Command, args []string) error { return tmp4.Run(c, args) }, }