Skip to content

Commit 9b272f4

Browse files
pajowuanuejn
authored andcommitted
✨ Desktop: More routes, local media support in worker
1 parent a64c55c commit 9b272f4

17 files changed

Lines changed: 592 additions & 219 deletions

File tree

backend/openapi-schema.yml

Lines changed: 69 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ components:
3333
type: string
3434
media_files:
3535
items:
36-
$ref: '#/components/schemas/DocumentMedia'
36+
$ref: '#/components/schemas/RemoteDocumentMedia'
3737
title: Media Files
3838
type: array
3939
name:
@@ -66,7 +66,7 @@ components:
6666
title: Dependencies
6767
type: array
6868
document:
69-
$ref: '#/components/schemas/Document'
69+
$ref: '#/components/schemas/RemoteDocument'
7070
document_id:
7171
format: uuid
7272
title: Document Id
@@ -229,7 +229,9 @@ components:
229229
type: string
230230
media_files:
231231
items:
232-
$ref: '#/components/schemas/DocumentMedia'
232+
anyOf:
233+
- $ref: '#/components/schemas/LocalDocumentMedia'
234+
- $ref: '#/components/schemas/RemoteDocumentMedia'
233235
title: Media Files
234236
type: array
235237
name:
@@ -243,25 +245,6 @@ components:
243245
- media_files
244246
title: Document
245247
type: object
246-
DocumentMedia:
247-
properties:
248-
content_type:
249-
title: Content Type
250-
type: string
251-
tags:
252-
items:
253-
type: string
254-
title: Tags
255-
type: array
256-
url:
257-
title: Url
258-
type: string
259-
required:
260-
- url
261-
- content_type
262-
- tags
263-
title: DocumentMedia
264-
type: object
265248
DocumentShareTokenBase:
266249
properties:
267250
can_write:
@@ -325,7 +308,7 @@ components:
325308
type: string
326309
media_files:
327310
items:
328-
$ref: '#/components/schemas/DocumentMedia'
311+
$ref: '#/components/schemas/RemoteDocumentMedia'
329312
title: Media Files
330313
type: array
331314
name:
@@ -422,6 +405,21 @@ components:
422405
title: Progress
423406
title: KeepaliveBody
424407
type: object
408+
LocalDocumentMedia:
409+
properties:
410+
path:
411+
title: Path
412+
type: string
413+
tags:
414+
items:
415+
type: string
416+
title: Tags
417+
type: array
418+
required:
419+
- tags
420+
- path
421+
title: LocalDocumentMedia
422+
type: object
425423
LoginResponse:
426424
properties:
427425
token:
@@ -458,6 +456,53 @@ components:
458456
title: Logged Out Redirect Url
459457
title: PublicConfig
460458
type: object
459+
RemoteDocument:
460+
properties:
461+
changed_at:
462+
title: Changed At
463+
type: string
464+
created_at:
465+
title: Created At
466+
type: string
467+
id:
468+
format: uuid
469+
title: Id
470+
type: string
471+
media_files:
472+
items:
473+
$ref: '#/components/schemas/RemoteDocumentMedia'
474+
title: Media Files
475+
type: array
476+
name:
477+
title: Name
478+
type: string
479+
required:
480+
- id
481+
- name
482+
- created_at
483+
- changed_at
484+
- media_files
485+
title: RemoteDocument
486+
type: object
487+
RemoteDocumentMedia:
488+
properties:
489+
content_type:
490+
title: Content Type
491+
type: string
492+
tags:
493+
items:
494+
type: string
495+
title: Tags
496+
type: array
497+
url:
498+
title: Url
499+
type: string
500+
required:
501+
- tags
502+
- url
503+
- content_type
504+
title: RemoteDocumentMedia
505+
type: object
461506
SetDurationRequest:
462507
properties:
463508
duration:
@@ -1166,7 +1211,7 @@ paths:
11661211
application/json:
11671212
schema:
11681213
items:
1169-
$ref: '#/components/schemas/DocumentMedia'
1214+
$ref: '#/components/schemas/RemoteDocumentMedia'
11701215
title: Response Get Document Media Api V1 Documents Document Id Media
11711216
Files Get
11721217
type: array

backend/transcribee_backend/models/document.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
from pydantic.types import AwareDatetime
55
from sqlmodel import DateTime, Field, Relationship, SQLModel
6-
from transcribee_proto.api import Document as ApiDocument
7-
from transcribee_proto.api import DocumentMedia as ApiDocumentMedia
6+
from transcribee_proto.api import RemoteDocument as ApiDocument
7+
from transcribee_proto.api import RemoteDocumentMedia as ApiDocumentMedia
88

99
from transcribee_backend import media_storage
1010
from transcribee_backend.util.base_url import BaseUrl

backend/transcribee_backend/models/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from typing import Any, Dict, List, Literal, Optional
66

77
from sqlmodel import JSON, Column, Field, ForeignKey, Relationship, SQLModel, Uuid
8-
from transcribee_proto.api import Document as ApiDocument
98
from transcribee_proto.api import ExportTaskParameters, TaskType
9+
from transcribee_proto.api import RemoteDocument as ApiDocument
1010
from typing_extensions import Self
1111

1212
from transcribee_backend.config import settings

backend/transcribee_backend/routers/document.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
from sqlalchemy.sql.expression import desc
2828
from sqlmodel import Session, col, select
2929
from transcribee_proto.api import Document as ApiDocument
30-
from transcribee_proto.api import DocumentMedia, ExportTaskParameters
3130
from transcribee_proto.api import DocumentWithAccessInfo as ApiDocumentWithAccessInfo
31+
from transcribee_proto.api import ExportTaskParameters, RemoteDocumentMedia
3232

3333
from transcribee_backend.auth import (
3434
generate_share_token,
@@ -442,7 +442,7 @@ def get_document(
442442
def get_document_media(
443443
auth: AuthInfo = Depends(get_doc_min_readonly_auth),
444444
baseUrl: BaseUrl = Depends(get_base_url),
445-
) -> List[DocumentMedia]:
445+
) -> List[RemoteDocumentMedia]:
446446
return auth.document.as_api_document(baseUrl=baseUrl).media_files
447447

448448

0 commit comments

Comments
 (0)