Dragonfly2
79 строк · 2.5 Кб
1/*
2* Copyright 2020 The Dragonfly Authors
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16
17package types
18
19type UpdateUserRequest struct {
20Email string `json:"email" binding:"omitempty"`
21Phone string `json:"phone" binding:"omitempty"`
22Avatar string `json:"avatar" binding:"omitempty"`
23Location string `json:"location" binding:"omitempty"`
24BIO string `json:"bio" binding:"omitempty"`
25}
26
27type UserParams struct {
28ID uint `uri:"id" binding:"required"`
29}
30
31type GetUsersQuery struct {
32Name string `form:"name" binding:"omitempty"`
33Email string `form:"email" binding:"omitempty"`
34Location string `form:"location" binding:"omitempty"`
35State string `form:"state" binding:"omitempty"`
36Page int `form:"page" binding:"omitempty,gte=1"`
37PerPage int `form:"per_page" binding:"omitempty,gte=1,lte=10000000"`
38}
39
40type SignInRequest struct {
41Name string `json:"name" binding:"required,min=3,max=10"`
42Password string `json:"password" binding:"required,min=8,max=20"`
43}
44
45type OauthSigninParams struct {
46Name string `uri:"name" binding:"required"`
47}
48
49type OauthSigninCallbackParams struct {
50Name string `uri:"name" binding:"required"`
51}
52
53type OauthSigninCallbackQuery struct {
54Code string `form:"code" binding:"required"`
55}
56
57type ResetPasswordRequest struct {
58OldPassword string `json:"old_password" binding:"required,min=8,max=20"`
59NewPassword string `json:"new_password" binding:"required,min=8,max=20"`
60}
61
62type SignUpRequest struct {
63SignInRequest
64Email string `json:"email" binding:"required,email"`
65Phone string `json:"phone" binding:"omitempty"`
66Avatar string `json:"avatar" binding:"omitempty"`
67Location string `json:"location" binding:"omitempty"`
68BIO string `json:"bio" binding:"omitempty"`
69}
70
71type DeleteRoleForUserParams struct {
72ID uint `uri:"id" binding:"required"`
73Role string `uri:"role" binding:"required"`
74}
75
76type AddRoleForUserParams struct {
77ID uint `uri:"id" binding:"required"`
78Role string `uri:"role" binding:"required"`
79}
80