Fix endpoint fields

This commit is contained in:
koalasat 2024-06-29 17:09:04 +02:00
parent 9855e5d1f2
commit 53bdb30166
5 changed files with 38 additions and 11 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 5.0.6 on 2024-06-29 14:07
import api.models.order
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0047_notification'),
]
operations = [
migrations.AlterField(
model_name='order',
name='reference',
field=models.UUIDField(default=api.models.order.custom_uuid, editable=False),
),
]

View File

@ -491,10 +491,17 @@ class OrderDetailSerializer(serializers.ModelSerializer):
class ListNotificationSerializer(serializers.ModelSerializer):
status = serializers.SerializerMethodField(
help_text="The `status` of the order when the notification was trigered",
)
class Meta:
model = Notification
fields = ("title", "description", "order_id", "status")
def get_status(self, notification) -> int:
return notification.order.status
class OrderPublicSerializer(serializers.ModelSerializer):
maker_nick = serializers.CharField(required=False)

View File

@ -761,11 +761,7 @@ class NotificationsView(ListAPIView):
notification_data = []
for notification in queryset:
data = self.serializer_class(notification).data
data["title"] = str(notification.title)
data["description"] = str(notification.description)
data["order_id"] = notification.order.id
data["status"] = notification.order.status
notification_data.append(data)
return Response(notification_data, status=status.HTTP_200_OK)

View File

@ -15,7 +15,7 @@ version: '3.9'
services:
bitcoind:
image: ruimarinho/bitcoin-core:${BITCOIND_VERSION:-24.0.1}-alpine
container_name: btc
container_name: test-btc
restart: always
ports:
- "8000:8000"
@ -50,7 +50,7 @@ services:
coordinator-LND:
image: lightninglabs/lnd:${LND_VERSION:-v0.17.0-beta}
container_name: coordinator-LND
container_name: test-coordinator-LND
restart: always
volumes:
- bitcoin:/root/.bitcoin/
@ -83,7 +83,7 @@ services:
coordinator-CLN:
image: elementsproject/lightningd:${CLN_VERSION:-v24.05}
restart: always
container_name: coordinator-CLN
container_name: test-coordinator-CLN
environment:
LIGHTNINGD_NETWORK: 'regtest'
volumes:
@ -97,7 +97,7 @@ services:
robot-LND:
image: lightninglabs/lnd:${LND_VERSION:-v0.17.0-beta}
container_name: robot-LND
container_name: test-robot-LND
restart: always
volumes:
- bitcoin:/root/.bitcoin/
@ -129,7 +129,7 @@ services:
redis:
image: redis:${REDIS_VERSION:-7.2.1}-alpine
container_name: redis
container_name: test-redis
restart: always
volumes:
- redisdata:/data
@ -141,7 +141,7 @@ services:
args:
DEVELOPMENT: True
image: backend-image
container_name: coordinator
container_name: test-coordinator
restart: always
environment:
DEVELOPMENT: True
@ -171,7 +171,7 @@ services:
postgres:
image: postgres:${POSTGRES_VERSION:-14.2}-alpine
container_name: sql
container_name: test-sql
restart: always
environment:
POSTGRES_PASSWORD: 'example'

View File

@ -1106,8 +1106,13 @@ components:
order_id:
type: integer
readOnly: true
status:
type: integer
readOnly: true
description: The `status` of the order when the notification was trigered
required:
- order_id
- status
ListOrder:
type: object
properties: