76 lines
1.6 KiB
Go
76 lines
1.6 KiB
Go
|
package codequest
|
||
|
|
||
|
import (
|
||
|
"github.com/gunk/opt/file/java"
|
||
|
"github.com/gunk/opt/http"
|
||
|
"github.com/gunk/opt/openapiv2"
|
||
|
"github.com/gunk/opt/proto"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type UserService interface {
|
||
|
// +gunk http.Match{
|
||
|
// Method: "GET",
|
||
|
// Path: "/v1/users/me",
|
||
|
// }
|
||
|
User(UserRequest) User
|
||
|
|
||
|
// +gunk http.Match{
|
||
|
// Method: "GET",
|
||
|
// Path: "/v1/admin/users/{Email}",
|
||
|
// }
|
||
|
UserByEmail(UserByEmailRequest) User
|
||
|
|
||
|
// +gunk http.Match{
|
||
|
// Method: "GET",
|
||
|
// Path: "/v1/admin/users",
|
||
|
// }
|
||
|
AllUsers(AllUsersRequest) AllUsersResponse
|
||
|
|
||
|
// +gunk http.Match{
|
||
|
// Method: "PUT",
|
||
|
// Path: "/v1/users/me",
|
||
|
// Body: "Body",
|
||
|
// }
|
||
|
UpdateUser(UpdateUserRequest) User
|
||
|
|
||
|
// +gunk http.Match{
|
||
|
// Method: "PUT",
|
||
|
// Path: "/v1/admin/users/{Email}",
|
||
|
// Body: "Body",
|
||
|
// }
|
||
|
AdminUpdateUser(UpdateUserRequest) User
|
||
|
|
||
|
// +gunk http.Match{
|
||
|
// Method: "DELETE",
|
||
|
// Path: "/v1/admin/users/{Email}",
|
||
|
// }
|
||
|
DeleteUser(DeleteUserRequest) User
|
||
|
}
|
||
|
|
||
|
type UpdateFields struct {
|
||
|
Name string `pb:"1" json:"name"`
|
||
|
GradeLevel int `pb:"3" json:"grade_level"`
|
||
|
Admin bool `pb:"4" json:"admin"`
|
||
|
}
|
||
|
|
||
|
type UserRequest struct{}
|
||
|
type AllUsersRequest struct{}
|
||
|
|
||
|
type UpdateUserRequest struct {
|
||
|
Email string `pb:"1" json:"email"`
|
||
|
Body UpdateFields `pb:"2" json:"fields"`
|
||
|
}
|
||
|
|
||
|
type UserByEmailRequest struct {
|
||
|
Email string `pb:"1" json:"email"`
|
||
|
}
|
||
|
|
||
|
type DeleteUserRequest struct {
|
||
|
Email string `pb:"1" json:"email"`
|
||
|
}
|
||
|
|
||
|
type AllUsersResponse struct {
|
||
|
Users []User `pb:"1" json:"users"`
|
||
|
}
|