mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Refactoring Collections, and getting docker ready.
This commit is contained in:
3
src/backend/lib/models.py
vendored
3
src/backend/lib/models.py
vendored
@@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated
|
||||
from sqlalchemy import func, ForeignKey
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
||||
import datetime
|
||||
|
||||
@@ -42,4 +42,3 @@ class Collection(Base):
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
collection: Mapped[str]
|
||||
book_id: Mapped[int] = mapped_column(ForeignKey(Book.id))
|
||||
|
||||
4
src/backend/lib/storage.py
vendored
4
src/backend/lib/storage.py
vendored
@@ -86,7 +86,8 @@ class Storage:
|
||||
cover_image = None
|
||||
if not book[1]:
|
||||
pass
|
||||
collections = self.parse_collections_from_path(book)
|
||||
# collections = self.parse_collections_from_path(book)
|
||||
# breakpoint()
|
||||
_book = Book(
|
||||
title=book[0],
|
||||
author=book[1],
|
||||
@@ -173,6 +174,7 @@ class Storage:
|
||||
_q = _sess.execute(
|
||||
select(Collection.id).where(
|
||||
Collection.collection == _s,
|
||||
# BUG: book.id is not the correct identifier.
|
||||
Collection.book_id == book.id,
|
||||
)
|
||||
)
|
||||
|
||||
17
src/frontend/lib/objects.py
vendored
17
src/frontend/lib/objects.py
vendored
@@ -1,6 +1,4 @@
|
||||
"""pyShelf's Frontend Objects."""
|
||||
from sys import exit
|
||||
from shutil import which
|
||||
from subprocess import run
|
||||
from pathlib import Path
|
||||
from ...backend.lib.config import Config
|
||||
@@ -16,16 +14,5 @@ class JSInterface():
|
||||
|
||||
def install(self):
|
||||
"""Install the JavaScript dependencies."""
|
||||
if which("npm"):
|
||||
self.config.logger.info("Installing JavaScript dependencies...")
|
||||
run(["npm", "install"], cwd=self.package_json.parent)
|
||||
|
||||
else:
|
||||
self.config.logger.error("npm is not installed.")
|
||||
exit(1)
|
||||
if which("npx"):
|
||||
self.config.logger.info("Compiling TypeScript...")
|
||||
run(["npx", "tsc", "static/script/pyshelf.ts"], cwd=self.package_json.parent)
|
||||
else:
|
||||
self.config.logger.error("npx is not installed.")
|
||||
exit(1)
|
||||
run(["npm", "install"], cwd=self.package_json.parent)
|
||||
run(["npx", "tsc", "static/script/pyshelf.ts"], cwd=self.package_json.parent)
|
||||
|
||||
Reference in New Issue
Block a user