generated from calmato/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
book.go
60 lines (53 loc) · 2.61 KB
/
book.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package input
// Book - 書籍登録/更新のリクエスト
type Book struct {
Title string `json:"title" validate:"required,max=64"`
TitleKana string `json:"titleKana" validate:"required,max=128"`
Description string `json:"description" validate:"omitempty,max=2000"`
Isbn string `json:"isbn" validate:"required,max=16"`
Publisher string `json:"publisher" validate:"required,max=32"`
PublishedOn string `json:"publishedOn" validate:"required"`
ThumbnailURL string `json:"thumbnailUrl" validate:"omitempty"`
RakutenURL string `json:"rakutenUrl" validate:"omitempty"`
RakutenGenreID string `json:"rakutenGenreId" validate:"omitempty"`
Authors []*BookAuthor `json:"authors" validate:"omitempty"`
}
// BookAuthor - 著者のリクエスト
type BookAuthor struct {
Name string `json:"name" validate:"required,max=32"`
NameKana string `json:"nameKana" validate:"required,max=64"`
}
// Bookshelf - 本棚への書籍登録/更新のリクエスト
type Bookshelf struct {
UserID string `json:"userId" validate:"required"`
BookID int `json:"bookId" validate:"required,gte=1"`
Status int `json:"status" validate:"required,gte=0,lte=5"`
ReadOn string `json:"readOn" validate:"omitempty"`
Impression string `json:"impression" validate:"omitempty,max=1000"`
}
// ListBookByBookIDs - 書籍一覧取得のリクエスト
type ListBookByBookIDs struct {
BookIDs []int `json:"bookIds" validate:"unique,dive,required,gte=1"`
}
// ListBookshelf - 本棚内の書籍一覧取得のリクエスト
type ListBookshelf struct {
UserID string `json:"userId" validate:"required"`
Limit int `json:"limit" validate:"gte=0,lte=1000"`
Offset int `json:"offset" validate:"gte=0"`
}
// ListBookReview - 任意の書籍のレビュー一覧取得のリクエスト
type ListBookReview struct {
BookID int `json:"bookId" validate:"required,gte=1"`
Limit int `json:"limit" validate:"gte=0,lte=1000"`
Offset int `json:"offset" validate:"gte=0"`
By string `json:"by" validate:"omitempty,oneof=id score"`
Direction string `json:"direction" validate:"omitempty,oneof=asc desc"`
}
// ListUserReview - 任意のユーザのレビュー一覧取得のリクエスト
type ListUserReview struct {
UserID string `json:"userId" validate:"required"`
Limit int `json:"limit" validate:"gte=0,lte=1000"`
Offset int `json:"offset" validate:"gte=0"`
By string `json:"by" validate:"omitempty,oneof=id score"`
Direction string `json:"direction" validate:"omitempty,oneof=asc desc"`
}