-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(histories): added serializers and updated space view
- Loading branch information
1 parent
4ff9a64
commit a267240
Showing
5 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
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,18 @@ | ||
from __future__ import annotations | ||
|
||
from typing import ClassVar | ||
|
||
from rest_framework import serializers | ||
|
||
from django_napse.api.histories.serializers.datapoint_field import HistoryDataPointFieldSerializer | ||
from django_napse.core.models.histories.history import HistoryDataPoint | ||
|
||
|
||
class HistoryDataPointSerializer(serializers.ModelSerializer): | ||
"""Serialize a wallet instance.""" | ||
|
||
fields = HistoryDataPointFieldSerializer(many=True) | ||
|
||
class Meta: # noqa: D106 | ||
model = HistoryDataPoint | ||
fields: ClassVar[list[str]] = ["created_at", "fields"] |
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,13 @@ | ||
from __future__ import annotations | ||
|
||
from rest_framework import serializers | ||
|
||
from django_napse.core.models.histories.history import HistoryDataPointField | ||
|
||
|
||
class HistoryDataPointFieldSerializer(serializers.ModelSerializer): | ||
"""Serialize a wallet instance.""" | ||
|
||
class Meta: # noqa: D106 | ||
model = HistoryDataPointField | ||
fields: str = ["key", "value", "target_type"] |
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,21 @@ | ||
from __future__ import annotations | ||
|
||
from typing import ClassVar | ||
|
||
from rest_framework import serializers | ||
|
||
from django_napse.api.histories.serializers.datapoint import HistoryDataPointSerializer | ||
from django_napse.core.models.histories.history import History | ||
|
||
|
||
class HistorySerializer(serializers.ModelSerializer): | ||
"""Serialize a wallet instance.""" | ||
|
||
data_points = HistoryDataPointSerializer(many=True) | ||
|
||
class Meta: # noqa: D106 | ||
model = History | ||
fields: ClassVar[list[str]] = [ | ||
"uuid", | ||
"data_points", | ||
] |
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