remove onloan column
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
David 2022-05-07 15:35:07 -04:00
parent 2814c5dc68
commit e8388b979c
8 changed files with 7 additions and 39 deletions

View File

@ -0,0 +1 @@
ALTER TABLE books DROP COLUMN onloan;

View File

@ -155,7 +155,7 @@ func (m *MySQL) GetAllBooks(ctx context.Context) ([]media.Book, error) {
allBooksQuery := fmt.Sprintf(`SELECT allBooksQuery := fmt.Sprintf(`SELECT
id, title, authors, sortauthor, isbn10, isbn13, format, id, title, authors, sortauthor, isbn10, isbn13, format,
genre, publisher, series, volume, year, signed, genre, publisher, series, volume, year, signed,
description, notes, onloan, coverurl description, notes, coverurl
FROM %s`, m.tableName) FROM %s`, m.tableName)
books := []media.Book{} books := []media.Book{}
@ -174,7 +174,7 @@ func (m *MySQL) GetAllBooks(ctx context.Context) ([]media.Book, error) {
&b.Format, &b.Genre, &b.Publisher, &b.Format, &b.Genre, &b.Publisher,
&b.Series, &b.Volume, &b.Year, &b.Series, &b.Volume, &b.Year,
&b.Signed, &b.Description, &b.Notes, &b.Signed, &b.Description, &b.Notes,
&b.OnLoan, &b.CoverURL) &b.CoverURL)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -192,9 +192,9 @@ func (m *MySQL) AddBook(ctx context.Context, b *media.Book) error {
res, err := m.connection.ExecContext(ctx, ` res, err := m.connection.ExecContext(ctx, `
INSERT INTO `+m.tableName+` INSERT INTO `+m.tableName+`
(title, authors, sortauthor, isbn10, isbn13, format, genre, publisher, series, volume, year, signed, description, notes, onloan, coverurl) (title, authors, sortauthor, isbn10, isbn13, format, genre, publisher, series, volume, year, signed, description, notes, coverurl)
VALUES VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
b.Title, b.Title,
strings.Join(b.Authors, ";"), strings.Join(b.Authors, ";"),
b.SortAuthor, b.SortAuthor,
@ -209,7 +209,6 @@ func (m *MySQL) AddBook(ctx context.Context, b *media.Book) error {
b.Signed, b.Signed,
b.Description, b.Description,
b.Notes, b.Notes,
b.OnLoan,
b.CoverURL, b.CoverURL,
) )
if err != nil { if err != nil {
@ -250,7 +249,6 @@ func (m *MySQL) UpdateBook(ctx context.Context, old, new *media.Book) error {
signed=? signed=?
description=? description=?
notes=? notes=?
onloan=?
coverurl=? coverurl=?
WHERE id=?`, WHERE id=?`,
new.Title, new.Title,
@ -267,7 +265,6 @@ func (m *MySQL) UpdateBook(ctx context.Context, old, new *media.Book) error {
new.Signed, new.Signed,
new.Description, new.Description,
new.Notes, new.Notes,
new.OnLoan,
new.CoverURL, new.CoverURL,
old.ID) old.ID)
if err != nil { if err != nil {

View File

@ -127,7 +127,6 @@ function BookTemplate({
description, description,
format, format,
notes, notes,
onLoan,
publisher, publisher,
series, series,
signed, signed,
@ -136,7 +135,7 @@ function BookTemplate({
year, year,
}) { }) {
return `${coverURL ? `<img src="${coverURL}"/>` : ""} return `${coverURL ? `<img src="${coverURL}"/>` : ""}
<h1 ${onLoan ? "class='onLoan' " : ""}>${title}</h1> <h1>${title}</h1>
<h2>${authors}</h2> <h2>${authors}</h2>
<span>${isbn13}</span><br/> <span>${isbn13}</span><br/>
<span>${publisher}, ${year}</span><br/> <span>${publisher}, ${year}</span><br/>
@ -147,7 +146,6 @@ function BookTemplate({
} }
${signed ? "<span>Signed by the author ✒</span><br/>" : ""} ${signed ? "<span>Signed by the author ✒</span><br/>" : ""}
<span>${format}</span> <span>${format}</span>
${onLoan ? `<h2 class="onLoan">On loan to ${onLoan}</h2>` : ""}
<div class="description"> <div class="description">
<p>${description}</p> <p>${description}</p>
${notes ? `<span>Notes:</span><p>${notes}</p>` : ""} ${notes ? `<span>Notes:</span><p>${notes}</p>` : ""}
@ -157,14 +155,13 @@ function BookTemplate({
function TableRowTemplate({ function TableRowTemplate({
"isbn-13": isbn13, "isbn-13": isbn13,
authors, authors,
onLoan,
publisher, publisher,
rowNumber, rowNumber,
signed, signed,
title, title,
year, year,
}) { }) {
return `<tr class="tRow ${onLoan ? "onLoan" : ""}" id="${rowNumber}"> return `<tr class="tRow id="${rowNumber}">
<td class="title"> <td class="title">
${title} ${ ${title} ${
signed ? '<span class="signed" title="Signed by the author" >✒</span>' : "" signed ? '<span class="signed" title="Signed by the author" >✒</span>' : ""

View File

@ -243,10 +243,6 @@ body {
cursor: pointer; cursor: pointer;
} }
.recordTable .onLoan {
color: #bbb;
}
.recordTable .tRow .name { .recordTable .tRow .name {
font-style: italic; font-style: italic;
max-width: 600px; max-width: 600px;
@ -274,11 +270,3 @@ body {
#current .description p { #current .description p {
padding: 20px 0; padding: 20px 0;
} }
#current h1.onLoan {
color: #bbb;
}
#current h2.onLoan {
font-weight: bold;
}

View File

@ -243,10 +243,6 @@ body {
cursor: pointer; cursor: pointer;
} }
.bookTable .onLoan {
color: #bbb;
}
.bookTable .tRow .title { .bookTable .tRow .title {
font-style: italic; font-style: italic;
max-width: 600px; max-width: 600px;
@ -274,11 +270,3 @@ body {
#current .description p { #current .description p {
padding: 20px 0; padding: 20px 0;
} }
#current h1.onLoan {
color: #bbb;
}
#current h2.onLoan {
font-weight: bold;
}

View File

@ -40,7 +40,6 @@ func CSVToBooks(r io.Reader) ([]media.Book, error) {
Signed: row[hmap["signed"]] == "yes", // convert from known string to bool Signed: row[hmap["signed"]] == "yes", // convert from known string to bool
Description: row[hmap["description"]], Description: row[hmap["description"]],
Notes: row[hmap["notes"]], Notes: row[hmap["notes"]],
OnLoan: row[hmap["onloan"]],
CoverURL: row[hmap["coverurl"]], CoverURL: row[hmap["coverurl"]],
} }
books = append(books, b) books = append(books, b)

View File

@ -16,7 +16,6 @@ type Book struct {
Signed bool `json:"signed"` Signed bool `json:"signed"`
Description string `json:"description"` Description string `json:"description"`
Notes string `json:"notes"` Notes string `json:"notes"`
OnLoan string `json:"onLoan"`
CoverURL string `json:"coverURL"` CoverURL string `json:"coverURL"`
} }

View File

@ -404,7 +404,6 @@ func (l *BookDetails) Draw(s tcell.Screen) {
{"Volume", l.book.Volume}, {"Volume", l.book.Volume},
{"Year", l.book.Year}, {"Year", l.book.Year},
{"Signed", strconv.FormatBool(l.book.Signed)}, {"Signed", strconv.FormatBool(l.book.Signed)},
{"On Loan", l.book.OnLoan},
{"Cover URL", l.book.CoverURL}, {"Cover URL", l.book.CoverURL},
{"Notes", l.book.Notes}, {"Notes", l.book.Notes},
{"Description", l.book.Description}, {"Description", l.book.Description},