Book form edit: display short description
This commit is contained in:
@@ -48,6 +48,7 @@ func TestPutBookHandler_MultipleFields(t *testing.T) {
|
||||
assert.Equal(t, "Pouchkine", modifiedBook.Author)
|
||||
assert.Equal(t, "978-2-07-036803-7", modifiedBook.ISBN)
|
||||
assert.Equal(t, "OL8838048M", modifiedBook.OpenLibraryId)
|
||||
assert.Equal(t, "Roman de Pouchkine", modifiedBook.ShortDescription)
|
||||
assert.Equal(t, "En garnison dans une petite ville, un officier de l'armée impériale russe rencontre Silvio, ancien soldat et tireur exceptionnel. Celui-ci fait forte impression sur lui, jusqu'au jour où il refuse, à la suite d'un affront, de se battre en duel.", modifiedBook.Summary)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,20 +7,21 @@ type AppInfo struct {
|
||||
}
|
||||
|
||||
type FullBookGet struct {
|
||||
Title string `json:"title" binding:"required,max=300"`
|
||||
Author string `json:"author" binding:"max=100"`
|
||||
AuthorID uint `json:"authorId"`
|
||||
ISBN string `json:"isbn"`
|
||||
InventaireId string `json:"inventaireid"`
|
||||
OpenLibraryId string `json:"openlibraryid"`
|
||||
Summary string `json:"summary"`
|
||||
Review string `json:"review"`
|
||||
Rating int `json:"rating"`
|
||||
Read bool `json:"read"`
|
||||
WantRead bool `json:"wantread"`
|
||||
StartReadDate string `json:"startReadDate"`
|
||||
EndReadDate string `json:"endReadDate"`
|
||||
CoverPath string `json:"coverPath"`
|
||||
Title string `json:"title" binding:"required,max=300"`
|
||||
Author string `json:"author" binding:"max=100"`
|
||||
AuthorID uint `json:"authorId"`
|
||||
ISBN string `json:"isbn"`
|
||||
InventaireId string `json:"inventaireid"`
|
||||
OpenLibraryId string `json:"openlibraryid"`
|
||||
ShortDescription string `json:"shortdescription"`
|
||||
Summary string `json:"summary"`
|
||||
Review string `json:"review"`
|
||||
Rating int `json:"rating"`
|
||||
Read bool `json:"read"`
|
||||
WantRead bool `json:"wantread"`
|
||||
StartReadDate string `json:"startReadDate"`
|
||||
EndReadDate string `json:"endReadDate"`
|
||||
CoverPath string `json:"coverPath"`
|
||||
}
|
||||
|
||||
type BookItemsGet struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
func FetchBookGet(db *gorm.DB, userId uint, bookId uint64) (dto.FullBookGet, error) {
|
||||
var book dto.FullBookGet
|
||||
query := db.Model(&model.Book{})
|
||||
selectQueryString := "books.title, authors.name as author, authors.id as author_id, books.isbn, books.inventaire_id, books.open_library_id, books.summary, " +
|
||||
selectQueryString := "books.title, authors.name as author, authors.id as author_id, books.isbn, books.inventaire_id, books.open_library_id, books.small_description as short_description, books.summary, " +
|
||||
"user_books.review, user_books.rating, user_books.read, user_books.want_read, " +
|
||||
"DATE(user_books.start_read_date) as start_read_date, " +
|
||||
"DATE(user_books.end_read_date) AS end_read_date, " +
|
||||
|
||||
Reference in New Issue
Block a user