Compare commits
88 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f75dd3a9fb | |||
| f9b7e20841 | |||
| b0cc5f0cd1 | |||
| 8706b3880f | |||
| 0750621b96 | |||
| 2aeba70906 | |||
| ab166fc075 | |||
| 4c681c33dc | |||
| 72c08f9731 | |||
| 9ab4f2103f | |||
| 2889927416 | |||
| 05555a7750 | |||
| 74cda6c72d | |||
| 8ef3e201d6 | |||
| b3530cec7b | |||
| 1776d5faa6 | |||
| fffcdc4724 | |||
| b3b143cd3f | |||
| cdd0276020 | |||
| a20eb43889 | |||
| 61683f643a | |||
| d5705c3a28 | |||
| 2e80cd9b0e | |||
| d5f71efe5e | |||
| b897772ea1 | |||
| 2e3e667e6c | |||
| 4c603a8eff | |||
| f5e9cbc423 | |||
| 58b26304ae | |||
| 0c5013f4a8 | |||
| bc88c694ee | |||
| 7116869b42 | |||
| 094dffb1c7 | |||
| 980eda29af | |||
| 32f3f034eb | |||
| e811fda863 | |||
| dea3c3d36a | |||
| 56d2434097 | |||
| 8c9850d4b1 | |||
| 570ae71aba | |||
| e1b5691fac | |||
| bce0bc2989 | |||
| a5493e6c11 | |||
| b524c3b14a | |||
| d9007ba0e4 | |||
| ea648082be | |||
| 4aaf580735 | |||
| f5abb44466 | |||
| 914e1214de | |||
| f912dcb670 | |||
| c848758821 | |||
| 2d6fa7b7ee | |||
| f0f1819a1f | |||
| 131296c644 | |||
| ba83d70764 | |||
| a0ad4e5c26 | |||
| 6b5167a5c0 | |||
| 044da5353a | |||
| f2f4a0aaf6 | |||
| 652aa3005b | |||
| ad09386a7a | |||
| 8f5a384e89 | |||
| c1d913e36b | |||
| 8a5bc7873a | |||
| 0ad1969614 | |||
| d80aefe6b2 | |||
| 652378e7de | |||
| 57b942a9ca | |||
| bda453a92a | |||
| a113f08ddc | |||
| cc631a14ed | |||
| 9476d8853e | |||
| 8cc58aed5b | |||
| ec274a60d9 | |||
| 5b7c41c829 | |||
| f73ec33aeb | |||
| cdde57e033 | |||
| 9d07ed9bfb | |||
| 59e705d012 | |||
| 3b50a94928 | |||
| fd5bb14e77 | |||
| a786607608 | |||
| 031d71406c | |||
| 48149b67cf | |||
| 9f0a0c1d1e | |||
| 7555cfd51d | |||
| ea038ec70c | |||
| ecfa0eb6d8 |
@@ -0,0 +1,19 @@
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} ist testing out Gitea Actions
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop/0.4.0
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: inky
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- name: List files in the directory
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}/kontor-gin
|
||||
go build -o /home/tpeetz/prod/kontor cmd/kontor/main.go
|
||||
- name: List files in the directory
|
||||
run: echo "The job's status is ${{ job.status }}."
|
||||
@@ -11,3 +11,4 @@ kontor-robyn.bak
|
||||
kontor-robyn.bak2
|
||||
kontor-data/.gradle
|
||||
kontor-data/build/
|
||||
/kontor-api/kontor-api.code-workspace
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
# Posted by barth, modified by community. See post 'Timeline' for change history
|
||||
# Retrieved 2026-08-19, License - CC BY-SA 4.0
|
||||
NEXUS_URL=https://nexus.thpeetz.de
|
||||
MAVEN_REPO=maven-snapshots
|
||||
GROUP_ID=de.thpeetz
|
||||
ARTIFACT_ID=kontor-spring
|
||||
VERSION=0.4.0
|
||||
FILE_EXTENSION=jar
|
||||
|
||||
download_url=$(curl -X GET "${NEXUS_URL}/service/rest/v1/search/assets?repository=${MAVEN_REPO}&maven.groupId=${GROUP_ID}&maven.artifactId=${ARTIFACT_ID}&maven.baseVersion=${VERSION}&maven.extension=${FILE_EXTENSION}" -H "accept: application/json" | jq -rc '.items | .[].downloadUrl' | sort | tail -n 1)
|
||||
wget $download_url
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
/gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.jar binary
|
||||
@@ -1,37 +0,0 @@
|
||||
HELP.md
|
||||
.gradle
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
@@ -1,51 +0,0 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '4.0.7'
|
||||
id 'io.spring.dependency-management' version '1.1.7'
|
||||
alias(libs.plugins.lombok)
|
||||
}
|
||||
|
||||
group = 'de.thpeetz.kontor'
|
||||
version = '0.3.0-SNAPSHOT'
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { setUrl("https://repo.spring.io/milestone") }
|
||||
}
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom libs.camel.bom.get().toString()
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-artemis'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'org.apache.camel.springboot:camel-spring-boot-starter:4.20.0'
|
||||
implementation 'org.apache.camel.springboot:camel-jms-starter'
|
||||
implementation 'io.micrometer:micrometer-registry-prometheus'
|
||||
implementation 'org.apache.activemq:artemis-jakarta-client'
|
||||
implementation 'org.postgresql:postgresql'
|
||||
implementation libs.jackson
|
||||
implementation libs.gson
|
||||
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
testImplementation 'org.apache.camel:camel-test-spring-junit5'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-artemis-test'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
[versions]
|
||||
gradle = "8.6"
|
||||
args4j = "2.33"
|
||||
commonscli = "1.5.0"
|
||||
junit = "5.8.2"
|
||||
logback = "1.1.2"
|
||||
mockito = "1.9.5"
|
||||
picoli = "4.7.0"
|
||||
slf4j = "1.7.22"
|
||||
hsqldb = "2.7.1"
|
||||
sqlite = "3.25.2"
|
||||
spotbugs = "6.0.7"
|
||||
asciidoctor = "4.0.2"
|
||||
rouge = "3.15.0"
|
||||
#diagram = "2.2.2"
|
||||
diagram = "2.3.1"
|
||||
sonarqube = "3.3"
|
||||
cimtConventions = "1.0.0-SNAPSHOT"
|
||||
springboot = "3.2.5"
|
||||
springdependencies = "1.1.4"
|
||||
vaadin = "24.3.8"
|
||||
camel = "4.10.6"
|
||||
artemis = "2.41.0"
|
||||
lombok = "8.6"
|
||||
gson = "2.9.0"
|
||||
jackson = "2.16.1"
|
||||
json_simple = "1.1.1"
|
||||
mail = "1.6.2"
|
||||
hypersistence = "3.9.10"
|
||||
|
||||
[libraries]
|
||||
args4j = { module = "args4j:args4j", version.ref = "args4j" }
|
||||
commonscli = { module = "commons-cli:commons-cli", version.ref = "commonscli" }
|
||||
junit = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
|
||||
logbackCore = { module = "ch.qos.logback:logback-core", version.ref = "logback" }
|
||||
logbackClassic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
|
||||
mockito = { module = "org.mockito:mockito-all", version.ref = "mockito" }
|
||||
picocli = { module = "info.picocli:picocli", version.ref = "picoli" }
|
||||
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
|
||||
hsqldb = { module = "org.hsqldb:hsqldb", version.ref = "hsqldb" }
|
||||
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
|
||||
jackson = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
|
||||
json = { module = "com.googlecode.json-simple:json-simple", version.ref ="json_simple" }
|
||||
mail = { module = "com.sun.mail:javax.mail", version.ref ="mail" }
|
||||
sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version.ref = "sqlite" }
|
||||
hypersistence = { module = "io.hypersistence:hypersistence-utils-hibernate-63", version.ref = "hypersistence" }
|
||||
vaadin-bom = { module = "com.vaadin:vaadin-bom", version.ref = "vaadin" }
|
||||
camel-bom = { module = "org.apache.camel.springboot:camel-spring-boot-bom", version.ref = "camel"}
|
||||
artemis = { module = "org.apache.activemq:artemis-jms-server", version.ref = "artemis" }
|
||||
asciidoctorGradleJvmGems = { module = "org.asciidoctor:asciidoctor-gradle-jvm-gems", version.ref= "asciidoctor" }
|
||||
asciidoctorGradleJvm = { module = "org.asciidoctor:asciidoctor-gradle-jvm", version.ref= "asciidoctor" }
|
||||
asciidoctorGradleJvmPdf = { module = "org.asciidoctor:asciidoctor-gradle-jvm-pdf", version.ref= "asciidoctor" }
|
||||
rouge = { module = "rubygems:rouge", version.ref = "rouge" }
|
||||
diagram = { module = "rubygems:asciidoctor-diagram", version.ref = "diagram" }
|
||||
|
||||
[bundles]
|
||||
logback = ["logbackCore", "logbackClassic"]
|
||||
|
||||
[plugins]
|
||||
spotbugs = { id = "com.github.spotbugs", version.ref = "spotbugs" }
|
||||
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }
|
||||
asciidoctorPdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor" }
|
||||
asciidoctorConvert = { id = "org.asciidoctor.jvm.convert", version.ref = "asciidoctor" }
|
||||
asciidoctorGems = { id = "org.asciidoctor.jvm.gems", version.ref = "asciidoctor" }
|
||||
javaConvention = { id = "de.cimt.java-conventions", version.ref = "cimtConventions" }
|
||||
applicationConvention = { id = "de.cimt.application-conventions", version.ref = "cimtConventions" }
|
||||
libraryConvention = { id = "de.cimt.library-conventions", version.ref = "cimtConventions" }
|
||||
asciidoctorConvention = { id = "de.cimt.asciidoctor-conventions", version.ref = "cimtConventions" }
|
||||
spring-boot = { id = "org.springframework.boot", version.ref = "springboot"}
|
||||
spring-dependencies = { id = "io.spring.dependency-management", version.ref = "springdependencies" }
|
||||
vaadin = { id = "com.vaadin", version.ref = "vaadin" }
|
||||
lombok = { id = "io.freefair.lombok", version.ref = "lombok" }
|
||||
BIN
Binary file not shown.
@@ -1,9 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
Vendored
-248
@@ -1,248 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
-82
@@ -1,82 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
@@ -1 +0,0 @@
|
||||
rootProject.name = 'integration'
|
||||
@@ -1,13 +0,0 @@
|
||||
package de.thpeetz.kontor.integration;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class IntegrationApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(IntegrationApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package de.thpeetz.kontor.integration.routes;
|
||||
|
||||
import de.thpeetz.kontor.integration.services.AddLinkProcessor;
|
||||
import de.thpeetz.kontor.media.services.MediaFileService;
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class AddLinkFromQueue extends RouteBuilder {
|
||||
|
||||
@Autowired
|
||||
private final MediaFileService mediaFileService;
|
||||
|
||||
@Autowired
|
||||
public AddLinkFromQueue(MediaFileService mediaFileService) {
|
||||
this.mediaFileService = mediaFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("jms:queue:add_link_file")
|
||||
.routeId("read-queue-add-link_file")
|
||||
.log("${body}")
|
||||
.process(new AddLinkProcessor(mediaFileService))
|
||||
.to("jms:queue:update_title");
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package de.thpeetz.kontor.integration.routes;
|
||||
import de.thpeetz.kontor.media.services.MediaFileService;
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class QueueMediaLinkAdd extends RouteBuilder {
|
||||
|
||||
@Autowired
|
||||
private final MediaFileService mediaFileService;
|
||||
|
||||
@Autowired
|
||||
public QueueMediaLinkAdd(MediaFileService mediaFileService) {
|
||||
this.mediaFileService = mediaFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("jms:queue:media.link.add")
|
||||
.routeId("read-queue-media-link-add")
|
||||
.log("${body}")
|
||||
.to("jms:queue:media.link.add.processed");
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package de.thpeetz.kontor.integration.routes;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import de.thpeetz.kontor.media.services.MediaFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class QueueMediaLoFiAdd extends RouteBuilder {
|
||||
|
||||
@Autowired
|
||||
private final MediaFileService mediaFileService;
|
||||
|
||||
@Autowired
|
||||
public QueueMediaLoFiAdd(MediaFileService mediaFileService) {
|
||||
this.mediaFileService = mediaFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("jms:queue:media.lofi.add")
|
||||
.routeId("read-queue-media-lofi-add")
|
||||
.log("${body}")
|
||||
.to("jms:queue:media.lofi.add.processed");
|
||||
}
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package de.thpeetz.kontor.integration.routes;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import de.thpeetz.kontor.media.services.MediaFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class QueueMediaVideoAdd extends RouteBuilder {
|
||||
|
||||
@Autowired
|
||||
private final MediaFileService mediaFileService;
|
||||
|
||||
@Autowired
|
||||
public QueueMediaVideoAdd(MediaFileService mediaFileService) {
|
||||
this.mediaFileService = mediaFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("jms:queue:media.video.add")
|
||||
.routeId("read-queue-media-video-add")
|
||||
.log("${body}")
|
||||
.to("jms:queue:media.video.add.processed");
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package de.thpeetz.kontor.integration.routes;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ReadQueueRoute extends RouteBuilder {
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("jms:queue:KontorMediaFile")
|
||||
.routeId("add-link-from-queue")
|
||||
.trace(true)
|
||||
.log(">>> ${body}");
|
||||
}
|
||||
}
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
package de.thpeetz.kontor.integration.services;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import de.thpeetz.kontor.media.data.MediaFile;
|
||||
import de.thpeetz.kontor.media.services.MediaFileService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.camel.Exchange;
|
||||
import org.apache.camel.Processor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class AddLinkProcessor implements Processor {
|
||||
|
||||
private final MediaFileService mediaFileService;
|
||||
|
||||
public AddLinkProcessor(MediaFileService mediaFileService) {
|
||||
this.mediaFileService = mediaFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(Exchange exchange) throws Exception {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
HashMap<String, String> myMap = objectMapper.readValue(exchange.getIn().getBody().toString(),
|
||||
new TypeReference<HashMap<String, String>>() {
|
||||
});
|
||||
String url = myMap.get("url");
|
||||
log.info("found url: {}", url);
|
||||
MediaFile mediaFile = mediaFileService.findAllMediaFilesByUrl(url);
|
||||
if (mediaFile == null) {
|
||||
log.info("URL not found, create MediaFile");
|
||||
mediaFile = new MediaFile();
|
||||
mediaFile.setUrl(url);
|
||||
mediaFile.setPath("");
|
||||
mediaFile.setCloudLink("");
|
||||
mediaFile.setFileName("");
|
||||
mediaFile.setTitle("");
|
||||
mediaFile.setReview(true);
|
||||
mediaFile.setShouldDownload(true);
|
||||
MediaFile mediaFileResult = mediaFileService.saveMediaFile(mediaFile);
|
||||
log.info("created MediaFile with {}", mediaFileResult.getId());
|
||||
exchange.getMessage().getHeaders().put("mediafile_id", mediaFileResult.getId());
|
||||
} else {
|
||||
log.info("found MediaFile with {}", mediaFile.getId());
|
||||
exchange.getMessage().getHeaders().put("mediafile_id", mediaFile.getId());
|
||||
}
|
||||
log.info("found MediaFile: {}", mediaFile);
|
||||
Map<String, Object> map = exchange.getMessage().getHeaders();
|
||||
log.info("Headers: {}", map);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package de.thpeetz.kontor.integration.services;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AddLinkService {
|
||||
|
||||
public void fromQueue(String messageBody) throws JsonProcessingException {
|
||||
log.info("get body: {}", messageBody);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
HashMap<String,String> myMap = objectMapper.readValue(messageBody, new TypeReference<HashMap<String,String>>() {});
|
||||
String url = myMap.get("url");
|
||||
log.info("found url: {}", url);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
spring:
|
||||
application:
|
||||
name: integration
|
||||
server:
|
||||
port:
|
||||
8110
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package de.thpeetz.kontor.integration;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class IntegrationApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# script/cibuild:
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
source version
|
||||
|
||||
echo " => Baue Image localhost/kontor-angular:$kontorVersion"
|
||||
buildah build -t kontor-angular:$kontorVersion kontor-angular
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
## ------------------------------- Builder Stage ------------------------------ ##
|
||||
FROM python:3.13-bookworm AS builder
|
||||
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y build-essential && \
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y build-essential libpq-dev && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Download the latest installer, install it and then remove it
|
||||
@@ -14,13 +14,12 @@ ENV PATH="/root/.local/bin:${PATH}"
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./pyproject.toml .
|
||||
|
||||
RUN uv sync
|
||||
|
||||
# ------------------------------- Production Stage ------------------------------ ##
|
||||
FROM python:3.13-slim-bookworm AS production
|
||||
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y curl
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y curl libpq-dev
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# script/cibuild:
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
source version
|
||||
|
||||
echo " => Baue Image localhost/kontor-api:$kontorVersion"
|
||||
buildah build -t kontor-api:$kontorVersion kontor-api
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "kontor-api"
|
||||
version = "0.1.0"
|
||||
version = "0.4.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
@@ -15,7 +15,6 @@ dependencies = [
|
||||
"pytest==7.4.0",
|
||||
"pyyaml>=6.0.2",
|
||||
"requests>=2.32.3",
|
||||
"sqlalchemy>=2.0.40",
|
||||
"sqlmodel>=0.0.24",
|
||||
"python-dotenv>=1.1.0",
|
||||
"python-jose[cryptography]>=3.4.0",
|
||||
@@ -24,10 +23,12 @@ dependencies = [
|
||||
"psycopg2-binary>=2.9.10",
|
||||
"pytest-cov>=6.1.1",
|
||||
"databases[sqlite]>=0.9.0",
|
||||
"pydantic[email]>=2.11.3",
|
||||
"jinja2>=3.1.6",
|
||||
"asyncpg>=0.30.0",
|
||||
"bcrypt>=4.3.0",
|
||||
"fastapi-jwt-auth>=0.5.0",
|
||||
"msgspec[toml,yaml]>=0.21.1",
|
||||
"sqlalchemy>=2.0.52",
|
||||
"pydantic[email]>=2.13.4",
|
||||
"psycopg>=3.3.6",
|
||||
]
|
||||
|
||||
@@ -18,6 +18,7 @@ from src.apis.version1.comics import (
|
||||
from src.apis.version1.media import (
|
||||
actor,
|
||||
file,
|
||||
lofi,
|
||||
mediaactorfile,
|
||||
mediavideo,
|
||||
mediaarticle,
|
||||
@@ -104,6 +105,12 @@ api_router.include_router(
|
||||
tags=["media"],
|
||||
dependencies=[Depends(get_current_user_from_token)],
|
||||
)
|
||||
api_router.include_router(
|
||||
lofi.router,
|
||||
prefix="/media",
|
||||
tags=["media"],
|
||||
dependencies=[Depends(get_current_user_from_token)],
|
||||
)
|
||||
api_router.include_router(
|
||||
mediaarticle.router,
|
||||
prefix="/media",
|
||||
|
||||
@@ -4,7 +4,12 @@ from fastapi import APIRouter, status, HTTPException
|
||||
from src.core.log_conf import logger
|
||||
from src.db.repository.media.actor import delete_mediaactor, import_mediaactor
|
||||
from src.db.session import SessionDep
|
||||
from src.schema.media.actor import MediaActorModel, MediaActorResponse, actor_to_response
|
||||
from src.schema.media.actor import (
|
||||
MediaActorModel,
|
||||
MediaActorResponse,
|
||||
actor_to_response,
|
||||
actor_to_model
|
||||
)
|
||||
from src.db.models.media import MediaActor
|
||||
|
||||
router = APIRouter()
|
||||
@@ -26,6 +31,23 @@ def get_actor(actor_id: str, db: SessionDep) -> MediaActorResponse:
|
||||
response = actor_to_response(media_actor)
|
||||
return response
|
||||
|
||||
@router.put("/actors/{actor_id}", response_model=MediaActorResponse)
|
||||
def update_actor(actor_id: str, db:SessionDep, info: MediaActorResponse) -> MediaActorResponse:
|
||||
"""
|
||||
Update MediaActor with given id and data.
|
||||
"""
|
||||
media_actor = db.get(MediaActor, actor_id)
|
||||
if not media_actor:
|
||||
raise HTTPException(status_code=404, detail="MediaActor could not be found")
|
||||
actor_to_model(info, media_actor)
|
||||
db.add(media_actor)
|
||||
db.commit()
|
||||
mediaactor = db.get(MediaActor, actor_id)
|
||||
if not mediaactor:
|
||||
raise HTTPException(status_code=404, detail="MediaActor could not be found")
|
||||
response = actor_to_response(mediaactor)
|
||||
return response
|
||||
|
||||
@router.delete("/actors/{actor_id}", status_code=status.HTTP_204_NO_CONTENT)
|
||||
def delete_actor(actor_id: str, db: SessionDep):
|
||||
media_actor = db.get(MediaActor, actor_id)
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, status, HTTPException
|
||||
|
||||
from src.db.models.media import MediaLofi
|
||||
from src.db.session import SessionDep
|
||||
from src.core.log_conf import logger
|
||||
from src.schema.media.lofi import (
|
||||
MediaLofiModel,
|
||||
MediaLofiResponse,
|
||||
lofi_to_response,
|
||||
lofi_to_model
|
||||
)
|
||||
from src.db.repository.media.lofi import (
|
||||
import_medialofi,
|
||||
delete_medialofi
|
||||
)
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/lofi", response_model=List[MediaLofiResponse])
|
||||
def get_all_lofis(
|
||||
db: SessionDep, review: bool = False, download: bool = False
|
||||
) -> List[MediaLofiResponse]:
|
||||
"""
|
||||
Get all MediaLofis.
|
||||
"""
|
||||
results: List[MediaLofiResponse] = []
|
||||
lofis: List[MediaLofi]
|
||||
if review:
|
||||
lofis = db.query(MediaLofi).filter(MediaLofi.review.is_(True)).all()
|
||||
elif download:
|
||||
lofis = db.query(MediaLofi).filter(MediaLofi.should_download.is_(True)).all()
|
||||
else:
|
||||
lofis = db.query(MediaLofi).all()
|
||||
for medialofi in lofis:
|
||||
response = lofi_to_response(medialofi)
|
||||
results.append(response)
|
||||
return results
|
||||
|
||||
@router.get("/lofi/{lofi_id}", response_model=MediaLofiResponse)
|
||||
def get_lofi(lofi_id: str, db: SessionDep) -> MediaLofiResponse:
|
||||
"""
|
||||
Get MediaLofi by id.
|
||||
"""
|
||||
lofi = db.get(MediaLofi, lofi_id)
|
||||
if lofi is None:
|
||||
raise HTTPException(status_code=404, detail="MediaLofi could not be found")
|
||||
response = lofi_to_response(lofi)
|
||||
return response
|
||||
|
||||
@router.delete("/lofi/{lofi_id}", status_code=status.HTTP_204_NO_CONTENT)
|
||||
def delete_lofi(lofi_id: str, db: SessionDep):
|
||||
"""
|
||||
Delete MediaFile by given id.
|
||||
"""
|
||||
lofi = db.get(MediaLofi, lofi_id)
|
||||
if not lofi:
|
||||
raise HTTPException(status_code=404, detail="MediaLofi could not be found")
|
||||
logger.info("delete MediaLofi: %s", lofi_id)
|
||||
delete_medialofi(db=db, lofi_id=lofi.id)
|
||||
|
||||
@router.put("/lofi/{lofi_id}", response_model=MediaLofiResponse)
|
||||
def update_lofi(lofi_id: str, db: SessionDep, info: MediaLofiResponse) -> MediaLofiResponse:
|
||||
"""
|
||||
Update MediaLofi with given id and data.
|
||||
"""
|
||||
media_lofi = db.get(MediaLofi, lofi_id)
|
||||
if not media_lofi:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="MediaLofi could not be found")
|
||||
lofi_to_model(info, media_lofi)
|
||||
db.add(media_lofi)
|
||||
db.commit()
|
||||
media_lofi = db.get(MediaLofi, lofi_id)
|
||||
if not media_lofi:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="MediaLofi could not be found")
|
||||
response = lofi_to_response(media_lofi)
|
||||
return response
|
||||
|
||||
|
||||
@router.post("/lofi", status_code=status.HTTP_201_CREATED)
|
||||
def add_lofi(new_lofi: MediaLofiModel, db: SessionDep) -> MediaLofiResponse:
|
||||
logger.info("add medialofi %s", new_lofi)
|
||||
try:
|
||||
medialofi: MediaLofi = import_medialofi(db, new_lofi)
|
||||
except:
|
||||
raise HTTPException(status_code=409, detail="MediaLofi duplicate")
|
||||
response = lofi_to_response(medialofi)
|
||||
return response
|
||||
@@ -9,17 +9,21 @@ load_dotenv(dotenv_path=env_path)
|
||||
|
||||
class Settings:
|
||||
PROJECT_NAME: str = "Kontor"
|
||||
PROJECT_VERSION: str = "0.3.0"
|
||||
PROJECT_VERSION: str = "0.4.0"
|
||||
|
||||
DB_USER: str = os.getenv("DB_USER", "kontor")
|
||||
DB_PASSWORD: str = os.getenv("DB_PASSWORD", "kontor")
|
||||
DB_SERVER: str = os.getenv("DB_SERVER", "postgres")
|
||||
DB_PORT: int = int(os.getenv("DB_PORT", 5432))
|
||||
DB_DBNAME: str = os.getenv("DB_DBNAME", "kontor")
|
||||
DATABASE_URL: str = f"postgresql://{DB_USER}:{DB_PASSWORD}@{DB_SERVER}:{DB_PORT}/{DB_DBNAME}"
|
||||
SECRET_KEY: str = os.getenv("SECRET_KEY", "J6GOtcwC2NJI1l0VkHu20PacPFGTxpirBxWwynoHjsc=")
|
||||
DATABASE_URL: str = (
|
||||
f"postgresql://{DB_USER}:{DB_PASSWORD}@{DB_SERVER}:{DB_PORT}/{DB_DBNAME}"
|
||||
)
|
||||
SECRET_KEY: str = os.getenv(
|
||||
"SECRET_KEY", "J6GOtcwC2NJI1l0VkHu20PacPFGTxpirBxWwynoHjsc="
|
||||
)
|
||||
ALGORITHM = "HS256"
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES = 60*24*7 # one week in mins
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES = 60 * 24 * 7 # one week in mins
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ async def get_current_user(
|
||||
async def get_current_active_user(
|
||||
current_user: Annotated[Profile, Security(get_current_user, scopes=["me"])],
|
||||
) -> ProfileModel:
|
||||
if not current_user.enabled:
|
||||
if not bool(current_user.enabled):
|
||||
raise HTTPException(status_code=400, detail="Inactive user")
|
||||
user_model = to_model(current_user)
|
||||
return user_model
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
from typing import Any, Dict
|
||||
from src.db.models.admin import (
|
||||
Assignment,
|
||||
Token,
|
||||
Profile,
|
||||
Permission,
|
||||
MailAccount,
|
||||
Mail,
|
||||
)
|
||||
from src.db.models.bookshelf import (
|
||||
ArticleAuthor,
|
||||
BookAuthor,
|
||||
BookshelfPublisher,
|
||||
Article,
|
||||
Book,
|
||||
Author,
|
||||
)
|
||||
from src.db.models.comic import (
|
||||
Issue,
|
||||
StoryArc,
|
||||
TradePaperback,
|
||||
Volume,
|
||||
ComicWork,
|
||||
IssueWork,
|
||||
Artist,
|
||||
Comic,
|
||||
Publisher,
|
||||
WorkType,
|
||||
)
|
||||
from src.db.models.media import (
|
||||
MediaFile,
|
||||
MediaActor,
|
||||
MediaActorFile,
|
||||
MediaArticle,
|
||||
MediaVideo,
|
||||
MediaLofi,
|
||||
)
|
||||
from src.db.models.tysc import (
|
||||
Card,
|
||||
CardSet,
|
||||
Rooster,
|
||||
Team,
|
||||
FieldPosition,
|
||||
Player,
|
||||
Vendor,
|
||||
Sport,
|
||||
)
|
||||
|
||||
registry: Dict[str, Any] = {
|
||||
Sport.__tablename__: Sport,
|
||||
Player.__tablename__: Player,
|
||||
Team.__tablename__: Team,
|
||||
FieldPosition.__tablename__: FieldPosition,
|
||||
Rooster.__tablename__: Rooster,
|
||||
Vendor.__tablename__: Vendor,
|
||||
CardSet.__tablename__: CardSet,
|
||||
Card.__tablename__: Card,
|
||||
Artist.__tablename__: Artist,
|
||||
Publisher.__tablename__: Publisher,
|
||||
WorkType.__tablename__: WorkType,
|
||||
Comic.__tablename__: Comic,
|
||||
Volume.__tablename__: Volume,
|
||||
StoryArc.__tablename__: StoryArc,
|
||||
Issue.__tablename__: Issue,
|
||||
TradePaperback.__tablename__: TradePaperback,
|
||||
ComicWork.__tablename__: ComicWork,
|
||||
IssueWork.__tablename__: IssueWork,
|
||||
Article.__tablename__: Article,
|
||||
BookshelfPublisher.__tablename__: BookshelfPublisher,
|
||||
Book.__tablename__: Book,
|
||||
Author.__tablename__: Author,
|
||||
ArticleAuthor.__tablename__: ArticleAuthor,
|
||||
BookAuthor.__tablename__: BookAuthor,
|
||||
MediaArticle.__tablename__: MediaArticle,
|
||||
MediaVideo.__tablename__: MediaVideo,
|
||||
MediaLofi.__tablename__: MediaLofi,
|
||||
MediaFile.__tablename__: MediaFile,
|
||||
MediaActor.__tablename__: MediaActor,
|
||||
MediaActorFile.__tablename__: MediaActorFile,
|
||||
Profile.__tablename__: Profile,
|
||||
Permission.__tablename__: Permission,
|
||||
Assignment.__tablename__: Assignment,
|
||||
Token.__tablename__: Token,
|
||||
MailAccount.__tablename__: MailAccount,
|
||||
Mail.__tablename__: Mail
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
from typing import Any, Dict
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy import Column, ForeignKey, Integer, String, Boolean
|
||||
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
||||
|
||||
from src.db.models.base import Base, BaseMixin
|
||||
@@ -9,14 +9,14 @@ from src.db.models.base import Base, BaseMixin
|
||||
|
||||
class Profile(Base, BaseMixin):
|
||||
__tablename__ = 'profile'
|
||||
first_name: Mapped[str]
|
||||
last_name: Mapped[str]
|
||||
user_name: Mapped[str] = mapped_column(nullable=False)
|
||||
email: Mapped[str]
|
||||
password: Mapped[str]
|
||||
enabled: Mapped[bool]
|
||||
assignments: Mapped[List["Assignment"]] = relationship(back_populates="profile")
|
||||
tokens: Mapped[List["Token"]] = relationship(back_populates="profile")
|
||||
first_name = Column(String)
|
||||
last_name = Column(String)
|
||||
user_name = Column(String, nullable=False)
|
||||
email = Column(String)
|
||||
password = Column(String)
|
||||
enabled = Column(Boolean)
|
||||
assignments = relationship("Assignment")
|
||||
tokens = relationship("Token")
|
||||
|
||||
def get_full_name(self) -> str:
|
||||
full_name: str = ""
|
||||
@@ -28,48 +28,178 @@ class Profile(Base, BaseMixin):
|
||||
full_name += str(self.last_name)
|
||||
return full_name
|
||||
|
||||
def __str__(self):
|
||||
return f"Profile({self.id} {self.user_name}, {self.email})"
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.first_name = import_data['first_name']
|
||||
self.last_name = import_data['last_name']
|
||||
self.user_name = import_data['user_name']
|
||||
self.email = import_data['email']
|
||||
self.password = import_data['password']
|
||||
self.enabled = import_data['enabled']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['first_name'] = self.first_name
|
||||
item['last_name'] = self.last_name
|
||||
item['user_name'] = self.user_name
|
||||
item['email'] = self.email
|
||||
item['password'] = self.password
|
||||
item['enabled'] = self.enabled
|
||||
return item
|
||||
|
||||
|
||||
class Token(Base, BaseMixin):
|
||||
__tablename__ = "token"
|
||||
token: Mapped[str] = mapped_column(nullable=False, unique=True)
|
||||
name: Mapped[str]
|
||||
last_used_date: Mapped[datetime]
|
||||
enabled: Mapped[bool]
|
||||
profile_id = mapped_column(ForeignKey("profile.id"), nullable=False)
|
||||
profile: Mapped[Profile] = relationship(back_populates="tokens")
|
||||
token = Column(String, nullable=False, unique=True)
|
||||
name = Column(String)
|
||||
last_used_date: Mapped[datetime] = mapped_column()
|
||||
enabled = Column(Boolean)
|
||||
profile_id = Column(String, ForeignKey("profile.id"), nullable=False)
|
||||
profile = relationship("Profile", back_populates="tokens")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.token = import_data['token']
|
||||
self.name = import_data['name']
|
||||
self.last_used_date = import_data['last_used_date']
|
||||
self.enabled = import_data['enabled']
|
||||
self.profile_id = import_data['profile_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['token'] = self.token
|
||||
item['name'] = self.name
|
||||
item['last_used_date'] = self.last_used_date
|
||||
item['enabled'] = self.enabled
|
||||
item['profile_id'] = self.profile_id
|
||||
return item
|
||||
|
||||
|
||||
class Permission(Base, BaseMixin):
|
||||
__tablename__ = "permission"
|
||||
name: Mapped[str] = mapped_column(nullable=False)
|
||||
assignments: Mapped[List["Assignment"]] = relationship(back_populates="permission")
|
||||
name = Column(String, nullable=False)
|
||||
assignments = relationship("Assignment")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
return item
|
||||
|
||||
class Assignment(Base, BaseMixin):
|
||||
__tablename__ = "assignment"
|
||||
profile_id = mapped_column(ForeignKey("profile.id"), nullable=False)
|
||||
profile: Mapped[Profile] = relationship(back_populates="assignments")
|
||||
permission_id = mapped_column(ForeignKey("permission.id"), nullable=False)
|
||||
permission: Mapped[Permission] = relationship(back_populates="assignments")
|
||||
profile_id = Column(String, ForeignKey("profile.id"), nullable=False)
|
||||
profile = relationship("Profile", back_populates="assignments")
|
||||
permission_id = Column(String, ForeignKey("permission.id"), nullable=False)
|
||||
permission = relationship("Permission", back_populates="assignments")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.profile_id = import_data['profile_id']
|
||||
self.permission_id = import_data['permission_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['profile_id'] = self.profile_id
|
||||
item['permission_id'] = self.permission_id
|
||||
return item
|
||||
|
||||
|
||||
class MailAccount(Base, BaseMixin):
|
||||
__tablename__ = "mail_account"
|
||||
host: Mapped[str]
|
||||
port: Mapped[int]
|
||||
protocol: Mapped[str]
|
||||
user_name: Mapped[str]
|
||||
password: Mapped[str]
|
||||
start_tls: Mapped[bool]
|
||||
host = Column(String)
|
||||
port = Column(Integer)
|
||||
protocol = Column(String)
|
||||
user_name = Column(String)
|
||||
password = Column(String)
|
||||
start_tls = Column(Boolean)
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.host = import_data['host']
|
||||
self.port = import_data['port']
|
||||
self.protocol = import_data['protocol']
|
||||
self.user_name = import_data['user_name']
|
||||
self.password = import_data['password']
|
||||
self.start_tls = import_data['start_tls']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['host'] = self.host
|
||||
item['port'] = self.port
|
||||
item['protocol'] = self.protocol
|
||||
item['user_name'] = self.user_name
|
||||
item['password'] = self.password
|
||||
item['start_tls'] = self.start_tls
|
||||
return item
|
||||
|
||||
|
||||
class Mail(Base, BaseMixin):
|
||||
__tablename__ = "mail"
|
||||
folder: Mapped[str]
|
||||
subject: Mapped[str]
|
||||
body: Mapped[str]
|
||||
sent_date: Mapped[datetime]
|
||||
received_date: Mapped[datetime]
|
||||
folder: Mapped[str] = mapped_column()
|
||||
subject: Mapped[str] = mapped_column()
|
||||
body: Mapped[str] = mapped_column()
|
||||
sent_date: Mapped[datetime] = mapped_column()
|
||||
received_date: Mapped[datetime] = mapped_column()
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.folder = import_data['folder']
|
||||
self.subject = import_data['subject']
|
||||
self.body = import_data['body']
|
||||
self.sent_date = import_data['sent_date']
|
||||
self.received_date = import_data['received_date']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['folder'] = self.folder
|
||||
item['subject'] = self.subject
|
||||
item['body'] = self.body
|
||||
item['sent_date'] = str(self.sent_date)
|
||||
item['received_date'] = str(self.received_date)
|
||||
return item
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from typing import Optional
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy import func, Column, String, Boolean
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
||||
|
||||
|
||||
@@ -11,17 +10,21 @@ class Base(DeclarativeBase):
|
||||
|
||||
|
||||
class BaseMixin:
|
||||
id: Mapped[str] = mapped_column(primary_key=True, default=str(uuid.uuid4()))
|
||||
#id = Column(String, primary_key=True, default=uuid.uuid4)
|
||||
id: Mapped[str] = mapped_column(primary_key=True, default=uuid.uuid4)
|
||||
# created_date = Column(DateTime)
|
||||
created_date: Mapped[datetime] = mapped_column(default=func.now())
|
||||
# last_modified_date = Column(DateTime)
|
||||
last_modified_date: Mapped[datetime] = mapped_column(default=func.now())
|
||||
# version = Column(Integer)
|
||||
version: Mapped[int] = mapped_column(default=0)
|
||||
|
||||
|
||||
class BaseVideoMixin:
|
||||
cloud_link: Mapped[Optional[str]]
|
||||
file_name: Mapped[Optional[str]]
|
||||
path: Mapped[str]
|
||||
review: Mapped[bool]
|
||||
title: Mapped[str]
|
||||
url: Mapped[str]
|
||||
should_download: Mapped[bool]
|
||||
cloud_link = Column(String, nullable=True)
|
||||
file_name = Column(String, nullable=True)
|
||||
path = Column(String)
|
||||
review = Column(Boolean)
|
||||
title = Column(String)
|
||||
url = Column(String, nullable=True)
|
||||
should_download = Column(Boolean)
|
||||
|
||||
@@ -1,52 +1,159 @@
|
||||
from typing import List
|
||||
|
||||
from typing import Any, Dict
|
||||
from sqlalchemy import Column, ForeignKey, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from src.db.models.base import Base, BaseMixin
|
||||
|
||||
|
||||
class Article(Base, BaseMixin):
|
||||
__tablename__ = 'article'
|
||||
title: Mapped[str] = mapped_column(unique=True)
|
||||
title = Column(String, unique=True)
|
||||
article_authors = relationship("ArticleAuthor")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.title = import_data['title']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['title'] = self.title
|
||||
return item
|
||||
|
||||
|
||||
class Author(Base, BaseMixin):
|
||||
__tablename__ = 'author'
|
||||
first_name: Mapped[str]
|
||||
last_name: Mapped[str]
|
||||
article_authors: Mapped[List["ArticleAuthor"]] = relationship(back_populates="author")
|
||||
book_authors: Mapped[List["BookAuthor"]] = relationship(back_populates="author")
|
||||
first_name = Column(String)
|
||||
last_name = Column(String)
|
||||
article_authors = relationship("ArticleAuthor")
|
||||
book_authors = relationship("BookAuthor")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.first_name = import_data['first_name']
|
||||
self.last_name = import_data['last_name']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['first_name'] = self.first_name
|
||||
item['last_name'] = self.last_name
|
||||
return item
|
||||
|
||||
|
||||
class BookshelfPublisher(Base, BaseMixin):
|
||||
__tablename__ = 'bookshelf_publisher'
|
||||
name: Mapped[str] = mapped_column(unique=True)
|
||||
books: Mapped[List["Book"]] = relationship(back_populates="publisher")
|
||||
name = Column(String, unique=True)
|
||||
books = relationship("Book", back_populates="publisher")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
return item
|
||||
|
||||
|
||||
class Book(Base, BaseMixin):
|
||||
__tablename__ = 'book'
|
||||
isbn: Mapped[str] = mapped_column(unique=True)
|
||||
title: Mapped[str]
|
||||
year: Mapped[int] = mapped_column(nullable=False)
|
||||
publisher_id: Mapped[str] = mapped_column(ForeignKey("bookshelf_publisher.id"), nullable=False)
|
||||
publisher: Mapped[BookshelfPublisher] = relationship(back_populates="books")
|
||||
book_authors: Mapped[List["BookAuthor"]] = relationship(back_populates="book")
|
||||
isbn = Column(String, unique=True)
|
||||
title = Column(String)
|
||||
year = Column(Integer, nullable=False)
|
||||
publisher_id = Column(String, ForeignKey('bookshelf_publisher.id'), nullable=False)
|
||||
publisher = relationship('BookshelfPublisher', back_populates="books")
|
||||
book_authors = relationship("BookAuthor")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.isbn = import_data['isbn']
|
||||
self.title = import_data['title']
|
||||
self.year = import_data['year']
|
||||
self.publisher_id = import_data['publisher_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['isbn'] = self.isbn
|
||||
item['title'] = self.title
|
||||
item['year'] = self.year
|
||||
item['publisher_id'] = self.publisher_id
|
||||
return item
|
||||
|
||||
|
||||
class ArticleAuthor(Base, BaseMixin):
|
||||
__tablename__ = 'article_author'
|
||||
article_id: Mapped[str] = mapped_column(ForeignKey("article.id"), nullable=False)
|
||||
article: Mapped[Article] = relationship(back_populates="article_authors")
|
||||
author_id: Mapped[str] = mapped_column(ForeignKey("author.id"), nullable=False)
|
||||
author: Mapped[Author] = relationship(back_populates="article_authors")
|
||||
article_id = Column(String, ForeignKey('article.id'), nullable=False)
|
||||
article = relationship('Article', back_populates="article_authors")
|
||||
author_id = Column(String, ForeignKey('author.id'), nullable=False)
|
||||
author = relationship('Author', back_populates="article_authors")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.article_id = import_data['article_id']
|
||||
self.author_id = import_data['author_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['article_id'] = self.article_id
|
||||
item['author_id'] = self.author_id
|
||||
return item
|
||||
|
||||
|
||||
class BookAuthor(Base, BaseMixin):
|
||||
__tablename__ = 'book_author'
|
||||
author_id: Mapped[str] = mapped_column(ForeignKey("author.id"), nullable=False)
|
||||
author: Mapped[Author] = relationship(back_populates="book_authors")
|
||||
book_id: Mapped[str] = mapped_column(ForeignKey("book.id"), nullable=False)
|
||||
book: Mapped[Book] = relationship(back_populates="book_authors")
|
||||
author_id = Column(String, ForeignKey('author.id'), nullable=False)
|
||||
author = relationship('Author', back_populates="book_authors")
|
||||
book_id = Column(String, ForeignKey('book.id'), nullable=False)
|
||||
book = relationship('Book', back_populates="book_authors")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.author_id = import_data['author_id']
|
||||
self.book_id = import_data['book_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['author_id'] = self.author_id
|
||||
item['book_id'] = self.book_id
|
||||
return item
|
||||
|
||||
+278
-114
@@ -1,8 +1,7 @@
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Optional, Any
|
||||
from natsort import natsorted
|
||||
from sqlalchemy import ForeignKey, func
|
||||
from sqlalchemy import Column, ForeignKey, Integer, String, Boolean, func
|
||||
from sqlalchemy.orm import relationship, Mapped, mapped_column
|
||||
|
||||
from src.db.models.base import Base, BaseMixin
|
||||
@@ -14,12 +13,12 @@ class Publisher(Base):
|
||||
created_date: Mapped[datetime] = mapped_column(default=func.now())
|
||||
last_modified_date: Mapped[datetime] = mapped_column(default=func.now())
|
||||
version: Mapped[int] = mapped_column(default=0)
|
||||
name: Mapped[str] = mapped_column(unique=True)
|
||||
weblink: Mapped[Optional[str]]
|
||||
name = Column(String, unique=True)
|
||||
weblink = Column(String, nullable=True)
|
||||
parent_publisher_id: Mapped[Optional[str]] = mapped_column(ForeignKey('publisher.id'))
|
||||
parent_publisher: Mapped[Optional['Publisher']] = relationship(back_populates="imprints", remote_side=[id])
|
||||
imprints: Mapped[List['Publisher']] = relationship(back_populates="parent_publisher")
|
||||
comics: Mapped[List["Comic"]] = relationship(back_populates="publisher")
|
||||
parent_publisher: Mapped[Optional['Publisher']] = relationship("Publisher", back_populates="imprints", remote_side=[id])
|
||||
imprints: Mapped[List['Publisher']] = relationship('Publisher', back_populates="parent_publisher")
|
||||
comics = relationship("Comic")
|
||||
|
||||
def __repr__(self):
|
||||
return f'Publisher({self.id} {self.name})'
|
||||
@@ -27,20 +26,40 @@ class Publisher(Base):
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
self.parent_publisher_id = import_data['parent_publisher_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {
|
||||
'id': self.id,
|
||||
'created_date': str(self.created_date),
|
||||
'last_modified_date': str(self.last_modified_date),
|
||||
'version': self.version,
|
||||
'name': self.name,
|
||||
'weblink': self.weblink,
|
||||
'parent_publisher_id': self.parent_publisher_id
|
||||
}
|
||||
return item
|
||||
|
||||
|
||||
class Comic(Base, BaseMixin):
|
||||
__tablename__ = 'comic'
|
||||
title: Mapped[str] = mapped_column(unique=True)
|
||||
publisher_id: Mapped[str] = mapped_column(ForeignKey('publisher.id'), nullable=False)
|
||||
publisher: Mapped[Publisher] = relationship(back_populates="comics")
|
||||
current_order: Mapped[bool]
|
||||
completed: Mapped[bool]
|
||||
weblink: Mapped[Optional[str]]
|
||||
issues: Mapped[List["Issue"]] = relationship(back_populates="comic", order_by="Issue.issue_number")
|
||||
story_arcs: Mapped[List["StoryArc"]] = relationship(back_populates="comic")
|
||||
trade_paperbacks: Mapped[List["TradePaperback"]] = relationship(back_populates="comic")
|
||||
volumes: Mapped[List["Volume"]] = relationship(back_populates="comic")
|
||||
comic_works: Mapped[List["ComicWork"]] = relationship(back_populates="comic")
|
||||
title = Column(String, unique=True)
|
||||
publisher_id = Column(String, ForeignKey('publisher.id'), nullable=False)
|
||||
publisher = relationship("Publisher", back_populates="comics")
|
||||
current_order = Column(Boolean)
|
||||
completed = Column(Boolean)
|
||||
weblink = Column(String, nullable=True)
|
||||
issues = relationship("Issue")
|
||||
story_arcs = relationship("StoryArc")
|
||||
trade_paperbacks = relationship("TradePaperback")
|
||||
volumes = relationship("Volume")
|
||||
comic_works = relationship("ComicWork")
|
||||
|
||||
def __repr__(self):
|
||||
return f'Comic({self.id} {self.version} {self.title} {self.publisher.name})'
|
||||
@@ -48,118 +67,204 @@ class Comic(Base, BaseMixin):
|
||||
def __str__(self):
|
||||
return f'{self.title}({self.id})'
|
||||
|
||||
def get_artists(self) -> Dict[Any, List[Any]]:
|
||||
works: Dict[Any, List[Any]] = {}
|
||||
for work in self.comic_works:
|
||||
work_type = work.work_type
|
||||
artist = work.artist
|
||||
if work_type in works:
|
||||
works[work_type].append(artist)
|
||||
else:
|
||||
works[work_type] = [artist]
|
||||
return works
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.title = import_data['title']
|
||||
self.publisher_id = import_data['publisher_id']
|
||||
self.current_order = import_data['current_order']
|
||||
self.completed = import_data['completed']
|
||||
if 'weblink' in import_data:
|
||||
self.weblink = import_data['weblink']
|
||||
|
||||
def sorted_issues(self):
|
||||
sorted_issues = natsorted(self.issues, key=lambda x: getattr(x, 'issue_number'))
|
||||
return sorted_issues
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {
|
||||
'id': self.id,
|
||||
'created_date': str(self.created_date),
|
||||
'last_modified_date': str(self.last_modified_date),
|
||||
'version': self.version,
|
||||
'title': self.title,
|
||||
'publisher_id': self.publisher_id,
|
||||
'current_order': self.current_order,
|
||||
'completed': self.completed,
|
||||
'weblink': self.weblink
|
||||
}
|
||||
return item
|
||||
|
||||
|
||||
class Volume(Base, BaseMixin):
|
||||
__tablename__ = "volume"
|
||||
name: Mapped[str] = mapped_column(nullable=False)
|
||||
comic_id: Mapped[str] = mapped_column(ForeignKey("comic.id"), nullable=False)
|
||||
comic: Mapped[Comic] = relationship(back_populates="volumes")
|
||||
story_arcs: Mapped[List["StoryArc"]] = relationship(back_populates="volume")
|
||||
issues: Mapped[List["Issue"]] = relationship(back_populates="volume")
|
||||
name = Column(String, nullable=False)
|
||||
comic_id = Column(String, ForeignKey("comic.id"), nullable=False)
|
||||
comic = relationship("Comic", back_populates="volumes")
|
||||
story_arcs = relationship("StoryArc")
|
||||
issues = relationship("Issue")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
self.comic_id = import_data['comic_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
item['comic_id'] = self.comic_id
|
||||
return item
|
||||
|
||||
class TradePaperback(Base, BaseMixin):
|
||||
__tablename__ = "trade_paperback"
|
||||
name: Mapped[str] = mapped_column(nullable=False)
|
||||
issue_start: Mapped[int]
|
||||
issue_end: Mapped[int]
|
||||
comic_id: Mapped[str] = mapped_column(ForeignKey("comic.id"), nullable=False)
|
||||
comic: Mapped[Comic] = relationship(back_populates="trade_paperbacks")
|
||||
name = Column(String, nullable=False)
|
||||
issue_start = Column(Integer)
|
||||
issue_end = Column(Integer)
|
||||
comic_id = Column(String, ForeignKey("comic.id"), nullable=False)
|
||||
comic = relationship("Comic", back_populates="trade_paperbacks")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
self.issue_start = import_data['issue_start']
|
||||
self.issue_end = import_data['issue_end']
|
||||
self.comic_id = import_data['comic_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
item['issue_start'] = self.issue_start
|
||||
item['issue_end'] = self.issue_end
|
||||
item['comic_id'] = self.comic_id
|
||||
return item
|
||||
|
||||
|
||||
class StoryArc(Base, BaseMixin):
|
||||
__tablename__ = "story_arc"
|
||||
name: Mapped[str] = mapped_column(nullable=False)
|
||||
comic_id: Mapped[str] = mapped_column(ForeignKey("comic.id"), nullable=False)
|
||||
comic: Mapped[Comic] = relationship(back_populates="story_arcs")
|
||||
volume_id: Mapped[str] = mapped_column(ForeignKey("volume.id"), nullable=True)
|
||||
volume: Mapped[Volume] = relationship(back_populates="story_arcs")
|
||||
issues: Mapped[List["Issue"]] = relationship(back_populates="story_arc")
|
||||
name = Column(String, nullable=False)
|
||||
comic_id = Column(String, ForeignKey("comic.id"), nullable=False)
|
||||
comic = relationship("Comic", back_populates="story_arcs")
|
||||
volume_id = Column(String, ForeignKey("volume.id"), nullable=True)
|
||||
volume = relationship("Volume", back_populates="story_arcs")
|
||||
issues = relationship("Issue")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
self.comic_id = import_data['comic_id']
|
||||
self.volume_id = import_data['volume_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {
|
||||
'id': self.id,
|
||||
'created_date': str(self.created_date),
|
||||
'last_modified_date': str(self.last_modified_date),
|
||||
'version': self.version,
|
||||
'name': self.name,
|
||||
'comic_id': self.comic_id,
|
||||
'volume_id': self.volume_id
|
||||
}
|
||||
return item
|
||||
|
||||
|
||||
class Issue(Base, BaseMixin):
|
||||
__tablename__ = "issue"
|
||||
issue_number: Mapped[str]
|
||||
title: Mapped[Optional[str]]
|
||||
published_on: Mapped[Optional[datetime]]
|
||||
in_stock: Mapped[bool]
|
||||
is_read: Mapped[bool]
|
||||
comic_id: Mapped[str] = mapped_column(ForeignKey("comic.id"), nullable=False)
|
||||
comic: Mapped[Comic] = relationship(back_populates="issues")
|
||||
volume_id: Mapped[str] = mapped_column(ForeignKey("volume.id"), nullable=True)
|
||||
volume: Mapped[Volume] = relationship(back_populates="issues")
|
||||
story_arc_id: Mapped[str] = mapped_column(ForeignKey("story_arc.id"), nullable=True)
|
||||
story_arc: Mapped[StoryArc] = relationship(back_populates="issues")
|
||||
issue_works: Mapped[List["IssueWork"]] = relationship(back_populates="issue")
|
||||
issue_number = Column(String)
|
||||
title = Column(String, nullable=True)
|
||||
published_on: Mapped[datetime] = mapped_column(nullable=True)
|
||||
in_stock = Column(Boolean)
|
||||
is_read = Column(Boolean)
|
||||
comic_id = Column(String, ForeignKey("comic.id"), nullable=False)
|
||||
comic = relationship("Comic", back_populates="issues")
|
||||
volume_id = Column(String, ForeignKey("volume.id"), nullable=True)
|
||||
volume = relationship("Volume", back_populates="issues")
|
||||
story_arc_id = Column(String, ForeignKey("story_arc.id"), nullable=True)
|
||||
story_arc = relationship("StoryArc", back_populates="issues")
|
||||
issue_works = relationship("IssueWork")
|
||||
|
||||
def get_full_title(self) -> str:
|
||||
full_title: str = str(self.issue_number)
|
||||
if self.title:
|
||||
full_title += str(": " + self.title)
|
||||
return full_title
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.issue_number = import_data['issue_number']
|
||||
self.title = import_data['title']
|
||||
if import_data['published_on'] == 'None':
|
||||
self.published_on = None # type: ignore
|
||||
else:
|
||||
self.published_on = import_data['published_on']
|
||||
self.in_stock = import_data['in_stock']
|
||||
self.is_read = import_data['is_read']
|
||||
self.comic_id = import_data['comic_id']
|
||||
self.volume_id = import_data['volume_id']
|
||||
self.story_arc_id = import_data['story_arc_id']
|
||||
|
||||
def get_artists(self) -> Dict[Any, List[Any]]:
|
||||
works: Dict[Any, List[Any]] = {}
|
||||
for work in self.issue_works:
|
||||
work_type = work.work_type
|
||||
artist = work.artist
|
||||
if work_type in works:
|
||||
works[work_type].append(artist)
|
||||
else:
|
||||
works[work_type] = [artist]
|
||||
return works
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {
|
||||
'id': self.id,
|
||||
'created_date': str(self.created_date),
|
||||
'last_modified_date': str(self.last_modified_date),
|
||||
'version': self.version,
|
||||
'issue_number': self.issue_number,
|
||||
'title': self.title,
|
||||
'published_on': str(self.published_on),
|
||||
'in_stock': self.in_stock,
|
||||
'is_read': self.is_read,
|
||||
'comic_id': self.comic_id,
|
||||
'volume_id': self.volume_id,
|
||||
'story_arc_id': self.story_arc_id
|
||||
}
|
||||
return item
|
||||
|
||||
|
||||
class Artist(Base, BaseMixin):
|
||||
__tablename__ = "artist"
|
||||
name: Mapped[str] = mapped_column(nullable=False)
|
||||
weblink: Mapped[str] = mapped_column(nullable=True)
|
||||
comic_works: Mapped[List["ComicWork"]] = relationship(back_populates="artist")
|
||||
issue_works: Mapped[List["IssueWork"]] = relationship(back_populates="artist")
|
||||
name = Column(String, nullable=False)
|
||||
weblink = Column(String, nullable=True)
|
||||
comic_works = relationship("ComicWork")
|
||||
issue_works = relationship("IssueWork")
|
||||
|
||||
def get_comics(self) -> Dict[Any, List[Comic]]:
|
||||
works: Dict[Any, List[Comic]] = {}
|
||||
for work in self.comic_works:
|
||||
work_type = work.work_type
|
||||
comic = work.comic
|
||||
if work_type in works:
|
||||
works[work_type].append(comic)
|
||||
else:
|
||||
works[work_type] = [comic]
|
||||
return works
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
if 'weblink' in import_data:
|
||||
self.weblink = import_data['weblink']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {
|
||||
'id': self.id,
|
||||
'created_date': str(self.created_date),
|
||||
'last_modified_date': str(self.last_modified_date),
|
||||
'version': self.version,
|
||||
'name': self.name,
|
||||
'weblink': self.weblink
|
||||
}
|
||||
return item
|
||||
|
||||
|
||||
class WorkType(Base, BaseMixin):
|
||||
__tablename__ = "worktype"
|
||||
name: Mapped[str] = mapped_column(nullable=False, unique=True)
|
||||
comic_works: Mapped[List["ComicWork"]] = relationship(back_populates="work_type")
|
||||
issue_works: Mapped[List["IssueWork"]] = relationship(back_populates="work_type")
|
||||
|
||||
def get_artists(self) -> Dict[str, List[Artist]]:
|
||||
works: Dict[str, List[Artist]] = {}
|
||||
for work in self.comic_works:
|
||||
comic = work.comic.title
|
||||
artist = work.artist
|
||||
if comic in works:
|
||||
works[comic].append(artist)
|
||||
else:
|
||||
works[comic] = [artist]
|
||||
return works
|
||||
name = Column(String, nullable=False, unique=True)
|
||||
comic_works = relationship("ComicWork")
|
||||
issue_works = relationship("IssueWork")
|
||||
|
||||
def __repr__(self):
|
||||
return f'Worktype({self.id} {self.version} {self.name} {len(self.comic_works)})'
|
||||
@@ -167,22 +272,81 @@ class WorkType(Base, BaseMixin):
|
||||
def __str__(self):
|
||||
return f'{self.name}({self.id})'
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {
|
||||
'id': self.id,
|
||||
'created_date': str(self.created_date),
|
||||
'last_modified_date': str(self.last_modified_date),
|
||||
'version': self.version,
|
||||
'name': self.name
|
||||
}
|
||||
return item
|
||||
|
||||
|
||||
class ComicWork(Base, BaseMixin):
|
||||
__tablename__ = "comic_work"
|
||||
comic_id: Mapped[str] = mapped_column(ForeignKey("comic.id"), nullable=False)
|
||||
comic: Mapped[Comic] = relationship(back_populates="comic_works")
|
||||
artist_id: Mapped[str] = mapped_column(ForeignKey("artist.id"), nullable=False)
|
||||
artist: Mapped[Artist] = relationship(back_populates="comic_works")
|
||||
work_type_id: Mapped[str] = mapped_column(ForeignKey("worktype.id"), nullable=False)
|
||||
work_type: Mapped[WorkType] = relationship(back_populates="comic_works")
|
||||
comic_id = Column(String, ForeignKey("comic.id"), nullable=False)
|
||||
comic = relationship("Comic", back_populates="comic_works")
|
||||
artist_id = Column(String, ForeignKey("artist.id"), nullable=False)
|
||||
artist = relationship("Artist", back_populates="comic_works")
|
||||
work_type_id = Column(String, ForeignKey("worktype.id"), nullable=False)
|
||||
work_type = relationship("WorkType", back_populates="comic_works")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.comic_id = import_data['comic_id']
|
||||
self.artist_id = import_data['artist_id']
|
||||
self.work_type_id = import_data['work_type_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {
|
||||
'id': self.id,
|
||||
'created_date': str(self.created_date),
|
||||
'last_modified_date': str(self.last_modified_date),
|
||||
'version': self.version,
|
||||
'comic_id': self.comic_id,
|
||||
'artist_id': self.artist_id,
|
||||
'work_type_id': self.work_type_id
|
||||
}
|
||||
return item
|
||||
|
||||
|
||||
class IssueWork(Base, BaseMixin):
|
||||
__tablename__ = "issue_work"
|
||||
issue_id: Mapped[str] = mapped_column(ForeignKey("issue.id"), nullable=False)
|
||||
issue: Mapped[Issue] = relationship(back_populates="issue_works")
|
||||
artist_id: Mapped[str] = mapped_column(ForeignKey("artist.id"), nullable=False)
|
||||
artist: Mapped[Artist] = relationship(back_populates="issue_works")
|
||||
work_type_id: Mapped[str] = mapped_column(ForeignKey("worktype.id"), nullable=False)
|
||||
work_type: Mapped[WorkType] = relationship(back_populates="issue_works")
|
||||
issue_id = Column(String, ForeignKey("issue.id"), nullable=False)
|
||||
issue = relationship("Issue", back_populates="issue_works")
|
||||
artist_id = Column(String, ForeignKey("artist.id"), nullable=False)
|
||||
artist = relationship("Artist", back_populates="issue_works")
|
||||
work_type_id = Column(String, ForeignKey("worktype.id"), nullable=False)
|
||||
work_type = relationship("WorkType", back_populates="issue_works")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.issue_id = import_data['issue_id']
|
||||
self.artist_id = import_data['artist_id']
|
||||
self.work_type_id = import_data['work_type_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {
|
||||
'id': self.id,
|
||||
'created_date': str(self.created_date),
|
||||
'last_modified_date': str(self.last_modified_date),
|
||||
'version': self.version,
|
||||
'issue_id': self.issue_id,
|
||||
'artist_id': self.artist_id,
|
||||
'work_type_id': self.work_type_id
|
||||
}
|
||||
return item
|
||||
|
||||
@@ -1,97 +1,207 @@
|
||||
import logging
|
||||
import re
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import List, Optional
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, relationship, mapped_column
|
||||
from typing import Any, Dict
|
||||
from sqlalchemy import Boolean, Column, String, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from src.db.models.base import Base, BaseMixin, BaseVideoMixin
|
||||
|
||||
|
||||
class MediaFile(Base, BaseMixin, BaseVideoMixin):
|
||||
"""
|
||||
MediaFile represents video link.
|
||||
"""
|
||||
|
||||
__tablename__ = "media_file"
|
||||
media_actor_files: Mapped[List["MediaActorFile"]] = relationship(
|
||||
back_populates="media_file"
|
||||
)
|
||||
__tablename__ = 'media_file'
|
||||
media_actor_files = relationship("MediaActorFile")
|
||||
|
||||
def __repr__(self):
|
||||
return f"MediaFile({self.id} {self.title} {self.title})"
|
||||
return f'MediaFile(\n\tID: {self.id}\n\tTitle: {self.title}\n\tURL: {self.url}\n\tReview: {self.review}\n\tDownload: {self.should_download}\n\tPath: {self.path}\n\tCloudlink: {self.cloud_link})'
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.title}({self.id})"
|
||||
return f'{self.title}({self.id})'
|
||||
|
||||
def update_title(self):
|
||||
"""
|
||||
Update title from url.
|
||||
"""
|
||||
pass
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.cloud_link = import_data['cloud_link']
|
||||
self.file_name = import_data['file_name']
|
||||
self.path = import_data['path']
|
||||
self.review = import_data['review']
|
||||
self.title = import_data['title']
|
||||
self.url = import_data['url']
|
||||
self.should_download = import_data['should_download']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['cloud_link'] = self.cloud_link
|
||||
item['file_name'] = self.file_name
|
||||
item['path'] = self.path
|
||||
item['review'] = self.review
|
||||
item['title'] = self.title
|
||||
item['url'] = self.url
|
||||
item['should_download'] = self.should_download
|
||||
return item
|
||||
|
||||
|
||||
class MediaActor(Base, BaseMixin):
|
||||
__tablename__ = "media_actor"
|
||||
name: Mapped[str]
|
||||
url: Mapped[Optional[str]] = mapped_column(unique=True)
|
||||
__tablename__ = 'media_actor'
|
||||
name = Column(String)
|
||||
url = Column(String, unique=True)
|
||||
media_actor_files = relationship("MediaActorFile")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"MediaActor({self.id} {self.name} {self.url})"
|
||||
def __repr__(self):
|
||||
return f'MediaActor(\n\tID: {self.id}\n\tName: {self.name}\n\tURL: {self.url})'
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.url}({self.id})"
|
||||
def __str__(self):
|
||||
return f'{self.name}({self.id})'
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
self.url = import_data['url']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
item['url'] = self.url
|
||||
return item
|
||||
|
||||
|
||||
class MediaActorFile(Base, BaseMixin):
|
||||
__tablename__ = "media_actor_file"
|
||||
media_actor_id: Mapped[str] = mapped_column(
|
||||
ForeignKey("media_actor.id"), nullable=False
|
||||
)
|
||||
media_actor: Mapped[MediaActor] = relationship(back_populates="media_actor_files")
|
||||
media_file_id: Mapped[str] = mapped_column(
|
||||
ForeignKey("media_file.id"), nullable=True
|
||||
)
|
||||
media_file: Mapped[MediaFile] = relationship(back_populates="media_actor_files")
|
||||
__tablename__ = 'media_actor_file'
|
||||
media_actor_id = Column(String, ForeignKey("media_actor.id"), nullable=False)
|
||||
media_actor = relationship("MediaActor", back_populates="media_actor_files")
|
||||
media_file_id = Column(String, ForeignKey("media_file.id"), nullable=True)
|
||||
media_file = relationship("MediaFile", back_populates="media_actor_files")
|
||||
|
||||
def __repr__(self):
|
||||
return f"MediaActorFile({self.id} {self.media_actor_id} {self.media_file_id})"
|
||||
return f'MediaActorFile(\n\tID: {self.id}\n\tMediaActor: {self.media_actor_id}\n\tMediaFile: {self.media_file_id})'
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.id} {self.media_actor_id} {self.media_file_id}"
|
||||
def __str__(self):
|
||||
return f'{self.id}: MediaActor: {self.media_actor_id} - MediaFile: {self.media_file_id}'
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.media_actor_id = import_data['media_actor_id']
|
||||
self.media_file_id = import_data['media_file_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['media_actor_id'] = self.media_actor_id
|
||||
item['media_file_id'] = self.media_file_id
|
||||
return item
|
||||
|
||||
class MediaArticle(Base, BaseMixin):
|
||||
__tablename__ = "media_article"
|
||||
review: Mapped[bool]
|
||||
title: Mapped[str]
|
||||
url: Mapped[str] = mapped_column(unique=True)
|
||||
__tablename__ = 'media_article'
|
||||
review = Column(Boolean)
|
||||
title = Column(String)
|
||||
url = Column(String, unique=True)
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.review = import_data['review']
|
||||
self.title = import_data['title']
|
||||
self.url = import_data['url']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['review'] = self.review
|
||||
item['title'] = self.title
|
||||
item['url'] = self.url
|
||||
return item
|
||||
|
||||
|
||||
class MediaVideo(Base, BaseMixin):
|
||||
"""
|
||||
MediaFile represents video link.
|
||||
"""
|
||||
__tablename__ = 'media_video'
|
||||
cloud_link = Column(String)
|
||||
file_name = Column(String)
|
||||
path = Column(String)
|
||||
review = Column(Boolean)
|
||||
title = Column(String)
|
||||
url = Column(String, unique=True)
|
||||
should_download = Column(Boolean)
|
||||
|
||||
__tablename__ = "media_video"
|
||||
cloud_link: Mapped[str]
|
||||
file_name: Mapped[str]
|
||||
path: Mapped[str]
|
||||
review: Mapped[bool]
|
||||
title: Mapped[str]
|
||||
url: Mapped[str] = mapped_column(unique=True)
|
||||
should_download: Mapped[bool]
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.cloud_link = import_data['cloud_link']
|
||||
self.file_name = import_data['file_name']
|
||||
self.path = import_data['path']
|
||||
self.review = import_data['review']
|
||||
self.title = import_data['title']
|
||||
self.url = import_data['url']
|
||||
self.should_download = import_data['should_download']
|
||||
|
||||
def __repr__(self):
|
||||
return f"MediaFile({self.id} {self.title} {self.url})"
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['cloud_link'] = self.cloud_link
|
||||
item['file_name'] = self.file_name
|
||||
item['path'] = self.path
|
||||
item['review'] = self.review
|
||||
item['title'] = self.title
|
||||
item['url'] = self.url
|
||||
item['should_download'] = self.should_download
|
||||
return item
|
||||
|
||||
def __str__(self):
|
||||
if self.title is None:
|
||||
return f"{self.url}({self.id})"
|
||||
else:
|
||||
return f"{self.title}({self.id})"
|
||||
class MediaLofi(Base, BaseMixin):
|
||||
__tablename__ = 'media_lofi'
|
||||
file_name = Column(String)
|
||||
review = Column(Boolean)
|
||||
should_download = Column(Boolean)
|
||||
title = Column(String)
|
||||
url = Column(String, unique=True)
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.file_name = import_data['file_name']
|
||||
self.review = import_data['review']
|
||||
self.should_download = import_data['should_download']
|
||||
self.title = import_data['title']
|
||||
self.url = import_data['url']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['file_name'] = self.file_name
|
||||
item['review'] = self.review
|
||||
item['should_download'] = self.should_download
|
||||
item['title'] = self.title
|
||||
item['url'] = self.url
|
||||
return item
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import List
|
||||
from sqlalchemy import ForeignKey, UniqueConstraint
|
||||
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
||||
from typing import Dict, Any
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, UniqueConstraint, Boolean
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from src.db.models.base import Base, BaseMixin
|
||||
|
||||
@@ -10,19 +10,56 @@ class Sport(Base, BaseMixin):
|
||||
__table_args__ = (
|
||||
UniqueConstraint("name"),
|
||||
)
|
||||
name: Mapped[str] = mapped_column(nullable=False, index=True, unique=True)
|
||||
teams: Mapped[List["Team"]] = relationship(back_populates="sport")
|
||||
positions: Mapped[List["FieldPosition"]] = relationship(back_populates="sport")
|
||||
name = Column(String, nullable=False, index=True, unique=True)
|
||||
teams = relationship("Team")
|
||||
positions = relationship("FieldPosition")
|
||||
|
||||
def __repr__(self):
|
||||
return f"Sport(id={self.id}, name={self.name}, created_date={self.created_date})"
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
return item
|
||||
|
||||
class Team(Base, BaseMixin):
|
||||
__tablename__ = "team"
|
||||
name: Mapped[str] = mapped_column(nullable=False, index=True, unique=True)
|
||||
short_name: Mapped[str] = mapped_column(nullable=False)
|
||||
sport_id: Mapped[str] = mapped_column(ForeignKey("sport.id"), nullable=False)
|
||||
sport: Mapped[Sport] = relationship(back_populates="teams")
|
||||
roosters: Mapped[List["Rooster"]] = relationship(back_populates="team")
|
||||
name = Column(String, nullable=False, index=True, unique=True)
|
||||
short_name = Column(String, nullable=False, )
|
||||
sport_id = Column(String, ForeignKey("sport.id"), nullable=False)
|
||||
sport = relationship("Sport", back_populates="teams")
|
||||
roosters = relationship("Rooster")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
self.short_name = import_data['short_name']
|
||||
self.sport_id = import_data['sport_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
item['short_name'] = self.short_name
|
||||
item['sport_id'] = self.sport_id
|
||||
return item
|
||||
|
||||
class FieldPosition(Base, BaseMixin):
|
||||
__tablename__ = "field_position"
|
||||
@@ -30,11 +67,31 @@ class FieldPosition(Base, BaseMixin):
|
||||
UniqueConstraint("name", "sport_id"),
|
||||
UniqueConstraint("short_name", "sport_id"),
|
||||
)
|
||||
name: Mapped[str] = mapped_column(nullable=False, index=True)
|
||||
short_name: Mapped[str] = mapped_column(nullable=False)
|
||||
sport_id: Mapped[str] = mapped_column(ForeignKey("sport.id"), nullable=False, index=True)
|
||||
sport: Mapped[Sport] = relationship(back_populates="positions")
|
||||
roosters: Mapped[List["Rooster"]] = relationship(back_populates="position")
|
||||
name = Column(String, nullable=False, index=True)
|
||||
short_name = Column(String, nullable=False)
|
||||
sport_id = Column(String, ForeignKey("sport.id"), nullable=False, index=True)
|
||||
sport = relationship("Sport", back_populates="positions")
|
||||
roosters = relationship("Rooster")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
self.short_name = import_data['short_name']
|
||||
self.sport_id = import_data['sport_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
item['short_name'] = self.short_name
|
||||
item['sport_id'] = self.sport_id
|
||||
return item
|
||||
|
||||
|
||||
class Player(Base, BaseMixin):
|
||||
@@ -42,34 +99,90 @@ class Player(Base, BaseMixin):
|
||||
__table_args__ = (
|
||||
UniqueConstraint("first_name", "last_name"),
|
||||
)
|
||||
first_name: Mapped[str] = mapped_column(nullable=False, index=True)
|
||||
last_name: Mapped[str] = mapped_column(nullable=False, index=True)
|
||||
roosters: Mapped[List["Rooster"]] = relationship(back_populates="player")
|
||||
first_name = Column(String, nullable=False, index=True)
|
||||
last_name = Column(String, nullable=False, index=True)
|
||||
roosters = relationship("Rooster")
|
||||
|
||||
def get_full_name(self) -> str:
|
||||
return f"{self.last_name}, {self.first_name}"
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.first_name = import_data['first_name']
|
||||
self.last_name = import_data['last_name']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['first_name'] = self.first_name
|
||||
item['last_name'] = self.last_name
|
||||
return item
|
||||
|
||||
|
||||
class Rooster(Base, BaseMixin):
|
||||
__tablename__ = "rooster"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("year", "team_id", "player_id", "position_id"),
|
||||
)
|
||||
year: Mapped[int]
|
||||
team_id: Mapped[str] = mapped_column(ForeignKey("team.id"), nullable=False, index=True)
|
||||
team: Mapped[Team] = relationship(back_populates="roosters")
|
||||
player_id: Mapped[str] = mapped_column(ForeignKey("player.id"), nullable=False, index=True)
|
||||
player: Mapped[Player] = relationship(back_populates="roosters")
|
||||
position_id: Mapped[str] = mapped_column(ForeignKey("field_position.id"), nullable=False, index=True)
|
||||
position: Mapped[FieldPosition] = relationship(back_populates="roosters")
|
||||
cards: Mapped[List["Card"]] = relationship(back_populates="rooster")
|
||||
year = Column(Integer)
|
||||
team_id = Column(String, ForeignKey("team.id"), nullable=False, index=True)
|
||||
team = relationship("Team", back_populates="roosters")
|
||||
player_id = Column(String, ForeignKey("player.id"), nullable=False, index=True)
|
||||
player = relationship("Player", back_populates="roosters")
|
||||
position_id = Column(String, ForeignKey("field_position.id"), nullable=False, index=True)
|
||||
position = relationship("FieldPosition", back_populates="roosters")
|
||||
cards = relationship("Card")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.year = import_data['year']
|
||||
self.team_id = import_data['team_id']
|
||||
self.player_id = import_data['player_id']
|
||||
self.position_id = import_data['position_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['year'] = self.year
|
||||
item['team_id'] = self.team_id
|
||||
item['player_id'] = self.player_id
|
||||
item['position_id'] = self.position_id
|
||||
return item
|
||||
|
||||
|
||||
class Vendor(Base, BaseMixin):
|
||||
__tablename__ = "vendor"
|
||||
name: Mapped[str] = mapped_column(nullable=False, unique=True, index=True)
|
||||
card_sets: Mapped[List["CardSet"]] = relationship(back_populates="vendor")
|
||||
cards: Mapped[List["Card"]] = relationship(back_populates="vendor")
|
||||
name = Column(String, nullable=False, unique=True, index=True)
|
||||
card_sets = relationship("CardSet")
|
||||
cards = relationship("Card")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
return item
|
||||
|
||||
|
||||
class CardSet(Base, BaseMixin):
|
||||
@@ -77,12 +190,34 @@ class CardSet(Base, BaseMixin):
|
||||
__table_args__ = (
|
||||
UniqueConstraint("name", "vendor_id"),
|
||||
)
|
||||
name: Mapped[str] = mapped_column(index=True)
|
||||
parallel_set: Mapped[bool]
|
||||
insert_set: Mapped[bool]
|
||||
vendor_id: Mapped[str] = mapped_column(ForeignKey("vendor.id"), nullable=False, index=True)
|
||||
vendor: Mapped[Vendor] = relationship(back_populates="card_sets")
|
||||
cards: Mapped[List["Card"]] = relationship(back_populates="card_set")
|
||||
name = Column(String, index=True)
|
||||
parallel_set = Column(Boolean)
|
||||
insert_set = Column(Boolean)
|
||||
vendor_id = Column(String, ForeignKey("vendor.id"), nullable=False, index=True)
|
||||
vendor = relationship("Vendor", back_populates="card_sets")
|
||||
cards = relationship("Card")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.name = import_data['name']
|
||||
self.parallel_set = import_data['parallel_set']
|
||||
self.insert_set = import_data['insert_set']
|
||||
self.vendor_id = import_data['vendor_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['name'] = self.name
|
||||
item['parallel_set'] = self.parallel_set
|
||||
item['insert_set'] = self.insert_set
|
||||
item['vendor_id'] = self.vendor_id
|
||||
return item
|
||||
|
||||
|
||||
class Card(Base, BaseMixin):
|
||||
@@ -90,11 +225,35 @@ class Card(Base, BaseMixin):
|
||||
__table_args__ = (
|
||||
UniqueConstraint("card_number", "year", "vendor_id", "card_set_id"),
|
||||
)
|
||||
card_number: Mapped[int] = mapped_column(index=True)
|
||||
year: Mapped[int] = mapped_column(index=True)
|
||||
card_set_id: Mapped[str] = mapped_column(ForeignKey("card_set.id"), nullable=False)
|
||||
card_set: Mapped[CardSet] = relationship(back_populates="cards")
|
||||
rooster_id: Mapped[str] = mapped_column(ForeignKey("rooster.id"), nullable=False)
|
||||
rooster: Mapped[Rooster] = relationship(back_populates="cards")
|
||||
vendor_id: Mapped[str] = mapped_column(ForeignKey("vendor.id"), nullable=False)
|
||||
vendor: Mapped[Vendor] = relationship(back_populates="cards")
|
||||
card_number = Column(Integer, index=True)
|
||||
year = Column(Integer, index=True)
|
||||
card_set_id = Column(String, ForeignKey("card_set.id"), nullable=False)
|
||||
card_set = relationship("CardSet", back_populates="cards")
|
||||
rooster_id = Column(String, ForeignKey("rooster.id"), nullable=False)
|
||||
rooster = relationship("Rooster", back_populates="cards")
|
||||
vendor_id = Column(String, ForeignKey("vendor.id"), nullable=False)
|
||||
vendor = relationship("Vendor", back_populates="cards")
|
||||
|
||||
def import_dict(self, import_data: Dict[str, Any]):
|
||||
self.id = import_data['id']
|
||||
self.created_date = import_data['created_date']
|
||||
self.last_modified_date = import_data['last_modified_date']
|
||||
self.version = import_data['version']
|
||||
self.card_number = import_data['card_number']
|
||||
self.year = import_data['year']
|
||||
self.card_set_id = import_data['card_set_id']
|
||||
self.rooster_id = import_data['rooster_id']
|
||||
self.vendor_id = import_data['vendor_id']
|
||||
|
||||
def export_dict(self) -> Dict[str, Any]:
|
||||
item: Dict[str, Any] = {}
|
||||
item['id'] = self.id
|
||||
item['created_date'] = str(self.created_date)
|
||||
item['last_modified_date'] = str(self.last_modified_date)
|
||||
item['version'] = self.version
|
||||
item['card_number'] = self.card_number
|
||||
item['year'] = self.year
|
||||
item['card_set_id'] = self.card_set_id
|
||||
item['rooster_id'] = self.rooster_id
|
||||
item['vendor_id'] = self.vendor_id
|
||||
return item
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import uuid
|
||||
from typing import List, Optional
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from src.core.log_conf import logger
|
||||
from src.db.models.comic import Artist
|
||||
from src.schema.comics.artist import AddArtist
|
||||
from src.schema.comics.artist_details import ArtistDetailResponse, ArtistWorktypeComicResponse, ArtistWorktypeIssueResponse
|
||||
@@ -17,7 +15,17 @@ def get_artist_details(artist: Artist) -> ArtistDetailResponse:
|
||||
for work in artist.comic_works:
|
||||
worktype_id = work.work_type.id
|
||||
if worktype_id in comic_works_map:
|
||||
comic = ComicResponse(id=work.comic.id, title=work.comic.title, completed=work.comic.completed)
|
||||
comic = ComicResponse(
|
||||
id=work.comic.id,
|
||||
created_date=work.comic.created_date,
|
||||
last_modified_date=work.comic.last_modified_date,
|
||||
version=work.comic.version,
|
||||
publisher_id=work.comic.publisher_id,
|
||||
current_order=work.comic.current_order,
|
||||
weblink=work.comic.weblink,
|
||||
title=work.comic.title,
|
||||
completed=work.comic.completed
|
||||
)
|
||||
comic_works_map[worktype_id].comics.append(comic)
|
||||
else:
|
||||
comic_works_map[worktype_id] = ArtistWorktypeComicResponse(
|
||||
@@ -37,7 +45,6 @@ def get_artist_details(artist: Artist) -> ArtistDetailResponse:
|
||||
return response
|
||||
|
||||
def update_artist(add_artist: AddArtist, artist_id: str, db: Session) -> Optional[Artist]:
|
||||
logger.info("update artist")
|
||||
artist: Optional[Artist] = db.get(Artist, artist_id)
|
||||
if artist is not None:
|
||||
artist.name = add_artist.name
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import Dict, List, Optional
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from src.core.log_conf import logger
|
||||
from src.db.models.comic import Comic, Issue
|
||||
from src.schema.comics.artist import artist_to_response
|
||||
from src.schema.comics.comic import ComicSchema, comic_to_response
|
||||
@@ -30,7 +29,6 @@ def get_issue_details(issue: Issue) -> IssueDetailsResponse:
|
||||
|
||||
|
||||
def update_comic(new_comic: ComicSchema, comic_id: str, db: Session) -> Optional[Comic]:
|
||||
logger.info(f"update_comic: {new_comic} with {comic_id}")
|
||||
comic: Optional[Comic] = db.get(Comic, comic_id)
|
||||
return comic
|
||||
|
||||
@@ -48,7 +46,6 @@ def get_comic_details(comic: Comic) -> ComicDetailsResponse:
|
||||
if worktype_id in works_map:
|
||||
artist = artist_to_response(work.artist)
|
||||
works_map[worktype_id].artists.append(artist)
|
||||
logger.info(f"add artist to response map: {artist} -> {works_map}")
|
||||
print(f"add artist to response map: {artist} -> {works_map}")
|
||||
else:
|
||||
works_map[worktype_id] = ComicWorktypeArtistResponse(
|
||||
|
||||
@@ -9,15 +9,43 @@ from src.schema.comics.publisher_details import PublisherDetailsResponse
|
||||
def get_publisher_details(publisher: Publisher) -> PublisherDetailsResponse:
|
||||
imprints: List[PublisherResponse] = []
|
||||
for imprint in publisher.imprints:
|
||||
imprints.append(PublisherResponse(id=imprint.id, name=str(imprint.name)))
|
||||
imprints.append(
|
||||
PublisherResponse(
|
||||
id=imprint.id,
|
||||
created_date=imprint.created_date,
|
||||
last_modified_date=imprint.last_modified_date,
|
||||
version=imprint.version,
|
||||
weblink=str(imprint.weblink),
|
||||
parent_publisher_id=imprint.parent_publisher_id,
|
||||
name=str(imprint.name)
|
||||
)
|
||||
)
|
||||
comics: List[ComicResponse] = []
|
||||
for comic in publisher.comics:
|
||||
comics.append(
|
||||
ComicResponse(id=comic.id, title=comic.title, completed=comic.completed)
|
||||
ComicResponse(
|
||||
id=comic.id,
|
||||
created_date=comic.created_date,
|
||||
last_modified_date=comic.last_modified_date,
|
||||
version=comic.version,
|
||||
publisher_id=comic.publisher_id,
|
||||
current_order=comic.current_order,
|
||||
weblink=comic.weblink,
|
||||
title=comic.title,
|
||||
completed=comic.completed
|
||||
)
|
||||
)
|
||||
parent_publisher: PublisherResponse | None = None
|
||||
if publisher.parent_publisher:
|
||||
parent_publisher = PublisherResponse(id=publisher.parent_publisher.id, name=str(publisher.parent_publisher.name))
|
||||
parent_publisher = PublisherResponse(
|
||||
id=publisher.parent_publisher.id,
|
||||
created_date=publisher.parent_publisher.created_date,
|
||||
last_modified_date=publisher.parent_publisher.last_modified_date,
|
||||
version=publisher.parent_publisher.version,#
|
||||
weblink=str(publisher.parent_publisher.weblink),
|
||||
parent_publisher_id=publisher.parent_publisher.parent_publisher_id,
|
||||
name=str(publisher.parent_publisher.name)
|
||||
)
|
||||
response: PublisherDetailsResponse = PublisherDetailsResponse(
|
||||
id=publisher.id, name=str(publisher.name), parent_publisher=parent_publisher, imprints=imprints, comics=comics
|
||||
)
|
||||
|
||||
@@ -4,7 +4,6 @@ from typing import AnyStr, Optional
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from src.core.log_conf import logger
|
||||
from src.db.models.comic import WorkType
|
||||
from src.schema.comics.worktype import AddWorkType
|
||||
|
||||
@@ -18,12 +17,10 @@ def create_new_worktype(work: AddWorkType, db: Session) -> WorkType:
|
||||
db.add(worktype)
|
||||
db.commit()
|
||||
db.refresh(worktype)
|
||||
logger.info(f"create_new_worktype: {worktype}")
|
||||
return worktype
|
||||
|
||||
|
||||
def update_worktype(work: AddWorkType, worktype_id: AnyStr, db: Session) -> Optional[WorkType]:
|
||||
logger.info("update worktype")
|
||||
worktype: Optional[WorkType] = db.get(WorkType, worktype_id)
|
||||
if worktype is not None:
|
||||
worktype.name = work.worktype
|
||||
|
||||
@@ -3,14 +3,13 @@ import uuid
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from src.core.log_conf import logger
|
||||
from src.db.models.media import MediaActor
|
||||
from src.db.repository.media.actorfile import delete_mediaactorfile
|
||||
from src.schema.media.actor import MediaActorModel
|
||||
|
||||
|
||||
def create_new_mediaactor(new_actor: MediaActorModel, db: Session) -> MediaActor:
|
||||
logger.info(f"create MediaActor with url {new_actor.url}")
|
||||
print(f"create MediaActor with url {new_actor.url}")
|
||||
media_actor: MediaActor = MediaActor()
|
||||
media_actor.id = str(uuid.uuid4())
|
||||
if new_actor.name is not None:
|
||||
@@ -22,11 +21,11 @@ def create_new_mediaactor(new_actor: MediaActorModel, db: Session) -> MediaActor
|
||||
db.add(media_actor)
|
||||
db.commit()
|
||||
db.refresh(media_actor)
|
||||
logger.info(f"created {media_actor}")
|
||||
print(f"created {media_actor}")
|
||||
return media_actor
|
||||
|
||||
def delete_mediaactor(db: Session, actor_id: str):
|
||||
logger.info(f"delete MediaActor with id {actor_id}")
|
||||
print(f"delete MediaActor with id {actor_id}")
|
||||
media_actor = db.get(MediaActor, actor_id)
|
||||
if media_actor is not None:
|
||||
actor_files = media_actor.media_actor_files
|
||||
@@ -40,7 +39,7 @@ def import_mediaactor(db: Session, new_actor: MediaActorModel) -> MediaActor:
|
||||
"""
|
||||
import MediaFile and set missing values with default ones.
|
||||
"""
|
||||
logger.info("import MediaActor with %s", new_actor)
|
||||
print("import MediaActor with %s", new_actor)
|
||||
media_actor: MediaActor = MediaActor()
|
||||
media_actor.id = new_actor.id
|
||||
if new_actor.created_date:
|
||||
|
||||
@@ -3,7 +3,6 @@ import uuid
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from src.core.log_conf import logger
|
||||
from src.db.models.media import MediaActorFile
|
||||
from src.schema.media.actorfile import MediaActorFileModel
|
||||
|
||||
@@ -14,7 +13,7 @@ def create_new_mediaactorfile(
|
||||
"""
|
||||
Create relation for MediaFile and MediaActor
|
||||
"""
|
||||
logger.info("create MediaActorFile with actor %s and file %s", actor_id, file_id)
|
||||
print("create MediaActorFile with actor %s and file %s", actor_id, file_id)
|
||||
media_actor_file: MediaActorFile = MediaActorFile()
|
||||
media_actor_file.id = str(uuid.uuid4())
|
||||
media_actor_file.created_date = datetime.now()
|
||||
@@ -32,7 +31,7 @@ def delete_mediaactorfile(db: Session, actorfile_id: str):
|
||||
"""
|
||||
Delete relation between MediaFile and MediaActor.
|
||||
"""
|
||||
logger.info("delete MediaActorFile with id %s", actorfile_id)
|
||||
print("delete MediaActorFile with id %s", actorfile_id)
|
||||
media_actorfile = db.get(MediaActorFile, actorfile_id)
|
||||
db.delete(media_actorfile)
|
||||
db.commit()
|
||||
@@ -44,7 +43,7 @@ def import_mediaactorfile(
|
||||
"""
|
||||
Import MediaFile and set missing values with default ones.
|
||||
"""
|
||||
logger.info("import MediaActorFile with %s", new_actorfile)
|
||||
print("import MediaActorFile with %s", new_actorfile)
|
||||
media_actor_file: MediaActorFile = MediaActorFile()
|
||||
media_actor_file.id = new_actorfile.id
|
||||
if new_actorfile.created_date:
|
||||
|
||||
@@ -3,7 +3,6 @@ import uuid
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from src.core.log_conf import logger
|
||||
from src.db.models.media import MediaFile
|
||||
from src.schema.media.file import MediaFileModel
|
||||
|
||||
@@ -12,7 +11,7 @@ def create_new_mediafile(link: str, db: Session) -> MediaFile:
|
||||
"""
|
||||
Create MediaFile with gievne URL.
|
||||
"""
|
||||
logger.info("create MediaFile with url {link}")
|
||||
print("create MediaFile with url {link}")
|
||||
media_file: MediaFile = MediaFile()
|
||||
media_file.id = str(uuid.uuid4())
|
||||
media_file.url = link
|
||||
@@ -24,7 +23,7 @@ def create_new_mediafile(link: str, db: Session) -> MediaFile:
|
||||
db.add(media_file)
|
||||
db.commit()
|
||||
db.refresh(media_file)
|
||||
logger.info("created %s", media_file)
|
||||
print("created %s", media_file)
|
||||
return media_file
|
||||
|
||||
|
||||
@@ -32,7 +31,7 @@ def delete_mediafile(db: Session, media_file_id: str):
|
||||
"""
|
||||
Delete MediaFile with given ID from db.
|
||||
"""
|
||||
logger.info("delete MediaFile with id %s", media_file_id)
|
||||
print("delete MediaFile with id %s", media_file_id)
|
||||
media_file = db.get(MediaFile, media_file_id)
|
||||
db.delete(media_file)
|
||||
db.commit()
|
||||
@@ -42,7 +41,7 @@ def import_mediafile(db: Session, new_file: MediaFileModel) -> MediaFile:
|
||||
"""
|
||||
import MediaActor and set missing values with defautl ones.
|
||||
"""
|
||||
logger.info("import MediaFile with %s", new_file)
|
||||
print("import MediaFile with %s", new_file)
|
||||
media_file: MediaFile = MediaFile()
|
||||
media_file.id = new_file.id
|
||||
if new_file.created_date:
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
from datetime import datetime
|
||||
import uuid
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from src.db.models.media import MediaLofi
|
||||
from src.schema.media.lofi import MediaLofiModel
|
||||
|
||||
|
||||
def create_new_lofi(url: str, db: Session) -> MediaLofi:
|
||||
"""
|
||||
Create MediaLofi with given URL.
|
||||
"""
|
||||
print("create MediaLofi with url %s", url)
|
||||
media_lofi = MediaLofi()
|
||||
media_lofi.id = str(uuid.uuid4())
|
||||
media_lofi.url = url
|
||||
media_lofi.created_date = datetime.now()
|
||||
media_lofi.last_modified_date = datetime.now()
|
||||
media_lofi.review = True
|
||||
media_lofi.should_download = False
|
||||
db.add(media_lofi)
|
||||
db.commit()
|
||||
db.refresh(media_lofi)
|
||||
print(media_lofi)
|
||||
return media_lofi
|
||||
|
||||
def import_medialofi(db: Session, new_lofi: MediaLofiModel) -> MediaLofi:
|
||||
"""
|
||||
import MediaLofi and set missing values with default ones.
|
||||
"""
|
||||
print("import MediaLofi with %s", new_lofi)
|
||||
media_lofi: MediaLofi = MediaLofi()
|
||||
media_lofi.id = new_lofi.id
|
||||
if new_lofi.created_date:
|
||||
media_lofi.created_date = new_lofi.created_date
|
||||
else:
|
||||
media_lofi.created_date = datetime.now()
|
||||
if new_lofi.last_modified_date:
|
||||
media_lofi.last_modified_date = new_lofi.last_modified_date
|
||||
else:
|
||||
media_lofi.last_modified_date = datetime.now()
|
||||
media_lofi.version = new_lofi.version
|
||||
if new_lofi.title:
|
||||
media_lofi.title = new_lofi.title
|
||||
else:
|
||||
media_lofi.title = ""
|
||||
if new_lofi.url:
|
||||
media_lofi.url = new_lofi.url
|
||||
else:
|
||||
# TODO shoud exeception be raised when url is missing?
|
||||
media_lofi.url = ""
|
||||
media_lofi.review = new_lofi.review
|
||||
media_lofi.should_download = new_lofi.should_download
|
||||
db.add(media_lofi)
|
||||
db.commit()
|
||||
db.refresh(media_lofi)
|
||||
return media_lofi
|
||||
|
||||
|
||||
def delete_medialofi(db: Session, lofi_id: str):
|
||||
"""
|
||||
Delete MediaLofi with given ID from db.
|
||||
"""
|
||||
print("delete MediaLofi with id %s", lofi_id)
|
||||
lofi = db.get(MediaLofi, lofi_id)
|
||||
db.delete(lofi)
|
||||
db.commit()
|
||||
|
||||
@@ -4,14 +4,13 @@ import uuid
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from src.db.models.media import MediaVideo
|
||||
from src.webapps.media.forms import AddLinkForm
|
||||
|
||||
|
||||
def create_new_video(video: AddLinkForm, db: Session) -> MediaVideo:
|
||||
print(video.url)
|
||||
def create_new_video(url: str, db: Session) -> MediaVideo:
|
||||
print(url)
|
||||
media_video = MediaVideo()
|
||||
media_video.id = str(uuid.uuid4())
|
||||
media_video.url = str(video.url)
|
||||
media_video.url = url
|
||||
media_video.created_date = datetime.now()
|
||||
media_video.last_modified_date = datetime.now()
|
||||
media_video.review = True
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
import uuid
|
||||
from src.core.log_conf import logger
|
||||
from src.db.models.admin import Assignment, Profile
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
@@ -9,7 +8,7 @@ from src.schema.user.profile import ProfileModel
|
||||
|
||||
|
||||
def create_new_profile(new_profile: ProfileModel, db: Session) -> Profile:
|
||||
logger.info(f"create MediaActor with url {new_profile.username}")
|
||||
print(f"create Profile with username {new_profile.username}")
|
||||
profile: Profile = Profile()
|
||||
profile.id = str(uuid.uuid4())
|
||||
profile.user_name = new_profile.username
|
||||
@@ -21,11 +20,11 @@ def create_new_profile(new_profile: ProfileModel, db: Session) -> Profile:
|
||||
db.add(profile)
|
||||
db.commit()
|
||||
db.refresh(profile)
|
||||
logger.info(f"created {profile}")
|
||||
print(f"created {profile}")
|
||||
return profile
|
||||
|
||||
def delete_profile(db: Session, profile_id: str):
|
||||
logger.info(f"delete Profile with id {profile_id}")
|
||||
print(f"delete Profile with id {profile_id}")
|
||||
profile: Optional[Profile] = db.get(Profile, profile_id)
|
||||
if profile is not None:
|
||||
assignments = profile.assignments
|
||||
@@ -35,7 +34,7 @@ def delete_profile(db: Session, profile_id: str):
|
||||
db.commit()
|
||||
|
||||
def delete_assignment(db: Session, assignment_id: str) -> None:
|
||||
logger.info(f"delete Assignment with id {assignment_id}")
|
||||
print(f"delete Assignment with id {assignment_id}")
|
||||
assignment: Optional[Assignment] = db.get(Assignment, assignment_id)
|
||||
if assignment is not None:
|
||||
db.delete(assignment)
|
||||
|
||||
@@ -24,11 +24,11 @@ def to_response(account: MailAccount) -> MailAccountResponse:
|
||||
created_date=account.created_date,
|
||||
last_modified_date=account.last_modified_date,
|
||||
version=account.version,
|
||||
host=account.host,
|
||||
host=str(account.host),
|
||||
port=account.port,
|
||||
protocol=account.protocol,
|
||||
user_name=account.user_name,
|
||||
password=account.password,
|
||||
start_tls=account.start_tls,
|
||||
protocol=str(account.protocol),
|
||||
user_name=str(account.user_name),
|
||||
password=str(account.password),
|
||||
start_tls=bool(account.start_tls),
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -18,6 +18,6 @@ def to_response(article: Article) -> ArticleResponse:
|
||||
created_date=article.created_date,
|
||||
last_modified_date=article.last_modified_date,
|
||||
version=article.version,
|
||||
title=article.title
|
||||
title=str(article.title)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -19,7 +19,7 @@ def to_response(articleauthor: ArticleAuthor) -> ArticleAuthorResponse:
|
||||
created_date=articleauthor.created_date,
|
||||
last_modified_date=articleauthor.last_modified_date,
|
||||
version=articleauthor.version,
|
||||
article_id=articleauthor.article_id,
|
||||
author_id=articleauthor.author_id
|
||||
article_id=str(articleauthor.article_id),
|
||||
author_id=str(articleauthor.author_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -19,7 +19,7 @@ def to_response(author: Author) -> AuthorResponse:
|
||||
created_date=author.created_date,
|
||||
last_modified_date=author.last_modified_date,
|
||||
version=author.version,
|
||||
first_name=author.first_name,
|
||||
last_name=author.last_name
|
||||
first_name=str(author.first_name),
|
||||
last_name=str(author.last_name)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -21,9 +21,9 @@ def to_response(book: Book) -> BookResponse:
|
||||
created_date=book.created_date,
|
||||
last_modified_date=book.last_modified_date,
|
||||
version=book.version,
|
||||
isbn=book.isbn,
|
||||
title=book.title,
|
||||
isbn=str(book.isbn),
|
||||
title=str(book.title),
|
||||
year=book.year,
|
||||
publisher_id=book.publisher_id
|
||||
publisher_id=str(book.publisher_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -19,7 +19,7 @@ def to_response(bookauthor: BookAuthor) -> BookAuthorResponse:
|
||||
created_date=bookauthor.created_date,
|
||||
last_modified_date=bookauthor.last_modified_date,
|
||||
version=bookauthor.version,
|
||||
author_id=bookauthor.author_id,
|
||||
book_id=bookauthor.book_id
|
||||
author_id=str(bookauthor.author_id),
|
||||
book_id=str(bookauthor.book_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -18,6 +18,6 @@ def to_response(publisher: BookshelfPublisher) -> PublisherResponse:
|
||||
created_date=publisher.created_date,
|
||||
last_modified_date=publisher.last_modified_date,
|
||||
version=publisher.version,
|
||||
name=publisher.name
|
||||
name=str(publisher.name)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -28,11 +28,11 @@ def comic_to_response(comic: Comic) -> ComicResponse:
|
||||
created_date=comic.created_date,
|
||||
last_modified_date=comic.last_modified_date,
|
||||
version=comic.version,
|
||||
title=comic.title,
|
||||
publisher_id=comic.publisher_id,
|
||||
current_order=comic.current_order,
|
||||
completed=comic.completed,
|
||||
weblink=comic.weblink
|
||||
title=str(comic.title),
|
||||
publisher_id=str(comic.publisher_id),
|
||||
current_order=bool(comic.current_order),
|
||||
completed=bool(comic.completed),
|
||||
weblink=str(comic.weblink)
|
||||
)
|
||||
return response
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ def comicwork_to_response(comicwork: ComicWork) -> ComicWorkResponse:
|
||||
created_date=comicwork.created_date,
|
||||
last_modified_date=comicwork.last_modified_date,
|
||||
version=comicwork.version,
|
||||
comic_id=comicwork.comic_id,
|
||||
artist_id=comicwork.artist_id,
|
||||
work_type_id=comicwork.work_type_id,
|
||||
comic_id=str(comicwork.comic_id),
|
||||
artist_id=str(comicwork.artist_id),
|
||||
work_type_id=str(comicwork.work_type_id),
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -26,13 +26,13 @@ def issue_to_response(issue: Issue) -> IssueResponse:
|
||||
created_date=issue.created_date,
|
||||
last_modified_date=issue.last_modified_date,
|
||||
version=issue.version,
|
||||
issue_number=issue.issue_number,
|
||||
title=issue.title,
|
||||
issue_number=str(issue.issue_number),
|
||||
title=str(issue.title),
|
||||
published_on=issue.published_on,
|
||||
in_stock=issue.in_stock,
|
||||
is_read=issue.is_read,
|
||||
comic_id=issue.comic_id,
|
||||
volume_id=issue.volume_id,
|
||||
story_arc_id=issue.story_arc_id
|
||||
in_stock=bool(issue.in_stock),
|
||||
is_read=bool(issue.is_read),
|
||||
comic_id=str(issue.comic_id),
|
||||
volume_id=str(issue.volume_id),
|
||||
story_arc_id=str(issue.story_arc_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -25,8 +25,8 @@ def issuework_to_response(issuework: IssueWork) -> IssueWorkResponse:
|
||||
created_date=issuework.created_date,
|
||||
last_modified_date=issuework.last_modified_date,
|
||||
version=issuework.version,
|
||||
issue_id=issuework.issue_id,
|
||||
artist_id=issuework.artist_id,
|
||||
work_type_id=issuework.work_type_id,
|
||||
issue_id=str(issuework.issue_id),
|
||||
artist_id=str(issuework.artist_id),
|
||||
work_type_id=str(issuework.work_type_id),
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -22,8 +22,8 @@ def publisher_to_response(publisher: Publisher) -> PublisherResponse:
|
||||
created_date=publisher.created_date,
|
||||
last_modified_date=publisher.last_modified_date,
|
||||
version=publisher.version,
|
||||
name=publisher.name,
|
||||
weblink=publisher.weblink,
|
||||
name=str(publisher.name),
|
||||
weblink=str(publisher.weblink),
|
||||
parent_publisher_id=publisher.parent_publisher_id
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -23,8 +23,8 @@ def storyarc_to_response(storyarc: StoryArc) -> StoryArcResponse:
|
||||
created_date=storyarc.created_date,
|
||||
last_modified_date=storyarc.last_modified_date,
|
||||
version=storyarc.version,
|
||||
name=storyarc.name,
|
||||
comic_id=storyarc.comic_id,
|
||||
volume_id=storyarc.volume_id
|
||||
name=str(storyarc.name),
|
||||
comic_id=str(storyarc.comic_id),
|
||||
volume_id=str(storyarc.volume_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -19,7 +19,7 @@ def volume_to_response(volume: Volume) -> VolumeResponse:
|
||||
created_date=volume.created_date,
|
||||
last_modified_date=volume.last_modified_date,
|
||||
version=volume.version,
|
||||
name=volume.name,
|
||||
comic_id=volume.comic_id
|
||||
name=str(volume.name),
|
||||
comic_id=str(volume.comic_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -21,6 +21,6 @@ def worktype_to_response(worktype: WorkType) -> WorktypeResponse:
|
||||
created_date=worktype.created_date,
|
||||
last_modified_date=worktype.last_modified_date,
|
||||
version=worktype.version,
|
||||
name=worktype.name
|
||||
name=str(worktype.name)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -19,8 +19,8 @@ def actor_to_response(actor: MediaActor) -> MediaActorResponse:
|
||||
created_date=actor.created_date,
|
||||
last_modified_date=actor.last_modified_date,
|
||||
version=actor.version,
|
||||
name=actor.name,
|
||||
url=actor.url
|
||||
name=str(actor.name),
|
||||
url=str(actor.url)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -32,3 +32,27 @@ class MediaActorModel(BaseModel):
|
||||
version: int
|
||||
name: Optional[str]
|
||||
url: Optional[str]
|
||||
|
||||
def actor_to_model(model: MediaActorResponse, media_actor: MediaActor) -> MediaActor:
|
||||
"""
|
||||
Set data of response to model
|
||||
"""
|
||||
media_actor.file_name = model.file_name
|
||||
if model.url is not None:
|
||||
media_actor.url = model.url
|
||||
else:
|
||||
media_actor.url = ""
|
||||
media_actor.last_modified_date = datetime.now()
|
||||
return media_actor
|
||||
|
||||
|
||||
def actor_to_response(media_actor: MediaActor) -> MediaActorResponse:
|
||||
response: MediaActorResponse = MediaActorResponse(
|
||||
id=media_actor.id,
|
||||
created_date=media_actor.created_date,
|
||||
last_modified_date=media_actor.last_modified_date,
|
||||
version=media_actor.version,
|
||||
name=str(media_actor.name),
|
||||
url=str(media_actor.url),
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -19,8 +19,8 @@ def actorfile_to_response(actorfile: MediaActorFile) -> MediaActorFileResponse:
|
||||
created_date=actorfile.created_date,
|
||||
last_modified_date=actorfile.last_modified_date,
|
||||
version=actorfile.version,
|
||||
media_actor_id=actorfile.media_actor_id,
|
||||
media_file_id=actorfile.media_file_id
|
||||
media_actor_id=str(actorfile.media_actor_id),
|
||||
media_file_id=str(actorfile.media_file_id)
|
||||
)
|
||||
return response
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ def to_response(video: MediaArticle) -> MediaArticleResponse:
|
||||
created_date=video.created_date,
|
||||
last_modified_date=video.last_modified_date,
|
||||
version=video.version,
|
||||
review=video.review,
|
||||
title=video.title,
|
||||
url=video.url,
|
||||
review=bool(video.review),
|
||||
title=str(video.title),
|
||||
url=str(video.url),
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from src.db.models.media import MediaLofi
|
||||
|
||||
class MediaLofiResponse(BaseModel):
|
||||
id: str
|
||||
created_date: datetime
|
||||
last_modified_date: datetime
|
||||
version: int
|
||||
title: str = ""
|
||||
file_name: str = ""
|
||||
url: str = ""
|
||||
review: bool = False
|
||||
should_download: bool = False
|
||||
|
||||
class AddLofi(BaseModel):
|
||||
url: str
|
||||
|
||||
class MediaLofiModel(BaseModel):
|
||||
"""
|
||||
Pydantic Model to import MediaLofi.
|
||||
"""
|
||||
id: str
|
||||
created_date: datetime
|
||||
last_modified_date: datetime
|
||||
version: int = 0
|
||||
title: str = ""
|
||||
file_name: str = ""
|
||||
url: str = ""
|
||||
review: bool = False
|
||||
should_download: bool = False
|
||||
|
||||
|
||||
def lofi_to_model(model: MediaLofiResponse, medialofi: MediaLofi) -> MediaLofi:
|
||||
"""
|
||||
Set data of response to model
|
||||
"""
|
||||
medialofi.file_name = model.file_name
|
||||
if model.url is not None:
|
||||
medialofi.url = model.url
|
||||
else:
|
||||
medialofi.url = ""
|
||||
if model.title is not None:
|
||||
medialofi.title = model.title
|
||||
else:
|
||||
medialofi.title = ""
|
||||
medialofi.last_modified_date = datetime.now()
|
||||
medialofi.review = model.review
|
||||
medialofi.should_download = model.should_download
|
||||
return medialofi
|
||||
|
||||
|
||||
def lofi_to_response(lofi: MediaLofi) -> MediaLofiResponse:
|
||||
response: MediaLofiResponse = MediaLofiResponse(
|
||||
id=lofi.id,
|
||||
created_date=lofi.created_date,
|
||||
last_modified_date=lofi.last_modified_date,
|
||||
version=lofi.version,
|
||||
file_name=str(lofi.file_name),
|
||||
review=bool(lofi.review),
|
||||
should_download=bool(lofi.should_download),
|
||||
title=str(lofi.title),
|
||||
url=str(lofi.url),
|
||||
)
|
||||
return response
|
||||
@@ -27,12 +27,12 @@ def video_to_response(video: MediaVideo) -> MediaVideoResponse:
|
||||
created_date=video.created_date,
|
||||
last_modified_date=video.last_modified_date,
|
||||
version=video.version,
|
||||
cloud_link=video.cloud_link,
|
||||
file_name=video.file_name,
|
||||
path=video.path,
|
||||
review=video.review,
|
||||
title=video.title,
|
||||
url=video.url,
|
||||
should_download=video.should_download
|
||||
cloud_link=str(video.cloud_link),
|
||||
file_name=str(video.file_name),
|
||||
path=str(video.path),
|
||||
review=bool(video.review),
|
||||
title=str(video.title),
|
||||
url=str(video.url),
|
||||
should_download=bool(video.should_download)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -24,8 +24,8 @@ def to_response(card: Card) -> CardResponse:
|
||||
version=card.version,
|
||||
card_number=card.card_number,
|
||||
year=card.year,
|
||||
card_set_id=card.card_set_id,
|
||||
rooster_id=card.rooster_id,
|
||||
vendor_id=card.vendor_id
|
||||
card_set_id=str(card.card_set_id),
|
||||
rooster_id=str(card.rooster_id),
|
||||
vendor_id=str(card.vendor_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -22,9 +22,9 @@ def to_response(cardset: CardSet) -> CardSetResponse:
|
||||
created_date=cardset.created_date,
|
||||
last_modified_date=cardset.last_modified_date,
|
||||
version=cardset.version,
|
||||
name=cardset.name,
|
||||
parallel_set=cardset.parallel_set,
|
||||
insert_set=cardset.insert_set,
|
||||
vendor_id=cardset.vendor_id
|
||||
name=str(cardset.name),
|
||||
parallel_set=bool(cardset.parallel_set),
|
||||
insert_set=bool(cardset.insert_set),
|
||||
vendor_id=str(cardset.vendor_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -21,8 +21,8 @@ def to_response(fieldposition: FieldPosition) -> FieldPositionResponse:
|
||||
created_date=fieldposition.created_date,
|
||||
last_modified_date=fieldposition.last_modified_date,
|
||||
version=fieldposition.version,
|
||||
name=fieldposition.name,
|
||||
short_name=fieldposition.short_name,
|
||||
sport_id=fieldposition.sport_id
|
||||
name=str(fieldposition.name),
|
||||
short_name=str(fieldposition.short_name),
|
||||
sport_id=str(fieldposition.sport_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -19,7 +19,7 @@ def to_response(player: Player) -> PlayerResponse:
|
||||
created_date=player.created_date,
|
||||
last_modified_date=player.last_modified_date,
|
||||
version=player.version,
|
||||
first_name=player.first_name,
|
||||
last_name=player.last_name
|
||||
first_name=str(player.first_name),
|
||||
last_name=str(player.last_name)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -29,8 +29,8 @@ def to_response(rooster: Rooster) -> RoosterResponse:
|
||||
last_modified_date=rooster.last_modified_date,
|
||||
version=rooster.version,
|
||||
year=rooster.year,
|
||||
team_id=rooster.team_id,
|
||||
player_id=rooster.player_id,
|
||||
position_id=rooster.position_id
|
||||
team_id=str(rooster.team_id),
|
||||
player_id=str(rooster.player_id),
|
||||
position_id=str(rooster.position_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -19,6 +19,6 @@ def to_response(sport: Sport) -> SportResponse:
|
||||
created_date=sport.created_date,
|
||||
last_modified_date=sport.last_modified_date,
|
||||
version=sport.version,
|
||||
name=sport.name
|
||||
name=str(sport.name)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -21,8 +21,8 @@ def to_response(team: Team) -> TeamResponse:
|
||||
created_date=team.created_date,
|
||||
last_modified_date=team.last_modified_date,
|
||||
version=team.version,
|
||||
name=team.name,
|
||||
short_name=team.short_name,
|
||||
sport_id=team.sport_id
|
||||
name=str(team.name),
|
||||
short_name=str(team.short_name),
|
||||
sport_id=str(team.sport_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -27,6 +27,6 @@ def to_response(vendor: Vendor) -> VendorResponse:
|
||||
created_date=vendor.created_date,
|
||||
last_modified_date=vendor.last_modified_date,
|
||||
version=vendor.version,
|
||||
name=vendor.name
|
||||
name=str(vendor.name)
|
||||
)
|
||||
return reponse
|
||||
|
||||
@@ -20,7 +20,7 @@ def to_response(assignment: Assignment) -> AssignmentResponse:
|
||||
created_date=assignment.created_date,
|
||||
last_modified_date=assignment.last_modified_date,
|
||||
version=assignment.version,
|
||||
profile_id=assignment.profile_id,
|
||||
permission_id=assignment.permission_id
|
||||
profile_id=str(assignment.profile_id),
|
||||
permission_id=str(assignment.permission_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -19,6 +19,6 @@ def to_response(permission: Permission) -> PermissionResponse:
|
||||
created_date=permission.created_date,
|
||||
last_modified_date=permission.last_modified_date,
|
||||
version=permission.version,
|
||||
name=permission.name
|
||||
name=str(permission.name)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -23,12 +23,12 @@ def to_response(profile: Profile) -> ProfileResponse:
|
||||
created_date=profile.created_date,
|
||||
last_modified_date=profile.last_modified_date,
|
||||
version=profile.version,
|
||||
first_name=profile.first_name,
|
||||
last_name=profile.last_name,
|
||||
user_name=profile.user_name,
|
||||
email=profile.email,
|
||||
password=profile.password,
|
||||
enabled=profile.enabled
|
||||
first_name=str(profile.first_name),
|
||||
last_name=str(profile.last_name),
|
||||
user_name=str(profile.user_name),
|
||||
email=str(profile.email),
|
||||
password=str(profile.password),
|
||||
enabled=bool(profile.enabled)
|
||||
)
|
||||
return response
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@ def to_response(token: Token) -> TokenResponse:
|
||||
created_date=token.created_date,
|
||||
last_modified_date=token.last_modified_date,
|
||||
version=token.version,
|
||||
token=token.token,
|
||||
name=token.name,
|
||||
token=str(token.token),
|
||||
name=str(token.name),
|
||||
last_used_date=token.last_used_date,
|
||||
enabled=token.enabled,
|
||||
profile_id=token.profile_id
|
||||
enabled=bool(token.enabled),
|
||||
profile_id=str(token.profile_id)
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -1 +1,8 @@
|
||||
<h2>Footer</h2>
|
||||
<footer class="mt-auto py-3 bg-light fixed-bottom">
|
||||
<div class="container text-center">
|
||||
<span class="text-muted">{{ version }}</span>
|
||||
</div>
|
||||
</footer>
|
||||
<!-- Bootstrap JS einbinden -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="{{ url_for('static', path='js/autocomplete.js') }}"></script>
|
||||
|
||||
@@ -1,10 +1,49 @@
|
||||
<div class="topnav">
|
||||
<!-- <div class="topnav">
|
||||
<a href="/">Kontor</a>
|
||||
<a href="/comic/comics">Comics</a>
|
||||
<a href="/media/files">Media</a>
|
||||
<a style="float:right" href="/login/">Login</a></li>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color:darkgrey;">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">Kontor</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarComicsMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Comics</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarComicsMenuLink">
|
||||
<a class="dropdown-item" href="/comic/comics">Comics</a>
|
||||
<a class="dropdown-item" href="/comic/publishers">Publisher</a>
|
||||
<a class="dropdown-item" href="/comic/artists">Artist</a>
|
||||
<a class="dropdown-item" href="/comic/issues">Issue</a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarWebMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Media</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarWebMenuLink">
|
||||
<a class="dropdown-item" href="/media/files">Media Files</a>
|
||||
<a class="dropdown-item" href="/media/actors">Media Actors</a>
|
||||
<a class="dropdown-item" href="/media/lofis">Lofi</a>
|
||||
<a class="dropdown-item" href="/media/articles">Artikel</a>
|
||||
</div>
|
||||
</li>
|
||||
{% if user %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/logout">Logout</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/login">Login</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- <nav class="navbar navbar-expand-lg navbar-light bg-light px-5">
|
||||
<div class="container-fluid">
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{% extends "shared/base.html" %}
|
||||
|
||||
|
||||
{% block title %}
|
||||
<title>Add a Lofi Link</title>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="text-danger font-weight-bold">
|
||||
{% for error in errors %}
|
||||
<li>{{error}}</li>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row my-5">
|
||||
<h3 class="text-center display-4">Add a Lofi Link</h3>
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<input type="text" required class="form-control" name="url" value="{{url}}" placeholder="Lofi Link here">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
{% extends "shared/base.html" %}
|
||||
|
||||
|
||||
{% block title %}
|
||||
<title>MediaLofi Detail</title>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="display-5">MediaLofi Detail</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<table class="table table-striped table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">MediaLofi Title</th>
|
||||
<td colspan="2">{{medialofi.title}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">MediaLofi URL</th>
|
||||
<td colspan="2">{{medialofi.url}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">MediaLofi Download?</th>
|
||||
<td colspan="2">{{medialofi.should_download}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">MediaLofi Review?</th>
|
||||
<td colspan="2">{{medialofi.review}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Data Created</th>
|
||||
<td colspan="2">{{medialofi.created_date}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Data Modified</th>
|
||||
<td colspan="2">{{medialofi.last_modified_date}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Data Version</th>
|
||||
<td colspan="2">{{medialofi.version}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,62 @@
|
||||
{% extends "shared/base.html" %}
|
||||
|
||||
{% block title %}
|
||||
<title>Lofi Links</title>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% with msg=msg %}
|
||||
{% include "components/alerts.html" %}
|
||||
{% endwith %}
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<h1>Media Lofi</h1>
|
||||
<p>Hier steht der wesentliche Inhalt der Seite.</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<aside class="bg-light p-3">
|
||||
<h3>Seitenbereich</h3>
|
||||
<p>Optionale Sidebar oder Zusatzinformationen.</p>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<form class="form-inline" action="/media/lofis">
|
||||
<input type="text" placeholder="Search" name="query">
|
||||
<label>
|
||||
<input type="checkbox" name="review" {% if review %}checked{% endif %}>Review
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="should_download" {% if download %}checked{% endif %}>Download
|
||||
</label>
|
||||
<button type="submit">Search</button>
|
||||
<div class="pill-nav"><a href="/media/lofis/add">Add Lofi</a></div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Title</th>
|
||||
<th scope="col">Weblink</th>
|
||||
<th scope="col">Review</th>
|
||||
<th colspan="2">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for medialofi in medialofis %}
|
||||
<tr>
|
||||
<th scope="row"><a href="/media/lofi/{{medialofi.id}}">{{medialofi.title}}</a></th>
|
||||
<td><a href="{{medialofi.url}}">{{medialofi.url}}</a></td>
|
||||
<td>{% with check=medialofi.review %}{% include "components/check.html" %}{% endwith %}</td>
|
||||
<td>{% with check=medialofi.should_download %}{% include "components/check.html" %}{% endwith %}</td>
|
||||
<td><a href="/media/lofi/{{medialofi.id}}/edit" class="btn btn-outline-primary btn-sm active" role="button" aria-pressed="true">Edit</a></td>
|
||||
<td><a href="/media/lofi/{{medialofi.id}}/delete" class="btn btn-outline-danger btn-sm active" role="button" aria-pressed="true">Delete</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -2,4 +2,5 @@
|
||||
<a href="/media/files/">MediaFiles</a>
|
||||
<a href="/media/actors/">MediaActors</a>
|
||||
<a href="/media/videos/">MediaVideos</a>
|
||||
<a href="/media/lofi/">MediaLofi</a>
|
||||
</div>
|
||||
|
||||
@@ -1,75 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de-DE">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
|
||||
<link rel="stylesheet" href="{{ url_for('static', path='style.css') }}">
|
||||
{% block title %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="header">
|
||||
<body class="d-flex flex-column h-100">
|
||||
<header>
|
||||
{% block header %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% include "components/navbar.html" %}
|
||||
{% block subnav %}
|
||||
{% endblock %}
|
||||
<!-- <div class="topnav">
|
||||
<a href="#">Link</a>
|
||||
<a href="#">Link</a>
|
||||
<a href="#">Link</a>
|
||||
<a href="#" style="float:right">Link</a>
|
||||
</div> -->
|
||||
{% include "components/navbar.html" %}
|
||||
{% block subnav %}
|
||||
{% endblock %}
|
||||
</header>
|
||||
<main class="flex-shrink-0">
|
||||
<div class="container my-4">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
|
||||
<script src="{{ url_for('static', path='js/autocomplete.js') }}"></script>
|
||||
{% include "components/footer.html" %}
|
||||
{% block scripts %}
|
||||
{% endblock %}
|
||||
|
||||
<!-- <div class="row">
|
||||
<div class="leftcolumn">
|
||||
<div class="card">
|
||||
<h2>TITLE HEADING</h2>
|
||||
<h5>Title description, Dec 7, 2017</h5>
|
||||
<div class="fakeimg" style="height:200px;">Image</div>
|
||||
<p>Some text..</p>
|
||||
<p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h2>TITLE HEADING</h2>
|
||||
<h5>Title description, Sep 2, 2017</h5>
|
||||
<div class="fakeimg" style="height:200px;">Image</div>
|
||||
<p>Some text..</p>
|
||||
<p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rightcolumn">
|
||||
<div class="card">
|
||||
<h2>About Me</h2>
|
||||
<div class="fakeimg" style="height:100px;">Image</div>
|
||||
<p>Some text about me in culpa qui officia deserunt mollit anim..</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>Popular Post</h3>
|
||||
<div class="fakeimg"><p>Image</p></div>
|
||||
<div class="fakeimg"><p>Image</p></div>
|
||||
<div class="fakeimg"><p>Image</p></div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>Follow Me</h3>
|
||||
<p>Some text..</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="footer">
|
||||
{% include "components/footer.html" %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,7 +4,7 @@ from fastapi.templating import Jinja2Templates
|
||||
from src.webapps.admin import route_admin
|
||||
from src.webapps.auth import route_login
|
||||
from src.webapps.comic import route_comics, route_worktype, route_artists
|
||||
from src.webapps.media import route_actors, route_media, route_videos
|
||||
from src.webapps.media import route_actors, route_lofi, route_media, route_videos
|
||||
|
||||
templates = Jinja2Templates(directory="src/templates")
|
||||
|
||||
@@ -15,6 +15,7 @@ api_router.include_router(route_worktype.router, tags=["webapp"])
|
||||
api_router.include_router(route_media.router, tags=["webapp"])
|
||||
api_router.include_router(route_actors.router, tags=["webapp"])
|
||||
api_router.include_router(route_videos.router, tags=["webapp"])
|
||||
api_router.include_router(route_lofi.router, tags=["webapp"])
|
||||
api_router.include_router(route_login.router, tags=["webapp"])
|
||||
api_router.include_router(route_admin.router, tags=["webapp"])
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ from typing import AnyStr
|
||||
from src.db.repository.comics.artist import update_artist
|
||||
from src.db.session import SessionDep
|
||||
#from src.db.repository.comic import create_new_worktype, update_worktype
|
||||
from src.main import logger
|
||||
from src.schema.comics.artist import AddArtist
|
||||
from src.webapps.comic.forms.artist import AddArtistForm
|
||||
|
||||
@@ -35,7 +34,7 @@ def edit_artist(db: SessionDep, request: Request, artist_id: str):
|
||||
return templates.TemplateResponse("comic/artist_edit.html", {"request": request, "artist_name": artist.name, "artist_link": artist.weblink})
|
||||
|
||||
@router.post("/artist/edit/{artist_id}")
|
||||
async def edit_artist(request: Request, db: SessionDep, artist_id: str, action: str = Form(...), artist_name: str = Form(...), artist_link: str = Form(...)):
|
||||
async def edit_artist_post(request: Request, db: SessionDep, artist_id: str, action: str = Form(...), artist_name: str = Form(...), artist_link: str = Form(...)):
|
||||
if action == "cancel":
|
||||
return RedirectResponse(f"/comic/artists/{artist_id}", status_code=status.HTTP_303_SEE_OTHER)
|
||||
form = AddArtistForm(request, artist_id, artist_name, artist_link)
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, Request, status, responses, Query
|
||||
from fastapi.security.utils import get_authorization_scheme_param
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
from src.core.config import Settings
|
||||
from src.core.security import get_current_user_from_token
|
||||
from src.db.models.media import MediaLofi
|
||||
from src.db.models.admin import Profile
|
||||
from src.db.repository.media.lofi import create_new_lofi
|
||||
from src.db.session import SessionDep
|
||||
from src.webapps.media.forms import AddLinkForm
|
||||
|
||||
templates = Jinja2Templates(directory="src/templates")
|
||||
router = APIRouter(include_in_schema=False, prefix="/media")
|
||||
|
||||
@router.get("/lofis")
|
||||
def get_medialofis(db: SessionDep, request: Request, msg: Optional[str] = None, review: Optional[bool] = Query(default=False), download: Optional[bool] = Query(default=False)):
|
||||
medialofis = db.query(MediaLofi).all()
|
||||
try:
|
||||
token = request.cookies.get("access_token")
|
||||
_, param = get_authorization_scheme_param(token) # scheme will hold "Bearer" and param will hold actual token value
|
||||
current_user: Profile = get_current_user_from_token(token=param)
|
||||
request.params.get("review")
|
||||
return templates.TemplateResponse("media/lofi_list.html", {
|
||||
"request": request,
|
||||
"msg": msg,
|
||||
"user": current_user,
|
||||
"version": Settings.PROJECT_VERSION,
|
||||
"review": review,
|
||||
"download": download,
|
||||
"medialofis": medialofis,
|
||||
})
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return templates.TemplateResponse("media/lofi_list.html", {"request": request, "msg": msg, "user": None, "medialofis": medialofis})
|
||||
|
||||
@router.get("/lofis/{lofi_id}")
|
||||
def lofi_details(lofi_id: str, request: Request, db: SessionDep):
|
||||
medialofi = db.get(MediaLofi, lofi_id)
|
||||
return templates.TemplateResponse("media/lofi_detail.html", {"request": request, "medialofi":medialofi})
|
||||
|
||||
@router.get("/lofis/add")
|
||||
def add_lofi_link(request: Request, db: SessionDep):
|
||||
return templates.TemplateResponse("media/add_lofi_link.html", {"request": request})
|
||||
|
||||
@router.post("/lofis/add")
|
||||
async def post_lofi_link(request: Request, db: SessionDep):
|
||||
form = AddLinkForm(request)
|
||||
await form.load_data()
|
||||
if form.is_valid():
|
||||
try:
|
||||
#video = AddLink(**form.__dict__)
|
||||
medialofi = create_new_lofi(url=str(form.url), db=db)
|
||||
return responses.RedirectResponse(f"media/lofi/{medialofi.id}", status_code=status.HTTP_302_FOUND)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
form.__dict__.get("errors").append("Link already added")
|
||||
return templates.TemplateResponse("media/add_lofi_link.html", form.__dict__)
|
||||
return templates.TemplateResponse("media/add_lofi_link.html", form.__dict__)
|
||||
@@ -37,7 +37,7 @@ def get_mediafiles(db: SessionDep, request: Request, msg: str | None = None):
|
||||
try:
|
||||
token = request.cookies.get("access_token")
|
||||
scheme, param = get_authorization_scheme_param(token) # scheme will hold "Bearer" and param will hold actual token value
|
||||
current_user: Profile = get_current_user_from_token(token=param)
|
||||
#current_user: Profile = get_current_user_from_token(token=param)
|
||||
return templates.TemplateResponse("media/files.html", {"request": request, "msg": msg, "mediafiles": mediafiles})
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, Request, status, responses
|
||||
from fastapi.security.utils import get_authorization_scheme_param
|
||||
from fastapi.templating import Jinja2Templates
|
||||
@@ -13,12 +15,12 @@ templates = Jinja2Templates(directory="src/templates")
|
||||
router = APIRouter(include_in_schema=False, prefix="/media")
|
||||
|
||||
@router.get("/videos")
|
||||
def get_mediavideos(db: SessionDep, request: Request, msg: str = None):
|
||||
def get_mediavideos(db: SessionDep, request: Request, msg: Optional[str] = None):
|
||||
mediavideos = db.query(MediaVideo).all()
|
||||
try:
|
||||
token = request.cookies.get("access_token")
|
||||
_, param = get_authorization_scheme_param(token) # scheme will hold "Bearer" and param will hold actual token value
|
||||
current_user: Profile = get_current_user_from_token(token=param, db=db)
|
||||
current_user: Profile = get_current_user_from_token(token=param)
|
||||
return templates.TemplateResponse("media/videos.html", {"request": request, "msg": msg, "user": current_user, "mediavideos": mediavideos})
|
||||
except Exception as e:
|
||||
print(e)
|
||||
@@ -40,7 +42,7 @@ async def post_video_link(request: Request, db: SessionDep):
|
||||
if form.is_valid():
|
||||
try:
|
||||
#video = AddLink(**form.__dict__)
|
||||
mediavideo = create_new_video(video=form, db=db)
|
||||
mediavideo = create_new_video(url=str(form.url), db=db)
|
||||
return responses.RedirectResponse(f"media/videos/{mediavideo.id}", status_code=status.HTTP_302_FOUND)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
Generated
+1131
-461
File diff suppressed because it is too large
Load Diff
@@ -1,39 +0,0 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'jacoco'
|
||||
id 'test-report-aggregation'
|
||||
id 'jacoco-report-aggregation'
|
||||
alias(libs.plugins.lombok)
|
||||
}
|
||||
|
||||
repositories {
|
||||
//maven { setUrl("https://nexus.thpeetz.de/repository/maven-central") }
|
||||
mavenCentral()
|
||||
maven { setUrl("https://repo.spring.io/milestone") }
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
configurations {
|
||||
developmentOnly
|
||||
runtimeClasspath {
|
||||
extendsFrom developmentOnly
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
//implementation 'org.postgresql:postgresql'
|
||||
//implementation 'org.hibernate.orm:hibernate-community-dialects'
|
||||
compileOnly libs.spring.data
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
}
|
||||
|
||||
wrapper {
|
||||
gradleVersion = "8.6"
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
[versions]
|
||||
gradle = "8.6"
|
||||
args4j = "2.33"
|
||||
commonscli = "1.5.0"
|
||||
junit = "5.8.2"
|
||||
logback = "1.1.2"
|
||||
mockito = "1.9.5"
|
||||
picoli = "4.7.0"
|
||||
slf4j = "1.7.22"
|
||||
hsqldb = "2.7.1"
|
||||
sqlite = "3.25.2"
|
||||
spotbugs = "6.0.7"
|
||||
asciidoctor = "4.0.2"
|
||||
rouge = "3.15.0"
|
||||
#diagram = "2.2.2"
|
||||
diagram = "2.3.1"
|
||||
sonarqube = "3.3"
|
||||
cimtConventions = "1.0.0-SNAPSHOT"
|
||||
springboot = "3.2.5"
|
||||
springdependencies = "1.1.4"
|
||||
vaadin = "24.3.8"
|
||||
camel = "4.10.6"
|
||||
artemis = "2.41.0"
|
||||
lombok = "8.6"
|
||||
gson = "2.9.0"
|
||||
jackson = "2.16.1"
|
||||
json_simple = "1.1.1"
|
||||
mail = "1.6.2"
|
||||
hypersistence = "3.9.10"
|
||||
|
||||
[libraries]
|
||||
args4j = { module = "args4j:args4j", version.ref = "args4j" }
|
||||
commonscli = { module = "commons-cli:commons-cli", version.ref = "commonscli" }
|
||||
junit = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
|
||||
logbackCore = { module = "ch.qos.logback:logback-core", version.ref = "logback" }
|
||||
logbackClassic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
|
||||
mockito = { module = "org.mockito:mockito-all", version.ref = "mockito" }
|
||||
picocli = { module = "info.picocli:picocli", version.ref = "picoli" }
|
||||
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
|
||||
hsqldb = { module = "org.hsqldb:hsqldb", version.ref = "hsqldb" }
|
||||
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
|
||||
jackson = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
|
||||
json = { module = "com.googlecode.json-simple:json-simple", version.ref ="json_simple" }
|
||||
mail = { module = "com.sun.mail:javax.mail", version.ref ="mail" }
|
||||
sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version.ref = "sqlite" }
|
||||
hypersistence = { module = "io.hypersistence:hypersistence-utils-hibernate-63", version.ref = "hypersistence" }
|
||||
vaadin-bom = { module = "com.vaadin:vaadin-bom", version.ref = "vaadin" }
|
||||
camel-bom = { module = "org.apache.camel.springboot:camel-spring-boot-bom", version.ref = "camel"}
|
||||
spring-data = { module = "org.springframework.data:spring-data-jpa", version.ref = "springboot" }
|
||||
artemis = { module = "org.apache.activemq:artemis-jms-server", version.ref = "artemis" }
|
||||
asciidoctorGradleJvmGems = { module = "org.asciidoctor:asciidoctor-gradle-jvm-gems", version.ref= "asciidoctor" }
|
||||
asciidoctorGradleJvm = { module = "org.asciidoctor:asciidoctor-gradle-jvm", version.ref= "asciidoctor" }
|
||||
asciidoctorGradleJvmPdf = { module = "org.asciidoctor:asciidoctor-gradle-jvm-pdf", version.ref= "asciidoctor" }
|
||||
rouge = { module = "rubygems:rouge", version.ref = "rouge" }
|
||||
diagram = { module = "rubygems:asciidoctor-diagram", version.ref = "diagram" }
|
||||
|
||||
[bundles]
|
||||
logback = ["logbackCore", "logbackClassic"]
|
||||
|
||||
[plugins]
|
||||
spotbugs = { id = "com.github.spotbugs", version.ref = "spotbugs" }
|
||||
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }
|
||||
asciidoctorPdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor" }
|
||||
asciidoctorConvert = { id = "org.asciidoctor.jvm.convert", version.ref = "asciidoctor" }
|
||||
asciidoctorGems = { id = "org.asciidoctor.jvm.gems", version.ref = "asciidoctor" }
|
||||
javaConvention = { id = "de.cimt.java-conventions", version.ref = "cimtConventions" }
|
||||
applicationConvention = { id = "de.cimt.application-conventions", version.ref = "cimtConventions" }
|
||||
libraryConvention = { id = "de.cimt.library-conventions", version.ref = "cimtConventions" }
|
||||
asciidoctorConvention = { id = "de.cimt.asciidoctor-conventions", version.ref = "cimtConventions" }
|
||||
spring-boot = { id = "org.springframework.boot", version.ref = "springboot"}
|
||||
spring-dependencies = { id = "io.spring.dependency-management", version.ref = "springdependencies" }
|
||||
vaadin = { id = "com.vaadin", version.ref = "vaadin" }
|
||||
lombok = { id = "io.freefair.lombok", version.ref = "lombok" }
|
||||
BIN
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
Vendored
-248
@@ -1,248 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
-82
@@ -1,82 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
@@ -1,24 +0,0 @@
|
||||
pluginManagement {
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
if (requested.id.id == 'org.springframework.boot') {
|
||||
useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}")
|
||||
}
|
||||
if (requested.id.id == 'org.gradle.toolchains.foojay-resolver') {
|
||||
useModule("org.gradle.toolchains.foojay-resolver-convention:0.4.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
maven { setUrl("https://maven.vaadin.com/vaadin-prereleases") }
|
||||
maven { setUrl("https://repo.spring.io/milestone") }
|
||||
maven { url 'https://plugins.gradle.org/m2/' }
|
||||
}
|
||||
// plugins {
|
||||
// id 'com.vaadin' version "${vaadinVersion}"
|
||||
// }
|
||||
}
|
||||
|
||||
rootProject.name = 'kontor-spring'
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user