Dragonfly2

Форк
0
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

17
package types
18

19
type UpdateUserRequest struct {
20
	Email    string `json:"email" binding:"omitempty"`
21
	Phone    string `json:"phone" binding:"omitempty"`
22
	Avatar   string `json:"avatar" binding:"omitempty"`
23
	Location string `json:"location" binding:"omitempty"`
24
	BIO      string `json:"bio" binding:"omitempty"`
25
}
26

27
type UserParams struct {
28
	ID uint `uri:"id" binding:"required"`
29
}
30

31
type GetUsersQuery struct {
32
	Name     string `form:"name" binding:"omitempty"`
33
	Email    string `form:"email" binding:"omitempty"`
34
	Location string `form:"location" binding:"omitempty"`
35
	State    string `form:"state" binding:"omitempty"`
36
	Page     int    `form:"page" binding:"omitempty,gte=1"`
37
	PerPage  int    `form:"per_page" binding:"omitempty,gte=1,lte=10000000"`
38
}
39

40
type SignInRequest struct {
41
	Name     string `json:"name" binding:"required,min=3,max=10"`
42
	Password string `json:"password" binding:"required,min=8,max=20"`
43
}
44

45
type OauthSigninParams struct {
46
	Name string `uri:"name" binding:"required"`
47
}
48

49
type OauthSigninCallbackParams struct {
50
	Name string `uri:"name" binding:"required"`
51
}
52

53
type OauthSigninCallbackQuery struct {
54
	Code string `form:"code" binding:"required"`
55
}
56

57
type ResetPasswordRequest struct {
58
	OldPassword string `json:"old_password" binding:"required,min=8,max=20"`
59
	NewPassword string `json:"new_password" binding:"required,min=8,max=20"`
60
}
61

62
type SignUpRequest struct {
63
	SignInRequest
64
	Email    string `json:"email" binding:"required,email"`
65
	Phone    string `json:"phone" binding:"omitempty"`
66
	Avatar   string `json:"avatar" binding:"omitempty"`
67
	Location string `json:"location" binding:"omitempty"`
68
	BIO      string `json:"bio" binding:"omitempty"`
69
}
70

71
type DeleteRoleForUserParams struct {
72
	ID   uint   `uri:"id" binding:"required"`
73
	Role string `uri:"role" binding:"required"`
74
}
75

76
type AddRoleForUserParams struct {
77
	ID   uint   `uri:"id" binding:"required"`
78
	Role string `uri:"role" binding:"required"`
79
}
80

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.