-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic annotation rendering, beginning annotation editing
- Loading branch information
1 parent
074bd28
commit fafc0a8
Showing
14 changed files
with
737 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging | ||
|
||
from django.http import HttpRequest | ||
from ninja import Schema | ||
from ninja.errors import HttpError | ||
from ninja.pagination import RouterPaginated | ||
from oauth2_provider.models import AccessToken | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
router = RouterPaginated() | ||
|
||
|
||
class AnnotationSchema(Schema): | ||
recording: int # Foreign Key to index | ||
owner_username: str | ||
start_time: int | ||
end_time: int | ||
low_freq: int | ||
high_freq: int | ||
species: list[int] | ||
comments: str | ||
|
||
|
||
def get_owner_id(request: HttpRequest): | ||
token = request.headers.get('Authorization').replace('Bearer ', '') | ||
token_found = AccessToken.objects.get(token=token) | ||
if not token_found: | ||
raise HttpError(401, 'Authentication credentials were not provided.') | ||
|
||
return token_found.user.pk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.