feat(backend): [WIP] expose `privacy_level` in `Upload` object
This commit is contained in:
parent
70192906ba
commit
33a5b70435
|
@ -9291,16 +9291,25 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PatchedUploadForOwnerRequest'
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UploadBulkUpdateRequest'
|
||||||
application/x-www-form-urlencoded:
|
application/x-www-form-urlencoded:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PatchedUploadForOwnerRequest'
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UploadBulkUpdateRequest'
|
||||||
multipart/form-data:
|
multipart/form-data:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PatchedUploadForOwnerRequest'
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UploadBulkUpdateRequest'
|
||||||
application/activity+json:
|
application/activity+json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PatchedUploadForOwnerRequest'
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UploadBulkUpdateRequest'
|
||||||
|
required: true
|
||||||
security:
|
security:
|
||||||
- oauth2: []
|
- oauth2: []
|
||||||
- ApplicationToken: []
|
- ApplicationToken: []
|
||||||
|
@ -18957,16 +18966,25 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PatchedUploadForOwnerRequest'
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UploadBulkUpdateRequest'
|
||||||
application/x-www-form-urlencoded:
|
application/x-www-form-urlencoded:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PatchedUploadForOwnerRequest'
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UploadBulkUpdateRequest'
|
||||||
multipart/form-data:
|
multipart/form-data:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PatchedUploadForOwnerRequest'
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UploadBulkUpdateRequest'
|
||||||
application/activity+json:
|
application/activity+json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/PatchedUploadForOwnerRequest'
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/UploadBulkUpdateRequest'
|
||||||
|
required: true
|
||||||
security:
|
security:
|
||||||
- oauth2: []
|
- oauth2: []
|
||||||
- ApplicationToken: []
|
- ApplicationToken: []
|
||||||
|
@ -24609,6 +24627,8 @@ components:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/ImportStatusEnum'
|
- $ref: '#/components/schemas/ImportStatusEnum'
|
||||||
default: pending
|
default: pending
|
||||||
|
privacy_level:
|
||||||
|
$ref: '#/components/schemas/LibraryPrivacyLevelEnum'
|
||||||
import_metadata: {}
|
import_metadata: {}
|
||||||
import_reference:
|
import_reference:
|
||||||
type: string
|
type: string
|
||||||
|
@ -25667,6 +25687,17 @@ components:
|
||||||
- mimetype
|
- mimetype
|
||||||
- size
|
- size
|
||||||
- uuid
|
- uuid
|
||||||
|
UploadBulkUpdateRequest:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
uuid:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
privacy_level:
|
||||||
|
$ref: '#/components/schemas/LibraryPrivacyLevelEnum'
|
||||||
|
required:
|
||||||
|
- privacy_level
|
||||||
|
- uuid
|
||||||
UploadForOwner:
|
UploadForOwner:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
@ -25713,6 +25744,8 @@ components:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/ImportStatusEnum'
|
- $ref: '#/components/schemas/ImportStatusEnum'
|
||||||
default: pending
|
default: pending
|
||||||
|
privacy_level:
|
||||||
|
$ref: '#/components/schemas/LibraryPrivacyLevelEnum'
|
||||||
import_details:
|
import_details:
|
||||||
readOnly: true
|
readOnly: true
|
||||||
import_metadata: {}
|
import_metadata: {}
|
||||||
|
@ -25733,6 +25766,7 @@ components:
|
||||||
- import_details
|
- import_details
|
||||||
- metadata
|
- metadata
|
||||||
- mimetype
|
- mimetype
|
||||||
|
- privacy_level
|
||||||
- size
|
- size
|
||||||
- uuid
|
- uuid
|
||||||
UploadForOwnerRequest:
|
UploadForOwnerRequest:
|
||||||
|
@ -25753,6 +25787,8 @@ components:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/components/schemas/ImportStatusEnum'
|
- $ref: '#/components/schemas/ImportStatusEnum'
|
||||||
default: pending
|
default: pending
|
||||||
|
privacy_level:
|
||||||
|
$ref: '#/components/schemas/LibraryPrivacyLevelEnum'
|
||||||
import_metadata: {}
|
import_metadata: {}
|
||||||
import_reference:
|
import_reference:
|
||||||
type: string
|
type: string
|
||||||
|
@ -25768,6 +25804,7 @@ components:
|
||||||
writeOnly: true
|
writeOnly: true
|
||||||
required:
|
required:
|
||||||
- audio_file
|
- audio_file
|
||||||
|
- privacy_level
|
||||||
Usage:
|
Usage:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|
|
@ -372,6 +372,9 @@ class UploadSerializer(serializers.ModelSerializer):
|
||||||
required=False,
|
required=False,
|
||||||
filters=lambda context: {"actor": context["user"].actor},
|
filters=lambda context: {"actor": context["user"].actor},
|
||||||
)
|
)
|
||||||
|
privacy_level = serializers.ChoiceField(
|
||||||
|
choices=models.LIBRARY_PRIVACY_LEVEL_CHOICES
|
||||||
|
)
|
||||||
channel = common_serializers.RelatedField(
|
channel = common_serializers.RelatedField(
|
||||||
"uuid",
|
"uuid",
|
||||||
ChannelSerializer(),
|
ChannelSerializer(),
|
||||||
|
@ -395,6 +398,7 @@ class UploadSerializer(serializers.ModelSerializer):
|
||||||
"size",
|
"size",
|
||||||
"import_date",
|
"import_date",
|
||||||
"import_status",
|
"import_status",
|
||||||
|
"privacy_level",
|
||||||
]
|
]
|
||||||
|
|
||||||
read_only_fields = [
|
read_only_fields = [
|
||||||
|
@ -495,6 +499,7 @@ class UploadForOwnerSerializer(UploadSerializer):
|
||||||
r = super().to_representation(obj)
|
r = super().to_representation(obj)
|
||||||
if "audio_file" in r:
|
if "audio_file" in r:
|
||||||
del r["audio_file"]
|
del r["audio_file"]
|
||||||
|
r["privacy_level"] = obj.library.privacy_level
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def validate(self, validated_data):
|
def validate(self, validated_data):
|
||||||
|
|
|
@ -798,6 +798,9 @@ class UploadViewSet(
|
||||||
cover_data["content"] = base64.b64encode(cover_data["content"])
|
cover_data["content"] = base64.b64encode(cover_data["content"])
|
||||||
return Response(payload, status=200)
|
return Response(payload, status=200)
|
||||||
|
|
||||||
|
@extend_schema(
|
||||||
|
request=serializers.UploadBulkUpdateSerializer(many=True),
|
||||||
|
)
|
||||||
@action(detail=False, methods=["patch"])
|
@action(detail=False, methods=["patch"])
|
||||||
def bulk_update(self, request, *args, **kwargs):
|
def bulk_update(self, request, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue