chore: remove cloud storage remainings (#1934)

This commit is contained in:
Jonas L 2022-07-04 22:09:14 +02:00 committed by GitHub
parent 0e6b0da142
commit 703a8e5856
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 50 additions and 3571 deletions

View file

@ -0,0 +1,39 @@
# pylint: disable=invalid-name
from django.db import migrations
from ._migrations import legacy_migration_factory
UP = """
DROP TABLE IF EXISTS "cloud_file" CASCADE;
"""
DOWN = """
CREATE TABLE "cloud_file"
(
"id" serial NOT NULL,
"storage_backend" VARCHAR(512) NOT NULL,
"resource_id" TEXT NOT NULL,
"cc_file_id" INTEGER,
PRIMARY KEY ("id")
);
ALTER TABLE "cloud_file" ADD CONSTRAINT "cloud_file_FK_1"
FOREIGN KEY ("cc_file_id")
REFERENCES "cc_files" ("id")
ON DELETE CASCADE;
"""
class Migration(migrations.Migration):
dependencies = [
("legacy", "0033_3_0_0_alpha_13_7"),
]
operations = [
migrations.RunPython(
code=legacy_migration_factory(
target="3.0.0-alpha.13.8",
sql=UP,
)
)
]

View file

@ -1 +1 @@
LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.7"
LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.8"

View file

@ -100,21 +100,6 @@ CREATE TABLE "cc_track_types"
CONSTRAINT "cc_track_types_code_idx" UNIQUE ("code")
);
-----------------------------------------------------------------------
-- cloud_file
-----------------------------------------------------------------------
DROP TABLE IF EXISTS "cloud_file" CASCADE;
CREATE TABLE "cloud_file"
(
"id" serial NOT NULL,
"storage_backend" VARCHAR(512) NOT NULL,
"resource_id" TEXT NOT NULL,
"cc_file_id" INTEGER,
PRIMARY KEY ("id")
);
-----------------------------------------------------------------------
-- cc_show
-----------------------------------------------------------------------
@ -735,11 +720,6 @@ ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey"
FOREIGN KEY ("editedby")
REFERENCES "cc_subjs" ("id");
ALTER TABLE "cloud_file" ADD CONSTRAINT "cloud_file_FK_1"
FOREIGN KEY ("cc_file_id")
REFERENCES "cc_files" ("id")
ON DELETE CASCADE;
ALTER TABLE "cc_show" ADD CONSTRAINT "cc_playlist_autoplaylist_fkey"
FOREIGN KEY ("autoplaylist_id")
REFERENCES "cc_playlist" ("id")

View file

@ -1,3 +1,2 @@
from .cloud_file import CloudFile
from .file import File
from .library import Library

View file

@ -1,17 +0,0 @@
from django.db import models
class CloudFile(models.Model):
storage_backend = models.CharField(max_length=512)
resource_id = models.TextField()
filename = models.ForeignKey(
"storage.File",
on_delete=models.DO_NOTHING,
blank=True,
null=True,
db_column="cc_file_id",
)
class Meta:
managed = False
db_table = "cloud_file"

View file

@ -1,8 +1,7 @@
from rest_framework import routers
from .views import CloudFileViewSet, FileViewSet, LibraryViewSet
from .views import FileViewSet, LibraryViewSet
router = routers.DefaultRouter()
router.register("files", FileViewSet)
router.register("cloud-files", CloudFileViewSet)
router.register("libraries", LibraryViewSet)

View file

@ -1,3 +1,2 @@
from .cloud_file import CloudFileSerializer
from .file import FileSerializer
from .library import LibrarySerializer

View file

@ -1,9 +0,0 @@
from rest_framework import serializers
from ..models import CloudFile
class CloudFileSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = CloudFile
fields = "__all__"

View file

@ -1,3 +1,2 @@
from .cloud_file import CloudFileViewSet
from .file import FileViewSet
from .library import LibraryViewSet

View file

@ -1,10 +0,0 @@
from rest_framework import viewsets
from ..models import CloudFile
from ..serializers import CloudFileSerializer
class CloudFileViewSet(viewsets.ModelViewSet):
queryset = CloudFile.objects.all()
serializer_class = CloudFileSerializer
model_permission_name = "cloudfile"

View file

@ -151,153 +151,6 @@ paths:
responses:
"204":
description: No response body
/api/v2/cloud-files/:
get:
operationId: cloud_files_list
tags:
- cloud-files
security:
- cookieAuth: []
- basicAuth: []
responses:
"200":
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/CloudFile"
description: ""
post:
operationId: cloud_files_create
tags:
- cloud-files
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CloudFile"
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/CloudFile"
multipart/form-data:
schema:
$ref: "#/components/schemas/CloudFile"
required: true
security:
- cookieAuth: []
- basicAuth: []
responses:
"201":
content:
application/json:
schema:
$ref: "#/components/schemas/CloudFile"
description: ""
/api/v2/cloud-files/{id}/:
get:
operationId: cloud_files_retrieve
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this cloud file.
required: true
tags:
- cloud-files
security:
- cookieAuth: []
- basicAuth: []
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/CloudFile"
description: ""
put:
operationId: cloud_files_update
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this cloud file.
required: true
tags:
- cloud-files
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CloudFile"
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/CloudFile"
multipart/form-data:
schema:
$ref: "#/components/schemas/CloudFile"
required: true
security:
- cookieAuth: []
- basicAuth: []
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/CloudFile"
description: ""
patch:
operationId: cloud_files_partial_update
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this cloud file.
required: true
tags:
- cloud-files
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/PatchedCloudFile"
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/PatchedCloudFile"
multipart/form-data:
schema:
$ref: "#/components/schemas/PatchedCloudFile"
security:
- cookieAuth: []
- basicAuth: []
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/CloudFile"
description: ""
delete:
operationId: cloud_files_destroy
parameters:
- in: path
name: id
schema:
type: integer
description: A unique integer value identifying this cloud file.
required: true
tags:
- cloud-files
security:
- cookieAuth: []
- basicAuth: []
responses:
"204":
description: No response body
/api/v2/countries/:
get:
operationId: countries_list
@ -5791,26 +5644,6 @@ components:
- status
- task_id
- track_reference
CloudFile:
type: object
properties:
item_url:
type: string
format: uri
readOnly: true
storage_backend:
type: string
maxLength: 512
resource_id:
type: string
filename:
type: string
format: uri
nullable: true
required:
- item_url
- resource_id
- storage_backend
Country:
type: object
properties:
@ -6238,22 +6071,6 @@ components:
track_reference:
type: string
format: uri
PatchedCloudFile:
type: object
properties:
item_url:
type: string
format: uri
readOnly: true
storage_backend:
type: string
maxLength: 512
resource_id:
type: string
filename:
type: string
format: uri
nullable: true
PatchedCountry:
type: object
properties: