diff --git a/.github/workflows/coding-style.yml b/.github/workflows/coding-style.yml
index eb14d7a6..c596b6d7 100644
--- a/.github/workflows/coding-style.yml
+++ b/.github/workflows/coding-style.yml
@@ -2,20 +2,6 @@ name: Coding Style
on: [pull_request, workflow_dispatch]
jobs:
- back:
- name: "Lint Back"
- runs-on: ubuntu-latest
- defaults:
- run:
- working-directory: ./back
- steps:
- - uses: actions/checkout@v5
-
- - name: Check coding style
- run: |
- dotnet tool restore
- dotnet csharpier . --check
-
api:
name: "Lint api"
runs-on: ubuntu-latest
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index a57cfa62..0dbcc976 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -19,16 +19,6 @@ jobs:
fail-fast: false
matrix:
include:
- - context: ./back
- dockerfile: Dockerfile
- label: back
- image: ${{ github.repository_owner }}/kyoo_back
-
- - context: ./back
- dockerfile: Dockerfile.migrations
- label: migrations
- image: ${{ github.repository_owner }}/kyoo_migrations
-
- context: ./api
dockerfile: Dockerfile
label: api
diff --git a/back/.config/dotnet-tools.json b/back/.config/dotnet-tools.json
deleted file mode 100644
index 4cdf7699..00000000
--- a/back/.config/dotnet-tools.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "version": 1,
- "isRoot": true,
- "tools": {
- "dotnet-ef": {
- "version": "8.0.21",
- "commands": [
- "dotnet-ef"
- ]
- },
- "csharpier": {
- "version": "0.28.2",
- "commands": [
- "dotnet-csharpier"
- ]
- }
- }
-}
\ No newline at end of file
diff --git a/back/.dockerignore b/back/.dockerignore
deleted file mode 100644
index 9f8aece3..00000000
--- a/back/.dockerignore
+++ /dev/null
@@ -1,17 +0,0 @@
-Dockerfile
-Dockerfile.dev
-Dockerfile.*
-.dockerignore
-.gitignore
-docker-compose.yml
-README.md
-**/build
-**/dist
-**/bin
-**/obj
-out
-docs
-tests
-front
-video
-nginx.conf.template
diff --git a/back/.editorconfig b/back/.editorconfig
deleted file mode 100644
index 30728be6..00000000
--- a/back/.editorconfig
+++ /dev/null
@@ -1,99 +0,0 @@
-root = false
-
-[*]
-charset = utf-8
-end_of_line = lf
-trim_trailing_whitespace = true
-insert_final_newline = true
-indent_style = tab
-indent_size = tab
-smart_tab = true
-
-[*.cs]
-csharp_prefer_braces = false
-dotnet_diagnostic.IDE0046.severity = none
-dotnet_diagnostic.IDE0055.severity = none
-dotnet_diagnostic.IDE0058.severity = none
-dotnet_diagnostic.IDE0130.severity = none
-
-# Convert to file-scoped namespace
-csharp_style_namespace_declarations = file_scoped:warning
-# Sort using and Import directives with System.* appearing first
-dotnet_sort_system_directives_first = true
-csharp_using_directive_placement = outside_namespace:warning
-# Avoid "this." if not necessary
-dotnet_style_qualification_for_field = false:suggestion
-dotnet_style_qualification_for_property = false:suggestion
-dotnet_style_qualification_for_method = false:suggestion
-dotnet_style_qualification_for_event = false:suggestion
-# Use language keywords instead of framework type names for type references
-dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
-dotnet_style_predefined_type_for_member_access = true:suggestion
-# Suggest more modern language features when available
-dotnet_style_object_initializer = true:suggestion
-dotnet_style_collection_initializer = true:suggestion
-dotnet_style_coalesce_expression = true:suggestion
-dotnet_style_null_propagation = true:suggestion
-dotnet_style_explicit_tuple_names = true:suggestion
-csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
-csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
-csharp_style_inlined_variable_declaration = true:suggestion
-csharp_style_conditional_delegate_call = true:suggestion
-dotnet_style_prefer_auto_properties = true
-dotnet_style_prefer_conditional_expression_over_assignment = true
-dotnet_style_prefer_conditional_expression_over_return = true
-# Disable strange throw.
-csharp_style_throw_expression = false:suggestion
-# Forbid "var" everywhere
-csharp_style_var_for_built_in_types = false:suggestion
-csharp_style_var_when_type_is_apparent = false:suggestion
-csharp_style_var_elsewhere = false:suggestion
-# Prefer method-like constructs to have a block body
-csharp_style_expression_bodied_methods = false:none
-csharp_style_expression_bodied_constructors = false:none
-csharp_style_expression_bodied_operators = false:none
-# Prefer property-like constructs to have an expression-body
-csharp_style_expression_bodied_properties = true:none
-csharp_style_expression_bodied_indexers = true:none
-csharp_style_expression_bodied_accessors = true:none
-# Newline settings
-csharp_new_line_before_open_brace = all
-csharp_new_line_before_else = true
-csharp_new_line_before_catch = true
-csharp_new_line_before_finally = true
-csharp_new_line_before_members_in_object_initializers = false
-csharp_new_line_before_members_in_anonymous_types = true
-# Indentation settings
-csharp_indent_case_contents = true
-csharp_indent_switch_labels = true
-# Modifiers
-dotnet_style_readonly_field = true:suggestion
-dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
-# Naming style
-dotnet_naming_symbols.privates.applicable_kinds = property,method,event,delegate
-dotnet_naming_symbols.privates.applicable_accessibilities = private
-dotnet_naming_style.underscore_pascal.capitalization = pascal_case
-dotnet_naming_style.underscore_pascal.required_prefix = _
-dotnet_naming_rule.privates_with_underscore.symbols = privates
-dotnet_naming_rule.privates_with_underscore.style = underscore_pascal
-dotnet_naming_rule.privates_with_underscore.severity = warning
-dotnet_diagnostic.IDE1006.severity = warning
-# ReSharper properties
-resharper_align_multiline_binary_expressions_chain = false
-resharper_csharp_empty_block_style = together_same_line
-resharper_indent_nested_foreach_stmt = true
-resharper_indent_nested_for_stmt = true
-resharper_indent_nested_while_stmt = true
-resharper_keep_existing_embedded_arrangement = false
-resharper_place_accessorholder_attribute_on_same_line = true
-resharper_place_simple_embedded_statement_on_same_line = false
-resharper_wrap_before_arrow_with_expressions = true
-resharper_xmldoc_attribute_indent = align_by_first_attribute
-resharper_xmldoc_indent_child_elements = RemoveIndent
-resharper_xmldoc_indent_text = RemoveIndent
-# Switch on enum
-dotnet_diagnostic.CS8509.severity=error # missing switch case for named enum value
-dotnet_diagnostic.CS8524.severity=none # missing switch case for unnamed enum value
-
-# Waiting for https://github.com/dotnet/roslyn/issues/44596 to get fixed.
-# file_header_template = Kyoo - A portable and vast media library solution.\nCopyright (c) Kyoo.\n\nSee AUTHORS.md and LICENSE file in the project root for full license information.\n\nKyoo is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\nany later version.\n\nKyoo is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Kyoo. If not, see .
diff --git a/back/.env.example b/back/.env.example
deleted file mode 100644
index 42beea2d..00000000
--- a/back/.env.example
+++ /dev/null
@@ -1,37 +0,0 @@
-# vi: ft=sh
-# shellcheck disable=SC2034
-
-# http route prefix (will listen to $KYOO_PREFIX/movie for example)
-KYOO_PREFIX=""
-
-
-# Optional authentication settings
-# Set to true to disable login with password (OIDC auth must be configured)
-# AUTHENTICATION_DISABLE_PASSWORD_LOGIN=true
-# Set to true to disable the creation of new users (OIDC auth must be configured)
-# AUTHENTICATION_DISABLE_USER_REGISTRATION=true
-
-# Postgres settings
-# POSTGRES_URL=postgres://user:password@hostname:port/dbname?sslmode=verify-full&sslrootcert=/path/to/server.crt&sslcert=/path/to/client.crt&sslkey=/path/to/client.key
-# The behavior of the below variables match what is documented here:
-# https://www.postgresql.org/docs/current/libpq-envars.html
-PGUSER=kyoo
-PGPASSWORD=password
-PGDB=kyooDB
-PGSERVER=postgres
-PGPORT=5432
-# PGOPTIONS=-c search_path=kyoo,public
-# PGPASSFILE=/my/password # Takes precedence over PGPASSWORD. New line characters are not trimmed.
-# PGSSLMODE=verify-full
-# PGSSLROOTCERT=/my/serving.crt
-# PGSSLCERT=/my/client.crt
-# PGSSLKEY=/my/client.key
-
-# RabbitMQ settings
-# Full list of options: https://www.rabbitmq.com/uri-spec.html, https://www.rabbitmq.com/docs/uri-query-parameters
-# RABBITMQ_URL=amqps://user:password@rabbitmq-server:1234/vhost?cacertfile=/path/to/cacert.pem&certfile=/path/to/cert.pem&keyfile=/path/to/key.pem&verify=verify_peer&auth_mechanism=EXTERNAL
-# These values override what is provided the the URL variable
-RABBITMQ_DEFAULT_USER=guest
-RABBITMQ_DEFAULT_PASS=guest
-RABBITMQ_HOST=rabbitmq
-RABBITMQ_PORT=5672
diff --git a/back/.gitignore b/back/.gitignore
deleted file mode 100644
index 906935b3..00000000
--- a/back/.gitignore
+++ /dev/null
@@ -1,352 +0,0 @@
-out
-libtranscoder.so
-libtranscoder.dylib
-transcoder.dll
-kyoo_datadir
-
-video
-.env
-
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-##
-## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
-
-# User-specific files
-*.rsuser
-*.suo
-*.user
-*.userosscache
-*.sln.docstates
-
-# User-specific files (MonoDevelop/Xamarin Studio)
-*.userprefs
-
-# Build results
-[Dd]ebug/
-[Dd]ebugPublic/
-[Rr]elease/
-[Rr]eleases/
-x64/
-x86/
-[Aa][Rr][Mm]/
-[Aa][Rr][Mm]64/
-bld/
-[Bb]in/
-[Oo]bj/
-[Ll]og/
-
-# Visual Studio 2015/2017 cache/options directory
-.vs/
-# Uncomment if you have tasks that create the project's static files in wwwroot
-#wwwroot/
-
-# Visual Studio 2017 auto generated files
-Generated\ Files/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUNIT
-*.VisualState.xml
-TestResult.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-# Benchmark Results
-BenchmarkDotNet.Artifacts/
-
-# .NET Core
-project.lock.json
-project.fragment.lock.json
-artifacts/
-
-# StyleCop
-StyleCopReport.xml
-
-# Files built by Visual Studio
-*_i.c
-*_p.c
-*_h.h
-*.ilk
-*.meta
-*.obj
-*.iobj
-*.pch
-*.pdb
-*.ipdb
-*.pgc
-*.pgd
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*_wpftmp.csproj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opendb
-*.opensdf
-*.sdf
-*.cachefile
-*.VC.db
-*.VC.VC.opendb
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-*.sap
-
-# Visual Studio Trace Files
-*.e2e
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# JustCode is a .NET coding add-in
-.JustCode
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# AxoCover is a Code Coverage Tool
-.axoCover/*
-!.axoCover/settings.json
-
-# Visual Studio code coverage results
-*.coverage
-*.coveragexml
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-nCrunchTemp_*
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-# Note: Comment the next line if you want to checkin your web deploy settings,
-# but database connection strings (with potential passwords) will be unencrypted
-*.pubxml
-*.publishproj
-
-# Microsoft Azure Web App publish settings. Comment the next line if you want to
-# checkin your Azure Web App publish settings, but sensitive information contained
-# in these scripts will be unencrypted
-PublishScripts/
-
-# NuGet Packages
-*.nupkg
-# The packages folder can be ignored because of Package Restore
-**/[Pp]ackages/*
-# except build/, which is used as an MSBuild target.
-!**/[Pp]ackages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/[Pp]ackages/repositories.config
-# NuGet v3's project.json files produces more ignorable files
-*.nuget.props
-*.nuget.targets
-
-# Microsoft Azure Build Output
-csx/
-*.build.csdef
-
-# Microsoft Azure Emulator
-ecf/
-rcf/
-
-# Windows Store app package directories and files
-AppPackages/
-BundleArtifacts/
-Package.StoreAssociation.xml
-_pkginfo.txt
-*.appx
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!?*.[Cc]ache/
-
-# Others
-ClientBin/
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.jfm
-*.pfx
-*.publishsettings
-orleans.codegen.cs
-
-# Including strong name files can present a security risk
-# (https://github.com/github/gitignore/pull/2483#issue-259490424)
-#*.snk
-
-# Since there are multiple workflows, uncomment next line to ignore bower_components
-# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
-#bower_components/
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-ServiceFabricBackup/
-*.rptproj.bak
-
-# SQL Server files
-*.mdf
-*.ldf
-*.ndf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-*.rptproj.rsuser
-*- Backup*.rdl
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# GhostDoc plugin setting file
-*.GhostDoc.xml
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-node_modules/
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
-*.vbw
-
-# Visual Studio LightSwitch build output
-**/*.HTMLClient/GeneratedArtifacts
-**/*.DesktopClient/GeneratedArtifacts
-**/*.DesktopClient/ModelManifest.xml
-**/*.Server/GeneratedArtifacts
-**/*.Server/ModelManifest.xml
-_Pvt_Extensions
-
-# Paket dependency manager
-.paket/paket.exe
-paket-files/
-
-# FAKE - F# Make
-.fake/
-
-# JetBrains Rider
-.idea/
-*.sln.iml
-
-# CodeRush personal settings
-.cr/personal
-
-# Python Tools for Visual Studio (PTVS)
-__pycache__/
-*.pyc
-
-# Cake - Uncomment if you are using it
-# tools/**
-# !tools/packages.config
-
-# Tabs Studio
-*.tss
-
-# Telerik's JustMock configuration file
-*.jmconfig
-
-# BizTalk build output
-*.btp.cs
-*.btm.cs
-*.odx.cs
-*.xsd.cs
-
-# OpenCover UI analysis results
-OpenCover/
-
-# Azure Stream Analytics local run output
-ASALocalRun/
-
-# MSBuild Binary and Structured Log
-*.binlog
-
-# NVidia Nsight GPU debugger configuration file
-*.nvuser
-
-# MFractors (Xamarin productivity tool) working folder
-.mfractor/
-
-# Local History for Visual Studio
-.localhistory/
-
-# BeatPulse healthcheck temp database
-healthchecksdb
-/Kyoo/TheTVDB-Credentials.json
-
-.vscode
-.netcoredbg_hist
diff --git a/back/Dockerfile b/back/Dockerfile
deleted file mode 100644
index 4bbc4f5b..00000000
--- a/back/Dockerfile
+++ /dev/null
@@ -1,29 +0,0 @@
-FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 as builder
-ARG TARGETARCH
-WORKDIR /kyoo
-
-COPY Kyoo.sln ./Kyoo.sln
-COPY nuget.config ./nuget.config
-COPY src/Directory.Build.props src/Directory.Build.props
-COPY src/Kyoo.Authentication/Kyoo.Authentication.csproj src/Kyoo.Authentication/Kyoo.Authentication.csproj
-COPY src/Kyoo.Abstractions/Kyoo.Abstractions.csproj src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
-COPY src/Kyoo.Core/Kyoo.Core.csproj src/Kyoo.Core/Kyoo.Core.csproj
-COPY src/Kyoo.Postgresql/Kyoo.Postgresql.csproj src/Kyoo.Postgresql/Kyoo.Postgresql.csproj
-COPY src/Kyoo.Meilisearch/Kyoo.Meilisearch.csproj src/Kyoo.Meilisearch/Kyoo.Meilisearch.csproj
-COPY src/Kyoo.RabbitMq/Kyoo.RabbitMq.csproj src/Kyoo.RabbitMq/Kyoo.RabbitMq.csproj
-COPY src/Kyoo.Swagger/Kyoo.Swagger.csproj src/Kyoo.Swagger/Kyoo.Swagger.csproj
-RUN dotnet restore -a $TARGETARCH
-
-COPY . .
-ARG VERSION
-RUN dotnet publish -a $TARGETARCH --no-restore -c Release -o /app "-p:Version=${VERSION:-"0.0.0-dev"}" src/Kyoo.Core
-
-FROM mcr.microsoft.com/dotnet/aspnet:8.0
-RUN apt-get update && apt-get install -y curl
-COPY --from=builder /app /app
-
-WORKDIR /app
-EXPOSE 5000
-# The back can take a long time to start if meilisearch is initializing
-HEALTHCHECK --interval=30s --retries=15 CMD curl --fail http://localhost:5000/health || exit
-ENTRYPOINT ["/app/kyoo"]
diff --git a/back/Dockerfile.dev b/back/Dockerfile.dev
deleted file mode 100644
index b4428070..00000000
--- a/back/Dockerfile.dev
+++ /dev/null
@@ -1,22 +0,0 @@
-FROM mcr.microsoft.com/dotnet/sdk:8.0
-RUN apt-get update && apt-get install -y curl
-WORKDIR /app
-
-COPY Kyoo.sln ./Kyoo.sln
-COPY nuget.config ./nuget.config
-COPY src/Directory.Build.props src/Directory.Build.props
-COPY src/Kyoo.Authentication/Kyoo.Authentication.csproj src/Kyoo.Authentication/Kyoo.Authentication.csproj
-COPY src/Kyoo.Abstractions/Kyoo.Abstractions.csproj src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
-COPY src/Kyoo.Core/Kyoo.Core.csproj src/Kyoo.Core/Kyoo.Core.csproj
-COPY src/Kyoo.Postgresql/Kyoo.Postgresql.csproj src/Kyoo.Postgresql/Kyoo.Postgresql.csproj
-COPY src/Kyoo.Meilisearch/Kyoo.Meilisearch.csproj src/Kyoo.Meilisearch/Kyoo.Meilisearch.csproj
-COPY src/Kyoo.RabbitMq/Kyoo.RabbitMq.csproj src/Kyoo.RabbitMq/Kyoo.RabbitMq.csproj
-COPY src/Kyoo.Swagger/Kyoo.Swagger.csproj src/Kyoo.Swagger/Kyoo.Swagger.csproj
-RUN dotnet restore
-
-WORKDIR /app
-EXPOSE 5000
-ENV DOTNET_USE_POLLING_FILE_WATCHER 1
-# HEALTHCHECK --interval=30s CMD curl --fail http://localhost:5000/health || exit
-HEALTHCHECK CMD true
-ENTRYPOINT ["dotnet", "watch", "--non-interactive", "run", "--no-restore", "--project", "/app/src/Kyoo.Core"]
diff --git a/back/Dockerfile.migrations b/back/Dockerfile.migrations
deleted file mode 100644
index 2278e642..00000000
--- a/back/Dockerfile.migrations
+++ /dev/null
@@ -1,30 +0,0 @@
-FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 as builder
-ARG TARGETARCH
-WORKDIR /kyoo
-
-COPY .config/dotnet-tools.json .config/dotnet-tools.json
-RUN dotnet tool restore
-
-COPY Kyoo.sln ./Kyoo.sln
-COPY nuget.config ./nuget.config
-COPY src/Directory.Build.props src/Directory.Build.props
-COPY src/Kyoo.Authentication/Kyoo.Authentication.csproj src/Kyoo.Authentication/Kyoo.Authentication.csproj
-COPY src/Kyoo.Abstractions/Kyoo.Abstractions.csproj src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
-COPY src/Kyoo.Core/Kyoo.Core.csproj src/Kyoo.Core/Kyoo.Core.csproj
-COPY src/Kyoo.Postgresql/Kyoo.Postgresql.csproj src/Kyoo.Postgresql/Kyoo.Postgresql.csproj
-COPY src/Kyoo.Meilisearch/Kyoo.Meilisearch.csproj src/Kyoo.Meilisearch/Kyoo.Meilisearch.csproj
-COPY src/Kyoo.RabbitMq/Kyoo.RabbitMq.csproj src/Kyoo.RabbitMq/Kyoo.RabbitMq.csproj
-COPY src/Kyoo.Swagger/Kyoo.Swagger.csproj src/Kyoo.Swagger/Kyoo.Swagger.csproj
-RUN dotnet restore -a $TARGETARCH
-
-COPY . .
-RUN dotnet build
-RUN dotnet ef migrations bundle \
- --msbuildprojectextensionspath out/obj/Kyoo.Postgresql \
- --no-build --self-contained -r linux-${TARGETARCH} -f \
- -o /app/migrate -p src/Kyoo.Postgresql --verbose
-
-FROM mcr.microsoft.com/dotnet/runtime-deps:8.0
-COPY --from=builder /app/migrate /app/migrate
-
-ENTRYPOINT ["/app/migrate"]
diff --git a/back/Kyoo.ruleset b/back/Kyoo.ruleset
deleted file mode 100644
index 82ed916b..00000000
--- a/back/Kyoo.ruleset
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/back/Kyoo.sln b/back/Kyoo.sln
deleted file mode 100644
index 1c1c9fd5..00000000
--- a/back/Kyoo.sln
+++ /dev/null
@@ -1,64 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-#
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kyoo.Core", "src\Kyoo.Core\Kyoo.Core.csproj", "{0F8275B6-C7DD-42DF-A168-755C81B1C329}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kyoo.Abstractions", "src\Kyoo.Abstractions\Kyoo.Abstractions.csproj", "{BAB2CAE1-AC28-4509-AA3E-8DC75BD59220}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kyoo.Postgresql", "src\Kyoo.Postgresql\Kyoo.Postgresql.csproj", "{3213C96D-0BF3-460B-A8B5-B9977229408A}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kyoo.Authentication", "src\Kyoo.Authentication\Kyoo.Authentication.csproj", "{7A841335-6523-47DB-9717-80AA7BD943FD}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kyoo.Swagger", "src\Kyoo.Swagger\Kyoo.Swagger.csproj", "{7D1A7596-73F6-4D35-842E-A5AD9C620596}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kyoo.Meilisearch", "src\Kyoo.Meilisearch\Kyoo.Meilisearch.csproj", "{F8E6018A-FD51-40EB-99FF-A26BA59F2762}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kyoo.RabbitMq", "src\Kyoo.RabbitMq\Kyoo.RabbitMq.csproj", "{B97AD4A8-E6E6-41CD-87DF-5F1326FD7198}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {0F8275B6-C7DD-42DF-A168-755C81B1C329}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0F8275B6-C7DD-42DF-A168-755C81B1C329}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0F8275B6-C7DD-42DF-A168-755C81B1C329}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0F8275B6-C7DD-42DF-A168-755C81B1C329}.Release|Any CPU.Build.0 = Release|Any CPU
- {BAB2CAE1-AC28-4509-AA3E-8DC75BD59220}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BAB2CAE1-AC28-4509-AA3E-8DC75BD59220}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BAB2CAE1-AC28-4509-AA3E-8DC75BD59220}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BAB2CAE1-AC28-4509-AA3E-8DC75BD59220}.Release|Any CPU.Build.0 = Release|Any CPU
- {3213C96D-0BF3-460B-A8B5-B9977229408A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3213C96D-0BF3-460B-A8B5-B9977229408A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3213C96D-0BF3-460B-A8B5-B9977229408A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3213C96D-0BF3-460B-A8B5-B9977229408A}.Release|Any CPU.Build.0 = Release|Any CPU
- {7A841335-6523-47DB-9717-80AA7BD943FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7A841335-6523-47DB-9717-80AA7BD943FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7A841335-6523-47DB-9717-80AA7BD943FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7A841335-6523-47DB-9717-80AA7BD943FD}.Release|Any CPU.Build.0 = Release|Any CPU
- {6515380E-1E57-42DA-B6E3-E1C8A848818A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6515380E-1E57-42DA-B6E3-E1C8A848818A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6515380E-1E57-42DA-B6E3-E1C8A848818A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6515380E-1E57-42DA-B6E3-E1C8A848818A}.Release|Any CPU.Build.0 = Release|Any CPU
- {2374D500-1ADB-4752-85DB-8BB0DDF5A8E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2374D500-1ADB-4752-85DB-8BB0DDF5A8E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2374D500-1ADB-4752-85DB-8BB0DDF5A8E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2374D500-1ADB-4752-85DB-8BB0DDF5A8E8}.Release|Any CPU.Build.0 = Release|Any CPU
- {4FF1ECD9-6EEF-4440-B037-A661D78FB04D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4FF1ECD9-6EEF-4440-B037-A661D78FB04D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4FF1ECD9-6EEF-4440-B037-A661D78FB04D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4FF1ECD9-6EEF-4440-B037-A661D78FB04D}.Release|Any CPU.Build.0 = Release|Any CPU
- {7D1A7596-73F6-4D35-842E-A5AD9C620596}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7D1A7596-73F6-4D35-842E-A5AD9C620596}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7D1A7596-73F6-4D35-842E-A5AD9C620596}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7D1A7596-73F6-4D35-842E-A5AD9C620596}.Release|Any CPU.Build.0 = Release|Any CPU
- {F8E6018A-FD51-40EB-99FF-A26BA59F2762}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F8E6018A-FD51-40EB-99FF-A26BA59F2762}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F8E6018A-FD51-40EB-99FF-A26BA59F2762}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F8E6018A-FD51-40EB-99FF-A26BA59F2762}.Release|Any CPU.Build.0 = Release|Any CPU
- {B97AD4A8-E6E6-41CD-87DF-5F1326FD7198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B97AD4A8-E6E6-41CD-87DF-5F1326FD7198}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B97AD4A8-E6E6-41CD-87DF-5F1326FD7198}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B97AD4A8-E6E6-41CD-87DF-5F1326FD7198}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
-EndGlobal
diff --git a/back/ef.rsp b/back/ef.rsp
deleted file mode 100644
index de6fae14..00000000
--- a/back/ef.rsp
+++ /dev/null
@@ -1,4 +0,0 @@
---project
-src/Kyoo.Postgresql
---msbuildprojectextensionspath
-out/obj/Kyoo.Postgresql
diff --git a/back/icon.ico b/back/icon.ico
deleted file mode 100644
index 8a6ef232..00000000
Binary files a/back/icon.ico and /dev/null differ
diff --git a/back/nuget.config b/back/nuget.config
deleted file mode 100644
index 36efeadd..00000000
--- a/back/nuget.config
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/back/shell.nix b/back/shell.nix
deleted file mode 100644
index b4fd8ad0..00000000
--- a/back/shell.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{pkgs ? import {}}: let
- dotnet = with pkgs.dotnetCorePackages;
- combinePackages [
- sdk_8_0
- aspnetcore_8_0
- ];
-in
- pkgs.mkShell {
- packages = with pkgs; [
- dotnet
- csharpier
- ];
-
- DOTNET_ROOT = "${dotnet}";
- }
diff --git a/back/src/Directory.Build.props b/back/src/Directory.Build.props
deleted file mode 100644
index 76832704..00000000
--- a/back/src/Directory.Build.props
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
- net8.0
- default
- enable
- Kyoo
- Kyoo
- Copyright (c) Kyoo
- true
- GPL-3.0-or-later
- true
-
- https://github.com/zoriya/Kyoo
- git
- true
- https://github.com/zoriya/Kyoo
-
- 1.0.0
- true
- snupkg
-
- $(MSBuildThisFileDirectory)../icon.ico
-
- true
-
-
-
- true
-
-
-
- $(MsBuildThisFileDirectory)/../out/obj/$(MSBuildProjectName)
- $(MsBuildThisFileDirectory)/../out/bin/$(MSBuildProjectName)
-
-
-
-
-
-
-
- $(MSBuildThisFileDirectory)../Kyoo.ruleset
- 1591;1305;8618;SYSLIB1045;CS1573
-
-
-
-
-
diff --git a/back/src/Kyoo.Abstractions/.gitignore b/back/src/Kyoo.Abstractions/.gitignore
deleted file mode 100644
index 8f7864db..00000000
--- a/back/src/Kyoo.Abstractions/.gitignore
+++ /dev/null
@@ -1,232 +0,0 @@
-## PROJECT CUSTOM IGNORES
-
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-
-# User-specific files
-*.suo
-*.user
-*.userosscache
-*.sln.docstates
-
-# User-specific files (MonoDevelop/Xamarin Studio)
-*.userprefs
-
-# Build results
-[Dd]ebug/
-[Dd]ebugPublic/
-[Rr]elease/
-[Rr]eleases/
-x64/
-x86/
-build/
-bld/
-bin/
-Bin/
-obj/
-Obj/
-
-# Visual Studio 2015 cache/options directory
-.vs/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUNIT
-*.VisualState.xml
-TestResult.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-*_i.c
-*_p.c
-*_i.h
-*.ilk
-*.meta
-*.obj
-*.pch
-*.pdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opendb
-*.opensdf
-*.sdf
-*.cachefile
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-*.sap
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# JustCode is a .NET coding add-in
-.JustCode
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-nCrunchTemp_*
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-# but database connection strings (with potential passwords) will be unencrypted
-*.pubxml
-*.publishproj
-
-# NuGet Packages
-*.nupkg
-# The packages folder can be ignored because of Package Restore
-**/packages/*
-# except build/, which is used as an MSBuild target.
-!**/packages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/packages/repositories.config
-
-# Microsoft Azure Build Output
-csx/
-*.build.csdef
-
-# Microsoft Azure Emulator
-ecf/
-rcf/
-
-# Microsoft Azure ApplicationInsights config file
-ApplicationInsights.config
-
-# Windows Store app package directory
-AppPackages/
-BundleArtifacts/
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!*.[Cc]ache/
-
-# Others
-ClientBin/
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.pfx
-*.publishsettings
-orleans.codegen.cs
-
-/node_modules
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-
-# SQL Server files
-*.mdf
-*.ldf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# GhostDoc plugin setting file
-*.GhostDoc.xml
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# Visual Studio LightSwitch build output
-**/*.HTMLClient/GeneratedArtifacts
-**/*.DesktopClient/GeneratedArtifacts
-**/*.DesktopClient/ModelManifest.xml
-**/*.Server/GeneratedArtifacts
-**/*.Server/ModelManifest.xml
-_Pvt_Extensions
-
-# Paket dependency manager
-.paket/paket.exe
-
-# FAKE - F# Make
-.fake/
diff --git a/back/src/Kyoo.Abstractions/Controllers/IIssueRepository.cs b/back/src/Kyoo.Abstractions/Controllers/IIssueRepository.cs
deleted file mode 100644
index 831e50bb..00000000
--- a/back/src/Kyoo.Abstractions/Controllers/IIssueRepository.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Kyoo.Abstractions.Models;
-using Kyoo.Abstractions.Models.Utils;
-
-namespace Kyoo.Abstractions.Controllers;
-
-public interface IIssueRepository
-{
- Task> GetAll(Filter? filter = default);
-
- Task GetCount(Filter? filter = default);
-
- Task Upsert(Issue issue);
-
- Task DeleteAll(Filter? filter = default);
-}
diff --git a/back/src/Kyoo.Abstractions/Controllers/ILibraryManager.cs b/back/src/Kyoo.Abstractions/Controllers/ILibraryManager.cs
deleted file mode 100644
index 8a1516b2..00000000
--- a/back/src/Kyoo.Abstractions/Controllers/ILibraryManager.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using Kyoo.Abstractions.Models;
-
-namespace Kyoo.Abstractions.Controllers;
-
-///
-/// An interface to interact with the database. Every repository is mapped through here.
-///
-public interface ILibraryManager
-{
- IRepository Repository()
- where T : IResource, IQuery;
-
- ///
- /// The repository that handle libraries items (a wrapper around shows and collections).
- ///
- IRepository LibraryItems { get; }
-
- ///
- /// The repository that handle new items.
- ///
- IRepository News { get; }
-
- ///
- /// The repository that handle watched items.
- ///
- IWatchStatusRepository WatchStatus { get; }
-
- ///
- /// The repository that handle collections.
- ///
- IRepository Collections { get; }
-
- ///
- /// The repository that handle shows.
- ///
- IRepository Movies { get; }
-
- ///
- /// The repository that handle shows.
- ///
- IRepository Shows { get; }
-
- ///
- /// The repository that handle seasons.
- ///
- IRepository Seasons { get; }
-
- ///
- /// The repository that handle episodes.
- ///
- IRepository Episodes { get; }
-
- ///
- /// The repository that handle studios.
- ///
- IRepository Studios { get; }
-
- ///
- /// The repository that handle users.
- ///
- IRepository Users { get; }
-}
diff --git a/back/src/Kyoo.Abstractions/Controllers/IPermissionValidator.cs b/back/src/Kyoo.Abstractions/Controllers/IPermissionValidator.cs
deleted file mode 100644
index 4aa35625..00000000
--- a/back/src/Kyoo.Abstractions/Controllers/IPermissionValidator.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using Kyoo.Abstractions.Models.Permissions;
-using Microsoft.AspNetCore.Mvc.Filters;
-
-namespace Kyoo.Abstractions.Controllers;
-
-///
-/// A service to validate permissions.
-///
-public interface IPermissionValidator
-{
- ///
- /// Create an IAuthorizationFilter that will be used to validate permissions.
- /// This can registered with any lifetime.
- ///
- /// The permission attribute to validate.
- /// An authorization filter used to validate the permission.
- IFilterMetadata Create(PermissionAttribute attribute);
-
- ///
- /// Create an IAuthorizationFilter that will be used to validate permissions.
- /// This can registered with any lifetime.
- ///
- ///
- /// A partial attribute to validate. See .
- ///
- /// An authorization filter used to validate the permission.
- IFilterMetadata Create(PartialPermissionAttribute attribute);
-}
diff --git a/back/src/Kyoo.Abstractions/Controllers/IRepository.cs b/back/src/Kyoo.Abstractions/Controllers/IRepository.cs
deleted file mode 100644
index 4dbdd953..00000000
--- a/back/src/Kyoo.Abstractions/Controllers/IRepository.cs
+++ /dev/null
@@ -1,267 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Kyoo.Abstractions.Models;
-using Kyoo.Abstractions.Models.Exceptions;
-using Kyoo.Abstractions.Models.Utils;
-
-namespace Kyoo.Abstractions.Controllers;
-
-///
-/// A common repository for every resources.
-///
-/// The resource's type that this repository manage.
-public interface IRepository : IBaseRepository
- where T : IResource, IQuery
-{
- ///
- /// The event handler type for all events of this repository.
- ///
- /// The resource created/modified/deleted
- /// A representing the asynchronous operation.
- public delegate Task ResourceEventHandler(T resource);
-
- ///
- /// Get a resource from it's ID.
- ///
- /// The id of the resource
- /// The related fields to include.
- /// If the item could not be found.
- /// The resource found
- Task Get(Guid id, Include? include = default);
-
- ///
- /// Get a resource from it's slug.
- ///
- /// The slug of the resource
- /// The related fields to include.
- /// If the item could not be found.
- /// The resource found
- Task Get(string slug, Include? include = default);
-
- ///
- /// Get the first resource that match the predicate.
- ///
- /// A predicate to filter the resource.
- /// The related fields to include.
- /// A custom sort method to handle cases where multiples items match the filters.
- /// Reverse the sort.
- /// Select the first element after this id if it was in a list.
- /// If the item could not be found.
- /// The resource found
- Task Get(
- Filter filter,
- Include? include = default,
- Sort? sortBy = default,
- bool reverse = false,
- Guid? afterId = default
- );
-
- ///
- /// Get a resource from it's ID or null if it is not found.
- ///
- /// The id of the resource
- /// The related fields to include.
- /// The resource found
- Task GetOrDefault(Guid id, Include? include = default);
-
- ///
- /// Get a resource from it's slug or null if it is not found.
- ///
- /// The slug of the resource
- /// The related fields to include.
- /// The resource found
- Task GetOrDefault(string slug, Include? include = default);
-
- ///
- /// Get the first resource that match the predicate or null if it is not found.
- ///
- /// A predicate to filter the resource.
- /// The related fields to include.
- /// A custom sort method to handle cases where multiples items match the filters.
- /// Reverse the sort.
- /// Select the first element after this id if it was in a list.
- /// The resource found
- Task GetOrDefault(
- Filter? filter,
- Include? include = default,
- Sort? sortBy = default,
- bool reverse = false,
- Guid? afterId = default
- );
-
- ///
- /// Search for resources with the database.
- ///
- /// The query string.
- /// The related fields to include.
- /// A list of resources found
- Task> Search(string query, Include? include = default);
-
- ///
- /// Get every resources that match all filters
- ///
- /// A filter predicate
- /// Sort information about the query (sort by, sort order)
- /// The related fields to include.
- /// How pagination should be done (where to start and how many to return)
- /// A list of resources that match every filters
- Task> GetAll(
- Filter? filter = null,
- Sort? sort = default,
- Include? include = default,
- Pagination? limit = default
- );
-
- ///
- /// Get the number of resources that match the filter's predicate.
- ///
- /// A filter predicate
- /// How many resources matched that filter
- Task GetCount(Filter? filter = null);
-
- ///
- /// Map a list of ids to a list of items (keep the order).
- ///
- /// The list of items id.
- /// The related fields to include.
- /// A list of resources mapped from ids.
- Task> FromIds(IList ids, Include? include = default);
-
- ///
- /// Create a new resource.
- ///
- /// The item to register
- /// The resource registers and completed by database's information (related items and so on)
- Task Create(T obj);
-
- ///
- /// Create a new resource if it does not exist already. If it does, the existing value is returned instead.
- ///
- /// The object to create
- /// The newly created item or the existing value if it existed.
- Task CreateIfNotExists(T obj);
-
- ///
- /// Called when a resource has been created.
- ///
- static event ResourceEventHandler OnCreated;
-
- ///
- /// Callback that should be called after a resource has been created.
- ///
- /// The resource newly created.
- /// A representing the asynchronous operation.
- protected static Task OnResourceCreated(T obj) => OnCreated?.Invoke(obj) ?? Task.CompletedTask;
-
- ///
- /// Edit a resource and replace every property
- ///
- /// The resource to edit, it's ID can't change.
- /// If the item is not found
- /// The resource edited and completed by database's information (related items and so on)
- Task Edit(T edited);
-
- ///
- /// Edit only specific properties of a resource
- ///
- /// The id of the resource to edit
- ///
- /// A method that will be called when you need to update every properties that you want to
- /// persist.
- ///
- /// If the item is not found
- /// The resource edited and completed by database's information (related items and so on)
- Task Patch(Guid id, Func patch);
-
- ///
- /// Called when a resource has been edited.
- ///
- static event ResourceEventHandler OnEdited;
-
- ///
- /// Callback that should be called after a resource has been edited.
- ///
- /// The resource newly edited.
- /// A representing the asynchronous operation.
- protected static Task OnResourceEdited(T obj) => OnEdited?.Invoke(obj) ?? Task.CompletedTask;
-
- ///
- /// Delete a resource by it's ID
- ///
- /// The ID of the resource
- /// If the item is not found
- /// A representing the asynchronous operation.
- Task Delete(Guid id);
-
- ///
- /// Delete a resource by it's slug
- ///
- /// The slug of the resource
- /// If the item is not found
- /// A representing the asynchronous operation.
- Task Delete(string slug);
-
- ///
- /// Delete a resource
- ///
- /// The resource to delete
- /// If the item is not found
- /// A representing the asynchronous operation.
- Task Delete(T obj);
-
- ///
- /// Delete all resources that match the predicate.
- ///
- /// A predicate to filter resources to delete. Every resource that match this will be deleted.
- /// A representing the asynchronous operation.
- Task DeleteAll(Filter filter);
-
- ///
- /// Called when a resource has been edited.
- ///
- static event ResourceEventHandler OnDeleted;
-
- ///
- /// Callback that should be called after a resource has been deleted.
- ///
- /// The resource newly deleted.
- /// A representing the asynchronous operation.
- protected static Task OnResourceDeleted(T obj) => OnDeleted?.Invoke(obj) ?? Task.CompletedTask;
-}
-
-///
-/// A base class for repositories. Every service implementing this will be handled by the .
-///
-public interface IBaseRepository
-{
- ///
- /// The type for witch this repository is responsible or null if non applicable.
- ///
- Type RepositoryType { get; }
-}
-
-public interface IUserRepository : IRepository
-{
- Task GetByExternalId(string provider, string id);
- Task AddExternalToken(Guid userId, string provider, ExternalToken token);
- Task DeleteExternalToken(Guid userId, string provider);
-}
diff --git a/back/src/Kyoo.Abstractions/Controllers/IScanner.cs b/back/src/Kyoo.Abstractions/Controllers/IScanner.cs
deleted file mode 100644
index 776131b5..00000000
--- a/back/src/Kyoo.Abstractions/Controllers/IScanner.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Threading.Tasks;
-
-namespace Kyoo.Abstractions.Controllers;
-
-public interface IScanner
-{
- Task SendRescanRequest();
- Task SendRefreshRequest(string kind, Guid id);
-}
diff --git a/back/src/Kyoo.Abstractions/Controllers/ISearchManager.cs b/back/src/Kyoo.Abstractions/Controllers/ISearchManager.cs
deleted file mode 100644
index d3985c6e..00000000
--- a/back/src/Kyoo.Abstractions/Controllers/ISearchManager.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System.Threading.Tasks;
-using Kyoo.Abstractions.Models;
-using Kyoo.Abstractions.Models.Utils;
-
-namespace Kyoo.Abstractions.Controllers;
-
-///
-/// The service to search items.
-///
-public interface ISearchManager
-{
- ///
- /// Search for items.
- ///
- /// The seach query.
- /// Sort information about the query (sort by, sort order)
- /// How pagination should be done (where to start and how many to return)
- /// The related fields to include.
- /// A list of resources that match every filters
- public Task.SearchResult> SearchItems(
- string? query,
- Sort sortBy,
- Filter? filter,
- SearchPagination pagination,
- Include? include = default
- );
-
- ///
- /// Search for movies.
- ///
- /// The seach query.
- /// Sort information about the query (sort by, sort order)
- /// How pagination should be done (where to start and how many to return)
- /// The related fields to include.
- /// A list of resources that match every filters
- public Task.SearchResult> SearchMovies(
- string? query,
- Sort sortBy,
- Filter? filter,
- SearchPagination pagination,
- Include? include = default
- );
-
- ///
- /// Search for shows.
- ///
- /// The seach query.
- /// Sort information about the query (sort by, sort order)
- /// How pagination should be done (where to start and how many to return)
- /// The related fields to include.
- /// A list of resources that match every filters
- public Task.SearchResult> SearchShows(
- string? query,
- Sort sortBy,
- Filter? filter,
- SearchPagination pagination,
- Include? include = default
- );
-
- ///
- /// Search for collections.
- ///
- /// The seach query.
- /// Sort information about the query (sort by, sort order)
- /// How pagination should be done (where to start and how many to return)
- /// The related fields to include.
- /// A list of resources that match every filters
- public Task.SearchResult> SearchCollections(
- string? query,
- Sort sortBy,
- Filter? filter,
- SearchPagination pagination,
- Include? include = default
- );
-
- ///
- /// Search for episodes.
- ///
- /// The seach query.
- /// Sort information about the query (sort by, sort order)
- /// How pagination should be done (where to start and how many to return)
- /// The related fields to include.
- /// A list of resources that match every filters
- public Task.SearchResult> SearchEpisodes(
- string? query,
- Sort sortBy,
- Filter? filter,
- SearchPagination pagination,
- Include? include = default
- );
-
- ///
- /// Search for studios.
- ///
- /// The seach query.
- /// Sort information about the query (sort by, sort order)
- /// How pagination should be done (where to start and how many to return)
- /// The related fields to include.
- /// A list of resources that match every filters
- public Task.SearchResult> SearchStudios(
- string? query,
- Sort sortBy,
- Filter? filter,
- SearchPagination pagination,
- Include? include = default
- );
-}
diff --git a/back/src/Kyoo.Abstractions/Controllers/IThumbnailsManager.cs b/back/src/Kyoo.Abstractions/Controllers/IThumbnailsManager.cs
deleted file mode 100644
index a1a37aa2..00000000
--- a/back/src/Kyoo.Abstractions/Controllers/IThumbnailsManager.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using Kyoo.Abstractions.Models;
-
-namespace Kyoo.Abstractions.Controllers;
-
-public interface IThumbnailsManager
-{
- Task DownloadImages(T item)
- where T : IThumbnails;
-
- Task DownloadImage(Image? image, string what);
-
- Task IsImageSaved(Guid imageId, ImageQuality quality);
-
- Task GetImage(Guid imageId, ImageQuality quality);
-
- Task DeleteImages(T item)
- where T : IThumbnails;
-
- Task GetUserImage(Guid userId);
-
- Task SetUserImage(Guid userId, Stream? image);
-}
diff --git a/back/src/Kyoo.Abstractions/Controllers/IWatchStatusRepository.cs b/back/src/Kyoo.Abstractions/Controllers/IWatchStatusRepository.cs
deleted file mode 100644
index 17ebe40c..00000000
--- a/back/src/Kyoo.Abstractions/Controllers/IWatchStatusRepository.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Kyoo.Abstractions.Models;
-using Kyoo.Abstractions.Models.Utils;
-
-namespace Kyoo.Abstractions.Controllers;
-
-///
-/// A local repository to handle watched items
-///
-public interface IWatchStatusRepository
-{
- public delegate Task ResourceEventHandler(T resource);
-
- Task> GetAll(
- Filter? filter = default,
- Include? include = default,
- Pagination? limit = default
- );
-
- Task GetMovieStatus(Guid movieId, Guid userId);
-
- Task SetMovieStatus(
- Guid movieId,
- Guid userId,
- WatchStatus status,
- int? watchedTime,
- int? percent
- );
-
- static event ResourceEventHandler> OnMovieStatusChangedHandler;
- protected static Task OnMovieStatusChanged(WatchStatus obj) =>
- OnMovieStatusChangedHandler?.Invoke(obj) ?? Task.CompletedTask;
-
- Task DeleteMovieStatus(Guid movieId, Guid userId);
-
- Task GetShowStatus(Guid showId, Guid userId);
-
- Task SetShowStatus(Guid showId, Guid userId, WatchStatus status);
-
- static event ResourceEventHandler> OnShowStatusChangedHandler;
- protected static Task OnShowStatusChanged(WatchStatus obj) =>
- OnShowStatusChangedHandler?.Invoke(obj) ?? Task.CompletedTask;
-
- Task DeleteShowStatus(Guid showId, Guid userId);
-
- Task GetEpisodeStatus(Guid episodeId, Guid userId);
-
- /// Where the user has stopped watching. Only usable if Status
- /// is
- Task SetEpisodeStatus(
- Guid episodeId,
- Guid userId,
- WatchStatus status,
- int? watchedTime,
- int? percent
- );
-
- static event ResourceEventHandler> OnEpisodeStatusChangedHandler;
- protected static Task OnEpisodeStatusChanged(WatchStatus obj) =>
- OnEpisodeStatusChangedHandler?.Invoke(obj) ?? Task.CompletedTask;
-
- Task DeleteEpisodeStatus(Guid episodeId, Guid userId);
-}
diff --git a/back/src/Kyoo.Abstractions/Extensions.cs b/back/src/Kyoo.Abstractions/Extensions.cs
deleted file mode 100644
index 42f4b0af..00000000
--- a/back/src/Kyoo.Abstractions/Extensions.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Claims;
-using Kyoo.Abstractions.Models.Exceptions;
-using Kyoo.Authentication.Models;
-
-namespace Kyoo.Authentication;
-
-///
-/// Extension methods.
-///
-public static class Extensions
-{
- ///
- /// Get the permissions of an user.
- ///
- /// The user
- /// The list of permissions
- public static ICollection GetPermissions(this ClaimsPrincipal user)
- {
- return user.Claims.FirstOrDefault(x => x.Type == Claims.Permissions)?.Value.Split(',')
- ?? Array.Empty();
- }
-
- ///
- /// Get the id of the current user or null if unlogged or invalid.
- ///
- /// The user.
- /// The id of the user or null.
- public static Guid? GetId(this ClaimsPrincipal user)
- {
- Claim? value = user.FindFirst(Claims.Id);
- if (Guid.TryParse(value?.Value, out Guid id))
- return id;
- return null;
- }
-
- public static Guid GetIdOrThrow(this ClaimsPrincipal user)
- {
- Guid? ret = user.GetId();
- if (ret == null)
- throw new UnauthorizedException();
- return ret.Value;
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj b/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
deleted file mode 100644
index a7727ecc..00000000
--- a/back/src/Kyoo.Abstractions/Kyoo.Abstractions.csproj
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- Kyoo.Abstractions
- Base package to create plugins for Kyoo.
- Kyoo.Abstractions
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/ApiDefinitionAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/ApiDefinitionAttribute.cs
deleted file mode 100644
index 46014a69..00000000
--- a/back/src/Kyoo.Abstractions/Models/Attributes/ApiDefinitionAttribute.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models.Attributes;
-
-///
-/// An attribute to specify on apis to specify it's documentation's name and category.
-/// If this is applied on a method, the specified method will be exploded from the controller's page and be
-/// included on the specified tag page.
-///
-[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
-public class ApiDefinitionAttribute : Attribute
-{
- ///
- /// The public name of this api.
- ///
- public string Name { get; }
-
- ///
- /// The name of the group in witch this API is. You can also specify a custom sort order using the following
- /// format: order:name. Everything before the first : will be removed but kept for
- /// th alphabetical ordering.
- ///
- public string? Group { get; set; }
-
- ///
- /// Create a new .
- ///
- /// The name of the api that will be used on the documentation page.
- public ApiDefinitionAttribute(string name)
- {
- Name = name;
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/ComputedAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/ComputedAttribute.cs
deleted file mode 100644
index 2fde7a84..00000000
--- a/back/src/Kyoo.Abstractions/Models/Attributes/ComputedAttribute.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models.Attributes;
-
-///
-/// An attribute to inform that the property is computed automatically and can't be assigned manually.
-///
-[AttributeUsage(AttributeTargets.Property)]
-public class ComputedAttribute : NotMergeableAttribute { }
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/LoadableRelationAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/LoadableRelationAttribute.cs
deleted file mode 100644
index 8b40679e..00000000
--- a/back/src/Kyoo.Abstractions/Models/Attributes/LoadableRelationAttribute.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models.Attributes;
-
-///
-/// The targeted relation can be loaded.
-///
-[AttributeUsage(AttributeTargets.Property)]
-public class LoadableRelationAttribute : Attribute
-{
- ///
- /// The name of the field containing the related resource's ID.
- ///
- public string? RelationID { get; }
-
- public string? Sql { get; set; }
-
- public string? On { get; set; }
-
- public string? Projected { get; set; }
-
- ///
- /// Create a new .
- ///
- public LoadableRelationAttribute() { }
-
- ///
- /// Create a new with a baking relationID field.
- ///
- /// The name of the RelationID field.
- public LoadableRelationAttribute(string relationID)
- {
- RelationID = relationID;
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/NotMergeableAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/NotMergeableAttribute.cs
deleted file mode 100644
index 138ec9a8..00000000
--- a/back/src/Kyoo.Abstractions/Models/Attributes/NotMergeableAttribute.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models.Attributes;
-
-///
-/// Specify that a property can't be merged.
-///
-[AttributeUsage(AttributeTargets.Property)]
-public class NotMergeableAttribute : Attribute { }
-
-///
-/// An interface with a method called when this object is merged.
-///
-public interface IOnMerge
-{
- ///
- /// This function is called after the object has been merged.
- ///
- /// The object that has been merged with this.
- void OnMerge(object merged);
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/OneOfAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/OneOfAttribute.cs
deleted file mode 100644
index de064603..00000000
--- a/back/src/Kyoo.Abstractions/Models/Attributes/OneOfAttribute.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models.Attributes;
-
-///
-/// An attribute to inform that this interface is a type union
-///
-[AttributeUsage(AttributeTargets.Interface)]
-public class OneOfAttribute : Attribute
-{
- ///
- /// The types this union concist of.
- ///
- public Type[] Types { get; set; }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/Permission/PartialPermissionAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/Permission/PartialPermissionAttribute.cs
deleted file mode 100644
index ea300823..00000000
--- a/back/src/Kyoo.Abstractions/Models/Attributes/Permission/PartialPermissionAttribute.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using Kyoo.Abstractions.Controllers;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Kyoo.Abstractions.Models.Permissions;
-
-///
-/// Specify one part of a permissions needed for the API (the kind or the type).
-///
-[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
-public class PartialPermissionAttribute : Attribute, IFilterFactory
-{
- ///
- /// The needed permission type.
- ///
- public string? Type { get; }
-
- ///
- /// The needed permission kind.
- ///
- public Kind? Kind { get; }
-
- ///
- /// The group of this permission.
- ///
- public Group Group { get; set; }
-
- ///
- /// Ask a permission to run an action.
- ///
- ///
- /// With this attribute, you can only specify a type or a kind.
- /// To have a valid permission attribute, you must specify the kind and the permission using two attributes.
- /// Those attributes can be dispatched at different places (one on the class, one on the method for example).
- /// If you don't put exactly two of those attributes, the permission attribute will be ill-formed and will
- /// lead to unspecified behaviors.
- ///
- /// The type of the action
- public PartialPermissionAttribute(string type)
- {
- Type = type.ToLower();
- }
-
- ///
- /// Ask a permission to run an action.
- ///
- ///
- /// With this attribute, you can only specify a type or a kind.
- /// To have a valid permission attribute, you must specify the kind and the permission using two attributes.
- /// Those attributes can be dispatched at different places (one on the class, one on the method for example).
- /// If you don't put exactly two of those attributes, the permission attribute will be ill-formed and will
- /// lead to unspecified behaviors.
- ///
- /// The kind of permission needed.
- public PartialPermissionAttribute(Kind permission)
- {
- Kind = permission;
- }
-
- ///
- public IFilterMetadata CreateInstance(IServiceProvider serviceProvider)
- {
- return serviceProvider.GetRequiredService().Create(this);
- }
-
- ///
- public bool IsReusable => true;
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/Permission/PermissionAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/Permission/PermissionAttribute.cs
deleted file mode 100644
index ba1ff743..00000000
--- a/back/src/Kyoo.Abstractions/Models/Attributes/Permission/PermissionAttribute.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using Kyoo.Abstractions.Controllers;
-using Microsoft.AspNetCore.Mvc.Filters;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Kyoo.Abstractions.Models.Permissions;
-
-///
-/// The kind of permission needed.
-///
-public enum Kind
-{
- ///
- /// Allow the user to read for this kind of data.
- ///
- Read,
-
- ///
- /// Allow the user to write for this kind of data.
- ///
- Write,
-
- ///
- /// Allow the user to create this kind of data.
- ///
- Create,
-
- ///
- /// Allow the user to delete this kind of data.
- ///
- Delete,
-
- ///
- /// Allow the user to play this file.
- ///
- Play,
-}
-
-///
-/// The group of the permission.
-///
-public enum Group
-{
- ///
- /// Default group indicating no value.
- ///
- None,
-
- ///
- /// Allow all operations on basic items types.
- ///
- Overall,
-
- ///
- /// Allow operation on sensitive items like libraries path, configurations and so on.
- ///
- Admin
-}
-
-///
-/// Specify permissions needed for the API.
-///
-[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
-public class PermissionAttribute : Attribute, IFilterFactory
-{
- ///
- /// The needed permission as string.
- ///
- public string Type { get; }
-
- ///
- /// The needed permission kind.
- ///
- public Kind Kind { get; }
-
- ///
- /// The group of this permission.
- ///
- public Group Group { get; set; }
-
- ///
- /// Ask a permission to run an action.
- ///
- ///
- /// The type of the action
- ///
- ///
- /// The kind of permission needed.
- ///
- ///
- /// The group of this permission (allow grouped permission like overall.read
- /// for all read permissions of this group).
- ///
- public PermissionAttribute(string type, Kind permission, Group group = Group.Overall)
- {
- Type = type.ToLower();
- Kind = permission;
- Group = group;
- }
-
- ///
- public IFilterMetadata CreateInstance(IServiceProvider serviceProvider)
- {
- return serviceProvider.GetRequiredService().Create(this);
- }
-
- ///
- public bool IsReusable => true;
-
- ///
- /// Return this permission attribute as a string.
- ///
- /// The string representation.
- public string AsPermissionString()
- {
- return Type;
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/Permission/UserOnlyAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/Permission/UserOnlyAttribute.cs
deleted file mode 100644
index a50424a1..00000000
--- a/back/src/Kyoo.Abstractions/Models/Attributes/Permission/UserOnlyAttribute.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models.Permissions;
-
-///
-/// The annotated route can only be accessed by a logged in user.
-///
-[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
-public class UserOnlyAttribute : Attribute
-{
- // TODO: Implement a Filter Attribute to make this work. For now, this attribute is only useful as documentation.
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Attributes/SqlFirstColumnAttribute.cs b/back/src/Kyoo.Abstractions/Models/Attributes/SqlFirstColumnAttribute.cs
deleted file mode 100644
index e420a1f3..00000000
--- a/back/src/Kyoo.Abstractions/Models/Attributes/SqlFirstColumnAttribute.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using Kyoo.Utils;
-
-namespace Kyoo.Abstractions.Models.Attributes;
-
-[AttributeUsage(AttributeTargets.Class)]
-public class SqlFirstColumnAttribute : Attribute
-{
- ///
- /// The name of the first column of the element. Used to split multiples
- /// items on a single sql query. If not specified, it defaults to "Id".
- ///
- public string Name { get; set; }
-
- public SqlFirstColumnAttribute(string name)
- {
- Name = name.ToSnakeCase();
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
deleted file mode 100644
index 19f5ece4..00000000
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models.Exceptions;
-
-///
-/// An exception raised when an item already exists in the database.
-///
-[Serializable]
-public class DuplicatedItemException(object? existing = null)
- : Exception("Already exists in the database.")
-{
- ///
- /// The existing object.
- ///
- public object? Existing { get; } = existing;
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs
deleted file mode 100644
index ef708f84..00000000
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models.Exceptions;
-
-///
-/// An exception raised when an item could not be found.
-///
-[Serializable]
-public class ItemNotFoundException : Exception
-{
- ///
- /// Create a default with no message.
- ///
- public ItemNotFoundException()
- : base("Item not found") { }
-
- ///
- /// Create a new with a message
- ///
- /// The message of the exception
- public ItemNotFoundException(string message)
- : base(message) { }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs
deleted file mode 100644
index 89f09d7a..00000000
--- a/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models.Exceptions;
-
-[Serializable]
-public class UnauthorizedException : Exception
-{
- public UnauthorizedException()
- : base("User not authenticated or token invalid.") { }
-
- public UnauthorizedException(string message)
- : base(message) { }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Genre.cs b/back/src/Kyoo.Abstractions/Models/Genre.cs
deleted file mode 100644
index e2e4f6a9..00000000
--- a/back/src/Kyoo.Abstractions/Models/Genre.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A genre that allow one to specify categories for shows.
-///
-public enum Genre
-{
- Action,
- Adventure,
- Animation,
- Comedy,
- Crime,
- Documentary,
- Drama,
- Family,
- Fantasy,
- History,
- Horror,
- Music,
- Mystery,
- Romance,
- ScienceFiction,
- Thriller,
- War,
- Western,
- Kids,
- News,
- Reality,
- Soap,
- Talk,
- Politics,
-}
diff --git a/back/src/Kyoo.Abstractions/Models/ILibraryItem.cs b/back/src/Kyoo.Abstractions/Models/ILibraryItem.cs
deleted file mode 100644
index 8b98aabd..00000000
--- a/back/src/Kyoo.Abstractions/Models/ILibraryItem.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using Kyoo.Abstractions.Controllers;
-using Kyoo.Abstractions.Models.Attributes;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A show, a movie or a collection.
-///
-[OneOf(Types = new[] { typeof(Show), typeof(Movie), typeof(Collection) })]
-public interface ILibraryItem : IResource, IThumbnails, IMetadata, IAddedDate, IQuery
-{
- static Sort IQuery.DefaultSort => new Sort.By(nameof(Movie.Name));
-}
diff --git a/back/src/Kyoo.Abstractions/Models/INews.cs b/back/src/Kyoo.Abstractions/Models/INews.cs
deleted file mode 100644
index b5642f5d..00000000
--- a/back/src/Kyoo.Abstractions/Models/INews.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using Kyoo.Abstractions.Controllers;
-using Kyoo.Abstractions.Models.Attributes;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A show, a movie or a collection.
-///
-[OneOf(Types = [typeof(Episode), typeof(Movie)])]
-public interface INews : IResource, IThumbnails, IAddedDate, IQuery
-{
- static Sort IQuery.DefaultSort => new Sort.By(nameof(AddedDate), true);
-}
diff --git a/back/src/Kyoo.Abstractions/Models/IWatchlist.cs b/back/src/Kyoo.Abstractions/Models/IWatchlist.cs
deleted file mode 100644
index 03022701..00000000
--- a/back/src/Kyoo.Abstractions/Models/IWatchlist.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using Kyoo.Abstractions.Models.Attributes;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A watch list item.
-///
-[OneOf(Types = new[] { typeof(Show), typeof(Movie) })]
-public interface IWatchlist : IResource, IThumbnails, IMetadata, IAddedDate { }
diff --git a/back/src/Kyoo.Abstractions/Models/Issues.cs b/back/src/Kyoo.Abstractions/Models/Issues.cs
deleted file mode 100644
index 851dc29f..00000000
--- a/back/src/Kyoo.Abstractions/Models/Issues.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// An issue that occured on kyoo.
-///
-public class Issue : IAddedDate
-{
- ///
- /// The type of issue (for example, "Scanner" if this issue was created due to scanning error).
- ///
- public string Domain { get; set; }
-
- ///
- /// Why this issue was caused? An unique cause that can be used to identify this issue.
- /// For the scanner, a cause should be a video path.
- ///
- public string Cause { get; set; }
-
- ///
- /// A human readable string explaining why this issue occured.
- ///
- public string Reason { get; set; }
-
- ///
- /// Some extra data that could store domain-specific info.
- ///
- public Dictionary Extra { get; set; } = new();
-
- ///
- public DateTime AddedDate { get; set; }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/MetadataID.cs b/back/src/Kyoo.Abstractions/Models/MetadataID.cs
deleted file mode 100644
index ec384ec8..00000000
--- a/back/src/Kyoo.Abstractions/Models/MetadataID.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// ID and link of an item on an external provider.
-///
-public class MetadataId
-{
- ///
- /// The ID of the resource on the external provider.
- ///
- public string DataId { get; set; }
-
- ///
- /// The URL of the resource on the external provider.
- ///
- public string? Link { get; set; }
-}
-
-///
-/// ID informations about an episode.
-///
-public class EpisodeId
-{
- ///
- /// The Id of the show on the metadata database.
- ///
- public string ShowId { get; set; }
-
- ///
- /// The season number or null if absolute numbering is used in this database.
- ///
- public int? Season { get; set; }
-
- ///
- /// The episode number or absolute number if Season is null.
- ///
- public int Episode { get; set; }
-
- ///
- /// The URL of the resource on the external provider.
- ///
- public string? Link { get; set; }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Page.cs b/back/src/Kyoo.Abstractions/Models/Page.cs
deleted file mode 100644
index 75c0f18e..00000000
--- a/back/src/Kyoo.Abstractions/Models/Page.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System.Collections.Generic;
-using System.Linq;
-using Kyoo.Utils;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A page of resource that contains information about the pagination of resources.
-///
-/// The type of resource contained in this page.
-public class Page
- where T : IResource
-{
- ///
- /// The link of the current page.
- ///
- public string This { get; }
-
- ///
- /// The link of the first page.
- ///
- public string First { get; }
-
- ///
- /// The link of the previous page.
- ///
- public string? Previous { get; }
-
- ///
- /// The link of the next page.
- ///
- public string? Next { get; }
-
- ///
- /// The number of items in the current page.
- ///
- public int Count => Items.Count;
-
- ///
- /// The list of items in the page.
- ///
- public ICollection Items { get; }
-
- ///
- /// Create a new .
- ///
- /// The list of items in the page.
- /// The link of the current page.
- /// The link of the previous page.
- /// The link of the next page.
- /// The link of the first page.
- public Page(ICollection items, string @this, string? previous, string? next, string first)
- {
- Items = items;
- This = @this;
- Previous = previous;
- Next = next;
- First = first;
- }
-
- ///
- /// Create a new and compute the urls.
- ///
- /// The list of items in the page.
- /// The base url of the resources available from this page.
- /// The list of query strings of the current page
- /// The number of items requested for the current page.
- public Page(ICollection items, string url, Dictionary query, int limit)
- {
- Items = items;
- This = url + query.ToQueryString();
- if (items.Count > 0 && query.ContainsKey("afterID"))
- {
- query["afterID"] = items.First().Id.ToString();
- query["reverse"] = "true";
- Previous = url + query.ToQueryString();
- }
- query.Remove("reverse");
- if (items.Count == limit && limit > 0)
- {
- query["afterID"] = items.Last().Id.ToString();
- Next = url + query.ToQueryString();
- }
- query.Remove("afterID");
- First = url + query.ToQueryString();
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Patch.cs b/back/src/Kyoo.Abstractions/Models/Patch.cs
deleted file mode 100644
index 1eafe949..00000000
--- a/back/src/Kyoo.Abstractions/Models/Patch.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Text.Json;
-using Kyoo.Abstractions.Models;
-
-namespace Kyoo.Models;
-
-public class Patch : Dictionary
- where T : class, IResource
-{
- public Guid? Id => this.GetValueOrDefault(nameof(IResource.Id))?.Deserialize();
-
- public string? Slug => this.GetValueOrDefault(nameof(IResource.Slug))?.Deserialize();
-
- public T Apply(T current)
- {
- foreach ((string property, JsonDocument value) in this)
- {
- PropertyInfo prop = typeof(T).GetProperty(
- property,
- BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance
- )!;
- prop.SetValue(current, value.Deserialize(prop.PropertyType));
- }
- return current;
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs b/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs
deleted file mode 100644
index caa6a13a..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Collection.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text.Json.Serialization;
-using Kyoo.Abstractions.Controllers;
-using Kyoo.Utils;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A class representing collections of .
-///
-public class Collection
- : IQuery,
- IResource,
- IMetadata,
- IThumbnails,
- IAddedDate,
- IRefreshable,
- ILibraryItem
-{
- public static Sort DefaultSort => new Sort.By(nameof(Collection.Name));
-
- ///
- public Guid Id { get; set; }
-
- ///
- [MaxLength(256)]
- public string Slug { get; set; }
-
- ///
- /// The name of this collection.
- ///
- public string Name { get; set; }
-
- ///
- /// The description of this collection.
- ///
- public string? Overview { get; set; }
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- public Image? Poster { get; set; }
-
- ///
- public Image? Thumbnail { get; set; }
-
- ///
- public Image? Logo { get; set; }
-
- ///
- /// The list of movies contained in this collection.
- ///
- [JsonIgnore]
- public ICollection? Movies { get; set; }
-
- ///
- /// The list of shows contained in this collection.
- ///
- [JsonIgnore]
- public ICollection? Shows { get; set; }
-
- ///
- public Dictionary ExternalId { get; set; } = new();
-
- ///
- public DateTime? NextMetadataRefresh { get; set; }
-
- public Collection() { }
-
- [JsonConstructor]
- public Collection(string name)
- {
- if (name != null)
- {
- Slug = Utility.ToSlug(name);
- Name = name;
- }
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs b/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs
deleted file mode 100644
index f32bf741..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs
+++ /dev/null
@@ -1,302 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text.Json.Serialization;
-using System.Text.RegularExpressions;
-using EntityFrameworkCore.Projectables;
-using Kyoo.Abstractions.Controllers;
-using Kyoo.Abstractions.Models.Attributes;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A class to represent a single show's episode.
-///
-public class Episode : IQuery, IResource, IThumbnails, IAddedDate, IRefreshable, INews
-{
- // Use absolute numbers by default and fallback to season/episodes if it does not exists.
- public static Sort DefaultSort =>
- new Sort.Conglomerate(
- new Sort.By(x => x.AbsoluteNumber),
- new Sort.By(x => x.SeasonNumber),
- new Sort.By(x => x.EpisodeNumber)
- );
-
- ///
- public Guid Id { get; set; }
-
- ///
- [Computed]
- [MaxLength(256)]
- public string Slug
- {
- get
- {
- if (ShowSlug != null || Show?.Slug != null)
- return GetSlug(ShowSlug ?? Show!.Slug, SeasonNumber, EpisodeNumber, AbsoluteNumber);
- return GetSlug(ShowId.ToString(), SeasonNumber, EpisodeNumber, AbsoluteNumber);
- }
- private set
- {
- Match match = Regex.Match(value, @"(?.+)-s(?\d+)e(?\d+)");
-
- if (match.Success)
- {
- ShowSlug = match.Groups["show"].Value;
- SeasonNumber = int.Parse(match.Groups["season"].Value);
- EpisodeNumber = int.Parse(match.Groups["episode"].Value);
- }
- else
- {
- match = Regex.Match(value, @"(?.+)-(?\d+)");
- if (match.Success)
- {
- ShowSlug = match.Groups["show"].Value;
- AbsoluteNumber = int.Parse(match.Groups["absolute"].Value);
- }
- else
- ShowSlug = value;
- SeasonNumber = null;
- EpisodeNumber = null;
- }
- }
- }
-
- ///
- /// The slug of the Show that contain this episode. If this is not set, this episode is ill-formed.
- ///
- [JsonIgnore]
- public string? ShowSlug { private get; set; }
-
- ///
- /// The ID of the Show containing this episode.
- ///
- public Guid ShowId { get; set; }
-
- ///
- /// The show that contains this episode.
- ///
- [LoadableRelation(nameof(ShowId))]
- public Show? Show { get; set; }
-
- ///
- /// The ID of the Season containing this episode.
- ///
- public Guid? SeasonId { get; set; }
-
- ///
- /// The season that contains this episode.
- ///
- ///
- /// This can be null if the season is unknown and the episode is only identified
- /// by it's .
- ///
- [LoadableRelation(nameof(SeasonId))]
- public Season? Season { get; set; }
-
- ///
- /// The season in witch this episode is in.
- ///
- public int? SeasonNumber { get; set; }
-
- ///
- /// The number of this episode in it's season.
- ///
- public int? EpisodeNumber { get; set; }
-
- ///
- /// The absolute number of this episode. It's an episode number that is not reset to 1 after a new season.
- ///
- public int? AbsoluteNumber { get; set; }
-
- ///
- /// The path of the video file for this episode.
- ///
- public string Path { get; set; }
-
- ///
- /// The title of this episode.
- ///
- public string? Name { get; set; }
-
- ///
- /// The overview of this episode.
- ///
- public string? Overview { get; set; }
-
- ///
- /// How long is this episode? (in minutes)
- ///
- public int? Runtime { get; set; }
-
- ///
- /// The release date of this episode. It can be null if unknown.
- ///
- public DateOnly? ReleaseDate { get; set; }
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- public Image? Poster { get; set; }
-
- ///
- public Image? Thumbnail { get; set; }
-
- ///
- public Image? Logo { get; set; }
-
- ///
- public Dictionary ExternalId { get; set; } = [];
-
- ///
- public DateTime? NextMetadataRefresh { get; set; }
-
- ///
- /// The previous episode that should be seen before viewing this one.
- ///
- [Projectable(UseMemberBody = nameof(_PreviousEpisode), OnlyOnInclude = true)]
- [LoadableRelation(
- // language=PostgreSQL
- Sql = """
- select
- pe.* -- Episode as pe
- from
- episodes as "pe"
- where
- pe.show_id = "this".show_id
- and (pe.absolute_number < "this".absolute_number
- or pe.season_number < "this".season_number
- or (pe.season_number = "this".season_number
- and e.episode_number < "this".episode_number))
- order by
- pe.absolute_number desc nulls last,
- pe.season_number desc,
- pe.episode_number desc
- limit 1
- """
- )]
- public Episode? PreviousEpisode { get; set; }
-
- private Episode? _PreviousEpisode =>
- Show!
- .Episodes!.OrderBy(x => x.AbsoluteNumber == null)
- .ThenByDescending(x => x.AbsoluteNumber)
- .ThenByDescending(x => x.SeasonNumber)
- .ThenByDescending(x => x.EpisodeNumber)
- .FirstOrDefault(x =>
- x.AbsoluteNumber < AbsoluteNumber
- || x.SeasonNumber < SeasonNumber
- || (x.SeasonNumber == SeasonNumber && x.EpisodeNumber < EpisodeNumber)
- );
-
- ///
- /// The next episode to watch after this one.
- ///
- [Projectable(UseMemberBody = nameof(_NextEpisode), OnlyOnInclude = true)]
- [LoadableRelation(
- // language=PostgreSQL
- Sql = """
- select
- ne.* -- Episode as ne
- from
- episodes as "ne"
- where
- ne.show_id = "this".show_id
- and (ne.absolute_number > "this".absolute_number
- or ne.season_number > "this".season_number
- or (ne.season_number = "this".season_number
- and e.episode_number > "this".episode_number))
- order by
- ne.absolute_number,
- ne.season_number,
- ne.episode_number
- limit 1
- """
- )]
- public Episode? NextEpisode { get; set; }
-
- private Episode? _NextEpisode =>
- Show!
- .Episodes!.OrderBy(x => x.AbsoluteNumber)
- .ThenBy(x => x.SeasonNumber)
- .ThenBy(x => x.EpisodeNumber)
- .FirstOrDefault(x =>
- x.AbsoluteNumber > AbsoluteNumber
- || x.SeasonNumber > SeasonNumber
- || (x.SeasonNumber == SeasonNumber && x.EpisodeNumber > EpisodeNumber)
- );
-
- [JsonIgnore]
- public ICollection? Watched { get; set; }
-
- ///
- /// Metadata of what an user as started/planned to watch.
- ///
- [Projectable(UseMemberBody = nameof(_WatchStatus), OnlyOnInclude = true)]
- [LoadableRelation(
- Sql = "episode_watch_status",
- On = "episode_id = \"this\".id and \"relation\".user_id = [current_user]"
- )]
- public EpisodeWatchStatus? WatchStatus { get; set; }
-
- // There is a global query filter to filter by user so we just need to do single.
- private EpisodeWatchStatus? _WatchStatus => Watched!.FirstOrDefault();
-
- ///
- /// Links to watch this episode.
- ///
- public VideoLinks Links =>
- new() { Direct = $"/episode/{Slug}/direct", Hls = $"/episode/{Slug}/master.m3u8", };
-
- ///
- /// Get the slug of an episode.
- ///
- /// The slug of the show. It can't be null.
- ///
- /// The season in which the episode is.
- /// If this is a movie or if the episode should be referred by it's absolute number, set this to null.
- ///
- ///
- /// The number of the episode in it's season.
- /// If this is a movie or if the episode should be referred by it's absolute number, set this to null.
- ///
- ///
- /// The absolute number of this show.
- /// If you don't know it or this is a movie, use null
- ///
- /// The slug corresponding to the given arguments
- public static string GetSlug(
- string showSlug,
- int? seasonNumber,
- int? episodeNumber,
- int? absoluteNumber = null
- )
- {
- return seasonNumber switch
- {
- null when absoluteNumber == null => showSlug,
- null => $"{showSlug}-{absoluteNumber}",
- _ => $"{showSlug}-s{seasonNumber}e{episodeNumber}"
- };
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IAddedDate.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IAddedDate.cs
deleted file mode 100644
index 8b64b613..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IAddedDate.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// An interface applied to resources.
-///
-public interface IAddedDate
-{
- ///
- /// The date at which this resource was added to kyoo.
- ///
- public DateTime AddedDate { get; set; }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IMetadata.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IMetadata.cs
deleted file mode 100644
index db840cae..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IMetadata.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System.Collections.Generic;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// An interface applied to resources containing external metadata.
-///
-public interface IMetadata
-{
- ///
- /// The link to metadata providers that this show has. See for more information.
- ///
- public Dictionary ExternalId { get; set; }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IQuery.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IQuery.cs
deleted file mode 100644
index 95634fa7..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IQuery.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using Kyoo.Abstractions.Controllers;
-
-namespace Kyoo.Abstractions.Models;
-
-public interface IQuery
-{
- ///
- /// The sorting that will be used when no user defined one is present.
- ///
- public static virtual Sort DefaultSort => throw new NotImplementedException();
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IRefreshable.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IRefreshable.cs
deleted file mode 100644
index 0a8acae3..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IRefreshable.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-
-namespace Kyoo.Abstractions.Models;
-
-public interface IRefreshable
-{
- ///
- /// The date of the next metadata refresh. Null if auto-refresh is disabled.
- ///
- public DateTime? NextMetadataRefresh { get; set; }
-
- public static DateTime ComputeNextRefreshDate(DateOnly airDate)
- {
- int days = DateOnly.FromDateTime(DateTime.UtcNow).DayNumber - airDate.DayNumber;
- return days switch
- {
- <= 4 => DateTime.UtcNow.AddDays(1),
- <= 21 => DateTime.UtcNow.AddDays(14),
- _ => DateTime.UtcNow.AddMonths(2)
- };
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IResource.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IResource.cs
deleted file mode 100644
index 87796456..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IResource.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.ComponentModel.DataAnnotations;
-using Kyoo.Abstractions.Controllers;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// An interface to represent a resource that can be retrieved from the database.
-///
-public interface IResource : IQuery
-{
- ///
- /// A unique ID for this type of resource. This can't be changed and duplicates are not allowed.
- ///
- ///
- /// You don't need to specify an ID manually when creating a new resource,
- /// this field is automatically assigned by the .
- ///
- public Guid Id { get; set; }
-
- ///
- /// A human-readable identifier that can be used instead of an ID.
- /// A slug must be unique for a type of resource but it can be changed.
- ///
- ///
- /// There is no setter for a slug since it can be computed from other fields.
- /// For example, a season slug is {ShowSlug}-s{SeasonNumber}.
- ///
- [MaxLength(256)]
- public string Slug { get; }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs b/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
deleted file mode 100644
index 69fbca66..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Interfaces/IThumbnails.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// An interface representing items that contains images (like posters, thumbnails, logo, banners...)
-///
-public interface IThumbnails
-{
- ///
- /// A poster is a 2/3 format image with the cover of the resource.
- ///
- public Image? Poster { get; set; }
-
- ///
- /// A thumbnail is a 16/9 format image, it could ether be used as a background or as a preview but it usually
- /// is not an official image.
- ///
- public Image? Thumbnail { get; set; }
-
- ///
- /// A logo is a small image representing the resource.
- ///
- public Image? Logo { get; set; }
-}
-
-[JsonConverter(typeof(ImageConvertor))]
-public class Image
-{
- ///
- /// A unique identifier for the image. Used for proper http caches.
- ///
- public Guid Id { get; set; }
-
- ///
- /// The original image from another server.
- ///
- public string Source { get; set; }
-
- ///
- /// A hash to display as placeholder while the image is loading.
- ///
- [MaxLength(32)]
- public string Blurhash { get; set; }
-
- ///
- /// The url to access the image in low quality.
- ///
- public string Low => $"/thumbnails/{Id}?quality=low";
-
- ///
- /// The url to access the image in medium quality.
- ///
- public string Medium => $"/thumbnails/{Id}?quality=medium";
-
- ///
- /// The url to access the image in high quality.
- ///
- public string High => $"/thumbnails/{Id}?quality=high";
-
- public Image() { }
-
- [JsonConstructor]
- public Image(string source, string? blurhash = null)
- {
- Source = source;
- Blurhash = blurhash ?? "000000";
- }
-
- //
- public class ImageConvertor : JsonConverter
- {
- ///
- public override Image? Read(
- ref Utf8JsonReader reader,
- Type typeToConvert,
- JsonSerializerOptions options
- )
- {
- if (reader.TokenType == JsonTokenType.String && reader.GetString() is string source)
- return new Image(source);
- using JsonDocument document = JsonDocument.ParseValue(ref reader);
- string? src = document.RootElement.GetProperty("Source").GetString();
- string? blurhash = document.RootElement.GetProperty("Blurhash").GetString();
- Guid? id = document.RootElement.GetProperty("Id").GetGuid();
- return new Image(src ?? string.Empty, blurhash) { Id = id ?? Guid.Empty };
- }
-
- ///
- public override void Write(
- Utf8JsonWriter writer,
- Image value,
- JsonSerializerOptions options
- )
- {
- writer.WriteStartObject();
- writer.WriteString("source", value.Source);
- writer.WriteString("blurhash", value.Blurhash);
- writer.WriteString("low", value.Low);
- writer.WriteString("medium", value.Medium);
- writer.WriteString("high", value.High);
- writer.WriteEndObject();
- }
- }
-}
-
-///
-/// The quality of an image
-///
-public enum ImageQuality
-{
- ///
- /// Small
- ///
- Low,
-
- ///
- /// Medium
- ///
- Medium,
-
- ///
- /// Large
- ///
- High,
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/JwtToken.cs b/back/src/Kyoo.Abstractions/Models/Resources/JwtToken.cs
deleted file mode 100644
index 1342dc07..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/JwtToken.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Text.Json.Serialization;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A container representing the response of a login or token refresh.
-///
-///
-/// Initializes a new instance of the class.
-///
-/// The access token used to authorize requests.
-/// The refresh token to retrieve a new access token.
-/// When the access token will expire.
-public class JwtToken(string accessToken, string refreshToken, TimeSpan expireIn)
-{
- ///
- /// The type of this token (always a Bearer).
- ///
- [JsonPropertyName("token_type")]
- public string TokenType => "Bearer";
-
- ///
- /// The access token used to authorize requests.
- ///
- [JsonPropertyName("access_token")]
- public string AccessToken { get; set; } = accessToken;
-
- ///
- /// The refresh token used to retrieve a new access/refresh token when the access token has expired.
- ///
- [JsonPropertyName("refresh_token")]
- public string RefreshToken { get; set; } = refreshToken;
-
- ///
- /// When the access token will expire. After this time, the refresh token should be used to retrieve.
- /// a new token.cs
- ///
- [JsonPropertyName("expire_in")]
- public TimeSpan ExpireIn => ExpireAt.Subtract(DateTime.UtcNow);
-
- ///
- /// The exact date at which the access token will expire.
- ///
- [JsonPropertyName("expire_at")]
- public DateTime ExpireAt { get; set; } = DateTime.UtcNow + expireIn;
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs b/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs
deleted file mode 100644
index 18d49946..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text.Json.Serialization;
-using EntityFrameworkCore.Projectables;
-using Kyoo.Abstractions.Controllers;
-using Kyoo.Abstractions.Models.Attributes;
-using Kyoo.Utils;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A series or a movie.
-///
-public class Movie
- : IQuery,
- IResource,
- IMetadata,
- IThumbnails,
- IAddedDate,
- IRefreshable,
- ILibraryItem,
- INews,
- IWatchlist
-{
- public static Sort DefaultSort => new Sort.By(x => x.Name);
-
- ///
- public Guid Id { get; set; }
-
- ///
- [MaxLength(256)]
- public string Slug { get; set; }
-
- ///
- /// The title of this show.
- ///
- public string Name { get; set; }
-
- ///
- /// A catchphrase for this movie.
- ///
- public string? Tagline { get; set; }
-
- ///
- /// The list of alternative titles of this show.
- ///
- public string[] Aliases { get; set; } = Array.Empty();
-
- ///
- /// The path of the movie video file.
- ///
- public string Path { get; set; }
-
- ///
- /// The summary of this show.
- ///
- public string? Overview { get; set; }
-
- ///
- /// A list of tags that match this movie.
- ///
- public string[] Tags { get; set; } = [];
-
- ///
- /// The list of genres (themes) this show has.
- ///
- public List Genres { get; set; } = [];
-
- ///
- /// Is this show airing, not aired yet or finished?
- ///
- public Status Status { get; set; }
-
- ///
- /// How well this item is rated? (from 0 to 100).
- ///
- public int Rating { get; set; }
-
- ///
- /// How long is this movie? (in minutes)
- ///
- public int? Runtime { get; set; }
-
- ///
- /// The date this movie aired.
- ///
- public DateOnly? AirDate { get; set; }
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- public Image? Poster { get; set; }
-
- ///
- public Image? Thumbnail { get; set; }
-
- ///
- public Image? Logo { get; set; }
-
- [JsonIgnore]
- [Column("air_date")]
- public DateOnly? StartAir => AirDate;
-
- [JsonIgnore]
- [Column("air_date")]
- public DateOnly? EndAir => AirDate;
-
- ///
- /// A video of a few minutes that tease the content.
- ///
- public string? Trailer { get; set; }
-
- ///
- public Dictionary ExternalId { get; set; } = new();
-
- ///
- public DateTime? NextMetadataRefresh { get; set; }
-
- ///
- /// The ID of the Studio that made this show.
- ///
- [JsonIgnore]
- public Guid? StudioId { get; set; }
-
- ///
- /// The Studio that made this show.
- ///
- [LoadableRelation(nameof(StudioId))]
- public Studio? Studio { get; set; }
-
- ///
- /// The list of collections that contains this show.
- ///
- [JsonIgnore]
- public ICollection? Collections { get; set; }
-
- ///
- /// Links to watch this movie.
- ///
- public VideoLinks Links =>
- new() { Direct = $"/movie/{Slug}/direct", Hls = $"/movie/{Slug}/master.m3u8", };
-
- [JsonIgnore]
- public ICollection? Watched { get; set; }
-
- ///
- /// Metadata of what an user as started/planned to watch.
- ///
- [Projectable(UseMemberBody = nameof(_WatchStatus), OnlyOnInclude = true)]
- [LoadableRelation(
- Sql = "movie_watch_status",
- On = "movie_id = \"this\".id and \"relation\".user_id = [current_user]"
- )]
- public MovieWatchStatus? WatchStatus { get; set; }
-
- // There is a global query filter to filter by user so we just need to do single.
- private MovieWatchStatus? _WatchStatus => Watched!.FirstOrDefault();
-
- public Movie() { }
-
- [JsonConstructor]
- public Movie(string name)
- {
- if (name != null)
- {
- Slug = Utility.ToSlug(name);
- Name = name;
- }
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Season.cs b/back/src/Kyoo.Abstractions/Models/Resources/Season.cs
deleted file mode 100644
index d94e6514..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Season.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Text.Json.Serialization;
-using System.Text.RegularExpressions;
-using EntityFrameworkCore.Projectables;
-using Kyoo.Abstractions.Controllers;
-using Kyoo.Abstractions.Models.Attributes;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A season of a .
-///
-public class Season : IQuery, IResource, IMetadata, IThumbnails, IAddedDate, IRefreshable
-{
- public static Sort DefaultSort => new Sort.By(x => x.SeasonNumber);
-
- ///
- public Guid Id { get; set; }
-
- ///
- [Computed]
- [MaxLength(256)]
- public string Slug
- {
- get
- {
- if (ShowSlug == null && Show == null)
- return $"{ShowId}-s{SeasonNumber}";
- return $"{ShowSlug ?? Show?.Slug}-s{SeasonNumber}";
- }
- private set
- {
- Match match = Regex.Match(value, @"(?.+)-s(?\d+)");
-
- if (!match.Success)
- throw new ArgumentException(
- "Invalid season slug. Format: {showSlug}-s{seasonNumber}"
- );
- ShowSlug = match.Groups["show"].Value;
- SeasonNumber = int.Parse(match.Groups["season"].Value);
- }
- }
-
- ///
- /// The slug of the Show that contain this episode. If this is not set, this season is ill-formed.
- ///
- [JsonIgnore]
- public string? ShowSlug { private get; set; }
-
- ///
- /// The ID of the Show containing this season.
- ///
- public Guid ShowId { get; set; }
-
- ///
- /// The show that contains this season.
- ///
- [LoadableRelation(nameof(ShowId))]
- public Show? Show { get; set; }
-
- ///
- /// The number of this season. This can be set to 0 to indicate specials.
- ///
- public int SeasonNumber { get; set; }
-
- ///
- /// The title of this season.
- ///
- public string? Name { get; set; }
-
- ///
- /// A quick overview of this season.
- ///
- public string? Overview { get; set; }
-
- ///
- /// The starting air date of this season.
- ///
- public DateOnly? StartDate { get; set; }
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- /// The ending date of this season.
- ///
- public DateOnly? EndDate { get; set; }
-
- ///
- public Image? Poster { get; set; }
-
- ///
- public Image? Thumbnail { get; set; }
-
- ///
- public Image? Logo { get; set; }
-
- ///
- public Dictionary ExternalId { get; set; } = new();
-
- ///
- public DateTime? NextMetadataRefresh { get; set; }
-
- ///
- /// The list of episodes that this season contains.
- ///
- [JsonIgnore]
- public ICollection? Episodes { get; set; }
-
- ///
- /// The number of episodes in this season.
- ///
- [Projectable(UseMemberBody = nameof(_EpisodesCount), OnlyOnInclude = true)]
- [NotMapped]
- [LoadableRelation(
- // language=PostgreSQL
- Projected = """
- (
- select
- count(*)::int
- from
- episodes as e
- where
- e.season_id = id) as episodes_count
- """
- )]
- public int EpisodesCount { get; set; }
-
- private int _EpisodesCount => Episodes!.Count;
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Show.cs b/back/src/Kyoo.Abstractions/Models/Resources/Show.cs
deleted file mode 100644
index b3af184f..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Show.cs
+++ /dev/null
@@ -1,283 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Text.Json.Serialization;
-using EntityFrameworkCore.Projectables;
-using Kyoo.Abstractions.Controllers;
-using Kyoo.Abstractions.Models.Attributes;
-using Kyoo.Utils;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A series or a movie.
-///
-public class Show
- : IQuery,
- IResource,
- IMetadata,
- IOnMerge,
- IThumbnails,
- IAddedDate,
- IRefreshable,
- ILibraryItem,
- IWatchlist
-{
- public static Sort DefaultSort => new Sort.By(x => x.Name);
-
- ///
- public Guid Id { get; set; }
-
- ///
- [MaxLength(256)]
- public string Slug { get; set; }
-
- ///
- /// The title of this show.
- ///
- public string Name { get; set; }
-
- ///
- /// A catchphrase for this show.
- ///
- public string? Tagline { get; set; }
-
- ///
- /// The list of alternative titles of this show.
- ///
- public List Aliases { get; set; } = new();
-
- ///
- /// The summary of this show.
- ///
- public string? Overview { get; set; }
-
- ///
- /// A list of tags that match this movie.
- ///
- public List Tags { get; set; } = new();
-
- ///
- /// The list of genres (themes) this show has.
- ///
- public List Genres { get; set; } = new();
-
- ///
- /// Is this show airing, not aired yet or finished?
- ///
- public Status Status { get; set; }
-
- ///
- /// How well this item is rated? (from 0 to 100).
- ///
- public int Rating { get; set; }
-
- ///
- /// The date this show started airing. It can be null if this is unknown.
- ///
- public DateOnly? StartAir { get; set; }
-
- ///
- /// The date this show finished airing.
- /// It can also be null if this is unknown.
- ///
- public DateOnly? EndAir { get; set; }
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- public Image? Poster { get; set; }
-
- ///
- public Image? Thumbnail { get; set; }
-
- ///
- public Image? Logo { get; set; }
-
- ///
- /// A video of a few minutes that tease the content.
- ///
- public string? Trailer { get; set; }
-
- [JsonIgnore]
- [Column("start_air")]
- public DateOnly? AirDate => StartAir;
-
- ///
- public Dictionary ExternalId { get; set; } = new();
-
- ///
- public DateTime? NextMetadataRefresh { get; set; }
-
- ///
- /// The ID of the Studio that made this show.
- ///
- public Guid? StudioId { get; set; }
-
- ///
- /// The Studio that made this show.
- ///
- [LoadableRelation(nameof(StudioId))]
- public Studio? Studio { get; set; }
-
- ///
- /// The different seasons in this show. If this is a movie, this list is always null or empty.
- ///
- [JsonIgnore]
- public ICollection? Seasons { get; set; }
-
- ///
- /// The list of episodes in this show.
- /// If this is a movie, there will be a unique episode (with the seasonNumber and episodeNumber set to null).
- /// Having an episode is necessary to store metadata and tracks.
- ///
- [JsonIgnore]
- public ICollection? Episodes { get; set; }
-
- ///
- /// The list of collections that contains this show.
- ///
- [JsonIgnore]
- public ICollection? Collections { get; set; }
-
- ///
- /// The first episode of this show.
- ///
- [Projectable(UseMemberBody = nameof(_FirstEpisode), OnlyOnInclude = true)]
- [LoadableRelation(
- // language=PostgreSQL
- Sql = """
- select
- fe.* -- Episode as fe
- from (
- select
- e.*,
- row_number() over (partition by e.show_id order by e.absolute_number, e.season_number, e.episode_number) as number
- from
- episodes as e) as "fe"
- where
- fe.number <= 1
- """,
- On = "show_id = \"this\".id"
- )]
- public Episode? FirstEpisode { get; set; }
-
- private Episode? _FirstEpisode =>
- Episodes!
- .OrderBy(x => x.AbsoluteNumber)
- .ThenBy(x => x.SeasonNumber)
- .ThenBy(x => x.EpisodeNumber)
- .FirstOrDefault();
-
- ///
- /// The number of episodes in this show.
- ///
- [Projectable(UseMemberBody = nameof(_EpisodesCount), OnlyOnInclude = true)]
- [NotMapped]
- [LoadableRelation(
- // language=PostgreSQL
- Projected = """
- (
- select
- count(*)::int
- from
- episodes as e
- where
- e.show_id = "this".id) as episodes_count
- """
- )]
- public int EpisodesCount { get; set; }
-
- private int _EpisodesCount => Episodes!.Count;
-
- [JsonIgnore]
- public ICollection? Watched { get; set; }
-
- ///
- /// Metadata of what an user as started/planned to watch.
- ///
- [Projectable(UseMemberBody = nameof(_WatchStatus), OnlyOnInclude = true)]
- [LoadableRelation(
- Sql = "show_watch_status",
- On = "show_id = \"this\".id and \"relation\".user_id = [current_user]"
- )]
- public ShowWatchStatus? WatchStatus { get; set; }
-
- // There is a global query filter to filter by user so we just need to do single.
- private ShowWatchStatus? _WatchStatus => Watched!.FirstOrDefault();
-
- ///
- public void OnMerge(object merged)
- {
- if (Seasons != null)
- {
- foreach (Season season in Seasons)
- season.Show = this;
- }
-
- if (Episodes != null)
- {
- foreach (Episode episode in Episodes)
- episode.Show = this;
- }
- }
-
- public Show() { }
-
- [JsonConstructor]
- public Show(string name)
- {
- if (name != null)
- {
- Slug = Utility.ToSlug(name);
- Name = name;
- }
- }
-}
-
-///
-/// The enum containing show's status.
-///
-public enum Status
-{
- ///
- /// The status of the show is not known.
- ///
- Unknown,
-
- ///
- /// The show has finished airing.
- ///
- Finished,
-
- ///
- /// The show is still actively airing.
- ///
- Airing,
-
- ///
- /// This show has not aired yet but has been announced.
- ///
- Planned
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Studio.cs b/back/src/Kyoo.Abstractions/Models/Resources/Studio.cs
deleted file mode 100644
index 9b6a5575..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/Studio.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text.Json.Serialization;
-using Kyoo.Abstractions.Controllers;
-using Kyoo.Utils;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A studio that make shows.
-///
-public class Studio : IQuery, IResource, IMetadata
-{
- public static Sort DefaultSort => new Sort.By(x => x.Name);
-
- ///
- public Guid Id { get; set; }
-
- ///
- [MaxLength(256)]
- public string Slug { get; set; }
-
- ///
- /// The name of this studio.
- ///
- public string Name { get; set; }
-
- ///
- /// The list of shows that are made by this studio.
- ///
- [JsonIgnore]
- public ICollection? Shows { get; set; }
-
- ///
- /// The list of movies that are made by this studio.
- ///
- [JsonIgnore]
- public ICollection? Movies { get; set; }
-
- ///
- public Dictionary ExternalId { get; set; } = new();
-
- ///
- /// Create a new, empty, .
- ///
- public Studio() { }
-
- ///
- /// Create a new with a specific name, the slug is calculated automatically.
- ///
- /// The name of the studio.
- [JsonConstructor]
- public Studio(string name)
- {
- if (name != null)
- {
- Slug = Utility.ToSlug(name);
- Name = name;
- }
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/User.cs b/back/src/Kyoo.Abstractions/Models/Resources/User.cs
deleted file mode 100644
index 2dfffc70..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/User.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text.Json.Serialization;
-using Kyoo.Abstractions.Controllers;
-using Kyoo.Utils;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// A single user of the app.
-///
-public class User : IQuery, IResource, IAddedDate
-{
- public static Sort DefaultSort => new Sort.By(x => x.Username);
-
- ///
- public Guid Id { get; set; }
-
- ///
- [MaxLength(256)]
- public string Slug { get; set; }
-
- ///
- /// A username displayed to the user.
- ///
- public string Username { get; set; }
-
- ///
- /// The user email address.
- ///
- public string Email { get; set; }
-
- ///
- /// The user password (hashed, it can't be read like that). The hashing format is implementation defined.
- ///
- [JsonIgnore]
- public string? Password { get; set; }
-
- ///
- /// Does the user can sign-in with a password or only via oidc?
- ///
- public bool HasPassword => Password != null;
-
- ///
- /// The list of permissions of the user. The format of this is implementation dependent.
- ///
- public string[] Permissions { get; set; } = Array.Empty();
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- /// User settings
- ///
- public Dictionary Settings { get; set; } = new();
-
- ///
- /// User accounts on other services.
- ///
- public Dictionary ExternalId { get; set; } = new();
-
- public User() { }
-
- [JsonConstructor]
- public User(string username)
- {
- if (username != null)
- {
- Slug = Utility.ToSlug(username);
- Username = username;
- }
- }
-}
-
-public class ExternalToken
-{
- ///
- /// The id of this user on the external service.
- ///
- public string Id { get; set; }
-
- ///
- /// The username on the external service.
- ///
- public string Username { get; set; }
-
- ///
- /// The link to the user profile on this website. Null if it does not exist.
- ///
- public string? ProfileUrl { get; set; }
-
- ///
- /// A jwt token used to interact with the service.
- /// Do not forget to refresh it when using it if necessary.
- ///
- public JwtToken Token { get; set; }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs b/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs
deleted file mode 100644
index d6576f5e..00000000
--- a/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs
+++ /dev/null
@@ -1,279 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Text.Json.Serialization;
-using Kyoo.Abstractions.Models.Attributes;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// Has the user started watching, is it planned?
-///
-public enum WatchStatus
-{
- ///
- /// The user has already watched this.
- ///
- Completed,
-
- ///
- /// The user started watching this but has not finished.
- ///
- Watching,
-
- ///
- /// The user does not plan to continue watching.
- ///
- Droped,
-
- ///
- /// The user has not started watching this but plans to.
- ///
- Planned,
-
- ///
- /// The watch status was deleted and can not be retrived again.
- ///
- Deleted,
-}
-
-///
-/// Metadata of what an user as started/planned to watch.
-///
-[SqlFirstColumn(nameof(UserId))]
-public class MovieWatchStatus : IAddedDate
-{
- ///
- /// The ID of the user that started watching this episode.
- ///
- public Guid UserId { get; set; }
-
- ///
- /// The user that started watching this episode.
- ///
- [JsonIgnore]
- public User User { get; set; }
-
- ///
- /// The ID of the movie started.
- ///
- public Guid MovieId { get; set; }
-
- ///
- /// The started.
- ///
- [JsonIgnore]
- public Movie Movie { get; set; }
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- /// The date at which this item was played.
- ///
- public DateTime? PlayedDate { get; set; }
-
- ///
- /// Has the user started watching, is it planned?
- ///
- public WatchStatus Status { get; set; }
-
- ///
- /// Where the player has stopped watching the movie (in seconds).
- ///
- ///
- /// Null if the status is not Watching.
- ///
- public int? WatchedTime { get; set; }
-
- ///
- /// Where the player has stopped watching the movie (in percentage between 0 and 100).
- ///
- ///
- /// Null if the status is not Watching.
- ///
- public int? WatchedPercent { get; set; }
-}
-
-[SqlFirstColumn(nameof(UserId))]
-public class EpisodeWatchStatus : IAddedDate
-{
- ///
- /// The ID of the user that started watching this episode.
- ///
- public Guid UserId { get; set; }
-
- ///
- /// The user that started watching this episode.
- ///
- [JsonIgnore]
- public User User { get; set; }
-
- ///
- /// The ID of the episode started.
- ///
- public Guid? EpisodeId { get; set; }
-
- ///
- /// The started.
- ///
- [JsonIgnore]
- public Episode Episode { get; set; }
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- /// The date at which this item was played.
- ///
- public DateTime? PlayedDate { get; set; }
-
- ///
- /// Has the user started watching, is it planned?
- ///
- public WatchStatus Status { get; set; }
-
- ///
- /// Where the player has stopped watching the episode (in seconds).
- ///
- ///
- /// Null if the status is not Watching.
- ///
- public int? WatchedTime { get; set; }
-
- ///
- /// Where the player has stopped watching the episode (in percentage between 0 and 100).
- ///
- ///
- /// Null if the status is not Watching or if the next episode is not started.
- ///
- public int? WatchedPercent { get; set; }
-}
-
-[SqlFirstColumn(nameof(UserId))]
-public class ShowWatchStatus : IAddedDate
-{
- ///
- /// The ID of the user that started watching this episode.
- ///
- public Guid UserId { get; set; }
-
- ///
- /// The user that started watching this episode.
- ///
- [JsonIgnore]
- public User User { get; set; }
-
- ///
- /// The ID of the show started.
- ///
- public Guid ShowId { get; set; }
-
- ///
- /// The started.
- ///
- [JsonIgnore]
- public Show Show { get; set; }
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- /// The date at which this item was played.
- ///
- public DateTime? PlayedDate { get; set; }
-
- ///
- /// Has the user started watching, is it planned?
- ///
- public WatchStatus Status { get; set; }
-
- ///
- /// The number of episodes the user has not seen.
- ///
- public int UnseenEpisodesCount { get; set; }
-
- ///
- /// The ID of the episode started.
- ///
- public Guid? NextEpisodeId { get; set; }
-
- ///
- /// The next to watch.
- ///
- public Episode? NextEpisode { get; set; }
-
- ///
- /// Where the player has stopped watching the episode (in seconds).
- ///
- ///
- /// Null if the status is not Watching or if the next episode is not started.
- ///
- public int? WatchedTime { get; set; }
-
- ///
- /// Where the player has stopped watching the episode (in percentage between 0 and 100).
- ///
- ///
- /// Null if the status is not Watching or if the next episode is not started.
- ///
- public int? WatchedPercent { get; set; }
-}
-
-public class WatchStatus : IAddedDate
-{
- ///
- /// Has the user started watching, is it planned?
- ///
- public required WatchStatus Status { get; set; }
-
- ///
- public DateTime AddedDate { get; set; }
-
- ///
- /// The date at which this item was played.
- ///
- public DateTime? PlayedDate { get; set; }
-
- ///
- /// Where the player has stopped watching the episode (in seconds).
- ///
- ///
- /// Null if the status is not Watching or if the next episode is not started.
- ///
- public int? WatchedTime { get; set; }
-
- ///
- /// Where the player has stopped watching the episode (in percentage between 0 and 100).
- ///
- ///
- /// Null if the status is not Watching or if the next episode is not started.
- ///
- public int? WatchedPercent { get; set; }
-
- ///
- /// The user that started watching this episode.
- ///
- public required User User { get; set; }
-
- ///
- /// The episode/show/movie whose status changed
- ///
- public required T Resource { get; set; }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/SearchPage.cs b/back/src/Kyoo.Abstractions/Models/SearchPage.cs
deleted file mode 100644
index 8ce2043a..00000000
--- a/back/src/Kyoo.Abstractions/Models/SearchPage.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System.Collections.Generic;
-
-namespace Kyoo.Abstractions.Models;
-
-///
-/// Results of a search request.
-///
-/// The search item's type.
-public class SearchPage : Page
- where T : IResource
-{
- public SearchPage(
- SearchResult result,
- string @this,
- string? previous,
- string? next,
- string first
- )
- : base(result.Items, @this, previous, next, first)
- {
- Query = result.Query;
- }
-
- ///
- /// The query of the search request.
- ///
- public string? Query { get; init; }
-
- public class SearchResult
- {
- public string? Query { get; set; }
-
- public ICollection Items { get; set; }
- }
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Utils/Claims.cs b/back/src/Kyoo.Abstractions/Models/Utils/Claims.cs
deleted file mode 100644
index c8d8c3c7..00000000
--- a/back/src/Kyoo.Abstractions/Models/Utils/Claims.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-namespace Kyoo.Authentication.Models;
-
-///
-/// List of well known claims of kyoo
-///
-public static class Claims
-{
- ///
- /// The id of the user
- ///
- public static string Id => "id";
-
- ///
- /// The name of the user
- ///
- public static string Name => "name";
-
- ///
- /// The email of the user.
- ///
- public static string Email => "email";
-
- ///
- /// The list of permissions that the user has.
- ///
- public static string Permissions => "permissions";
-
- ///
- /// The type of the token (either "access" or "refresh").
- ///
- public static string Type => "type";
-
- ///
- /// A guid used to identify a specific refresh token. This is only useful for the server to revokate tokens.
- ///
- public static string Guid => "guid";
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Utils/Constants.cs b/back/src/Kyoo.Abstractions/Models/Utils/Constants.cs
deleted file mode 100644
index f12c44d5..00000000
--- a/back/src/Kyoo.Abstractions/Models/Utils/Constants.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using Kyoo.Abstractions.Models.Attributes;
-
-namespace Kyoo.Abstractions.Models.Utils;
-
-///
-/// A class containing constant numbers.
-///
-public static class Constants
-{
- ///
- /// A property to use on a Microsoft.AspNet.MVC.Route.Order property to mark it as an alternative route
- /// that won't be included on the swagger.
- ///
- public const int AlternativeRoute = 1;
-
- ///
- /// A group name for . It should be used for endpoints used by users.
- ///
- public const string UsersGroup = "0:Users";
-
- ///
- /// A group name for . It should be used for main resources of kyoo.
- ///
- public const string ResourcesGroup = "1:Resources";
-
- ///
- /// A group name for .
- /// It should be used for sub resources of kyoo that help define the main resources.
- ///
- public const string MetadataGroup = "2:Metadata";
-
- ///
- /// A group name for . It should be used for endpoints useful for playback.
- ///
- public const string WatchGroup = "3:Watch";
-
- ///
- /// A group name for . It should be used for endpoints used by admins.
- ///
- public const string AdminGroup = "4:Admin";
- public const string OtherGroup = "5:Other";
-}
diff --git a/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs b/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs
deleted file mode 100644
index 4d832928..00000000
--- a/back/src/Kyoo.Abstractions/Models/Utils/Filter.cs
+++ /dev/null
@@ -1,369 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Reflection;
-using Kyoo.Abstractions.Models.Attributes;
-using Sprache;
-
-namespace Kyoo.Abstractions.Models.Utils;
-
-public static class ParseHelper
-{
- public static Parser ErrorMessage(this Parser @this, string message) =>
- input =>
- {
- IResult result = @this(input);
-
- return result.WasSuccessful
- ? result
- : Result.Failure(result.Remainder, message, result.Expectations);
- };
-
- public static Parser Error(string message) =>
- input =>
- {
- return Result.Failure(input, message, Array.Empty());
- };
-}
-
-public abstract record Filter
-{
- public static Filter? And(params Filter?[] filters)
- {
- return filters
- .Where(x => x != null)
- .Aggregate(
- (Filter?)null,
- (acc, filter) =>
- {
- if (acc == null)
- return filter;
- return new Filter.And(acc, filter!);
- }
- );
- }
-
- public static Filter? Or(params Filter?[] filters)
- {
- return filters
- .Where(x => x != null)
- .Aggregate(
- (Filter?)null,
- (acc, filter) =>
- {
- if (acc == null)
- return filter;
- return new Filter.Or(acc, filter!);
- }
- );
- }
-}
-
-public abstract record Filter : Filter
-{
- public record And(Filter First, Filter Second) : Filter;
-
- public record Or(Filter First, Filter Second) : Filter;
-
- public record Not(Filter Filter) : Filter;
-
- public record Eq(string Property, object? Value) : Filter;
-
- public record Ne(string Property, object? Value) : Filter;
-
- public record Gt(string Property, object Value) : Filter;
-
- public record Ge(string Property, object Value) : Filter;
-
- public record Lt(string Property, object Value) : Filter;
-
- public record Le(string Property, object Value) : Filter;
-
- public record Has(string Property, object Value) : Filter;
-
- ///
- /// Internal filter used for keyset paginations to resume random sorts.
- /// The pseudo sql is md5(seed || table.id) = md5(seed || 'hardCodedId')
- ///
- public record CmpRandom(string cmp, string Seed, Guid ReferenceId) : Filter;
-
- ///
- /// Internal filter used only in EF with hard coded lamdas (used for relations).
- ///
- public record Lambda(Expression> Inner) : Filter;
-
- public static class FilterParsers
- {
- public static readonly Parser> Filter = Parse
- .Ref(() => Bracket)
- .Or(Parse.Ref(() => Not))
- .Or(Parse.Ref(() => Eq))
- .Or(Parse.Ref(() => Ne))
- .Or(Parse.Ref(() => Gt))
- .Or(Parse.Ref(() => Ge))
- .Or(Parse.Ref(() => Lt))
- .Or(Parse.Ref(() => Le))
- .Or(Parse.Ref(() => Has));
-
- public static readonly Parser> CompleteFilter = Parse
- .Ref(() => Or)
- .Or(Parse.Ref(() => And))
- .Or(Filter);
-
- public static readonly Parser> Bracket =
- from open in Parse.Char('(').Token()
- from filter in CompleteFilter
- from close in Parse.Char(')').Token()
- select filter;
-
- public static readonly Parser> AndOperator = Parse
- .IgnoreCase("and")
- .Or(Parse.String("&&"))
- .Token();
-
- public static readonly Parser> OrOperator = Parse
- .IgnoreCase("or")
- .Or(Parse.String("||"))
- .Token();
-
- public static readonly Parser> And = Parse.ChainOperator(
- AndOperator,
- Filter,
- (_, a, b) => new And(a, b)
- );
-
- public static readonly Parser> Or = Parse.ChainOperator(
- OrOperator,
- And.Or(Filter),
- (_, a, b) => new Or(a, b)
- );
-
- public static readonly Parser> Not =
- from not in Parse.IgnoreCase("not").Or(Parse.String("!")).Token()
- from filter in CompleteFilter
- select new Not(filter);
-
- private static Parser