Add link to author in bookform
This commit is contained in:
@@ -3,11 +3,13 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { getBook, getImagePathOrDefault, putReadBook, putWantReadBook, putRateBook,
|
||||
putStartReadDate, putStartReadDateUnset, putEndReadDate, putEndReadDateUnset, putUnreadBook } from './api.js'
|
||||
import { onBeforeRouteUpdate } from 'vue-router'
|
||||
import { useRouter, onBeforeRouteUpdate } from 'vue-router'
|
||||
import { VRating } from 'vuetify/components/VRating';
|
||||
import BigIcon from './BigIcon.vue';
|
||||
import BookDateWidget from './BookDateWidget.vue';
|
||||
|
||||
|
||||
const router = useRouter();
|
||||
const props = defineProps({
|
||||
id: String
|
||||
});
|
||||
@@ -81,6 +83,10 @@
|
||||
return isStartReadDateSet && isReadUnset;
|
||||
}
|
||||
|
||||
function goToAuthor() {
|
||||
router.push("/author/" + data.value.authorId)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -104,7 +110,7 @@
|
||||
</div>
|
||||
<div class="column">
|
||||
<h3 class="title">{{data.title}}</h3>
|
||||
<h3 class="subtitle">{{data.author}}</h3>
|
||||
<h3 class="subtitle" @click="goToAuthor">{{data.author}}</h3>
|
||||
<p>{{data.summary}}</p>
|
||||
<div class="my-5" v-if="data.isbn">ISBN: {{data.isbn}}</div>
|
||||
<div class="my-5" v-if="data.inventaireid">Inventaire ID: {{data.inventaireid}}</div>
|
||||
|
||||
@@ -18,6 +18,7 @@ func TestGetBook_Ok(t *testing.T) {
|
||||
dto.BookGet{
|
||||
Title: "D'un château l'autre",
|
||||
Author: "Louis-Ferdinand Céline",
|
||||
AuthorID: 2,
|
||||
Rating: 10,
|
||||
Read: true,
|
||||
CoverPath: "/bookcover/dunchateaulautre.jpg",
|
||||
@@ -30,6 +31,7 @@ func TestGetBook_NoUserBook(t *testing.T) {
|
||||
dto.BookGet{
|
||||
Title: "De sang-froid",
|
||||
Author: "Truman Capote",
|
||||
AuthorID: 14,
|
||||
Read: false,
|
||||
CoverPath: "/bookcover/desangfroid.jpg",
|
||||
}, book)
|
||||
@@ -41,6 +43,7 @@ func TestGetBook_Description(t *testing.T) {
|
||||
dto.BookGet{
|
||||
Title: "Le complot contre l'Amérique",
|
||||
Author: "Philip Roth",
|
||||
AuthorID: 17,
|
||||
ISBN: "9782070337903",
|
||||
Summary: "Lorsque le célèbre aviateur Charles Lindbergh battit le président Roosevelt aux élections présidentielles de 1940, la peur s'empara des Juifs américains. Non seulement Lindbergh avait, dans son discours radiophonique à la nation, reproché aux Juifs de pousser l'Amérique à entreprendre une guerre inutile avec l'Allemagne nazie, mais, en devenant trente-troisième président des États-Unis, il s'empressa de signer un pacte de non-agression avec Hitler. Alors la terreur pénétra dans les foyers juifs, notamment dans celui de la famille Roth. Ce contexte sert de décor historique au Complot contre l'Amérique, un roman où Philip Roth, qui avait sept ans à l'époque, raconte ce que vécut et ressentit sa famille - et des millions de familles semblables dans tout le pays - lors des lourdes années où s'exerça la présidence de Lindbergh, quand les citoyens américains qui étaient aussi des Juifs avaient de bonnes raisons de craindre le pire. Ce faisant, il nous offre un nouveau chef-d'oeuvre.",
|
||||
Rating: 6,
|
||||
|
||||
@@ -3,6 +3,7 @@ package dto
|
||||
type BookGet 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"`
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
func FetchBookGet(db *gorm.DB, userId uint, bookId uint64) (dto.BookGet, error) {
|
||||
var book dto.BookGet
|
||||
query := db.Model(&model.Book{})
|
||||
selectQueryString := "books.title, authors.name as author, 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.summary, " +
|
||||
"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