Skip to content

Commit a6c7d5a

Browse files
committed
Fix endpoint fields
1 parent da7fa87 commit a6c7d5a

File tree

5 files changed

+38
-11
lines changed

5 files changed

+38
-11
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 5.0.6 on 2024-06-29 14:07
2+
3+
import api.models.order
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('api', '0047_notification'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='order',
16+
name='reference',
17+
field=models.UUIDField(default=api.models.order.custom_uuid, editable=False),
18+
),
19+
]

api/serializers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,17 @@ class Meta:
491491

492492

493493
class ListNotificationSerializer(serializers.ModelSerializer):
494+
status = serializers.SerializerMethodField(
495+
help_text="The `status` of the order when the notification was trigered",
496+
)
494497
class Meta:
495498
model = Notification
496499
fields = ("title", "description", "order_id", "status")
497500

501+
def get_status(self, notification) -> int:
502+
return notification.order.status
503+
504+
498505

499506
class OrderPublicSerializer(serializers.ModelSerializer):
500507
maker_nick = serializers.CharField(required=False)

api/views.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,7 @@ def get(self, request, format=None):
761761
notification_data = []
762762
for notification in queryset:
763763
data = self.serializer_class(notification).data
764-
data["title"] = str(notification.title)
765-
data["description"] = str(notification.description)
766764
data["order_id"] = notification.order.id
767-
data["status"] = notification.order.status
768-
769765
notification_data.append(data)
770766

771767
return Response(notification_data, status=status.HTTP_200_OK)

docker-tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ version: '3.9'
1515
services:
1616
bitcoind:
1717
image: ruimarinho/bitcoin-core:${BITCOIND_VERSION:-24.0.1}-alpine
18-
container_name: btc
18+
container_name: test-btc
1919
restart: always
2020
ports:
2121
- "8000:8000"
@@ -50,7 +50,7 @@ services:
5050

5151
coordinator-LND:
5252
image: lightninglabs/lnd:${LND_VERSION:-v0.17.0-beta}
53-
container_name: coordinator-LND
53+
container_name: test-coordinator-LND
5454
restart: always
5555
volumes:
5656
- bitcoin:/root/.bitcoin/
@@ -83,7 +83,7 @@ services:
8383
coordinator-CLN:
8484
image: elementsproject/lightningd:${CLN_VERSION:-v24.05}
8585
restart: always
86-
container_name: coordinator-CLN
86+
container_name: test-coordinator-CLN
8787
environment:
8888
LIGHTNINGD_NETWORK: 'regtest'
8989
volumes:
@@ -97,7 +97,7 @@ services:
9797

9898
robot-LND:
9999
image: lightninglabs/lnd:${LND_VERSION:-v0.17.0-beta}
100-
container_name: robot-LND
100+
container_name: test-robot-LND
101101
restart: always
102102
volumes:
103103
- bitcoin:/root/.bitcoin/
@@ -129,7 +129,7 @@ services:
129129

130130
redis:
131131
image: redis:${REDIS_VERSION:-7.2.1}-alpine
132-
container_name: redis
132+
container_name: test-redis
133133
restart: always
134134
volumes:
135135
- redisdata:/data
@@ -141,7 +141,7 @@ services:
141141
args:
142142
DEVELOPMENT: True
143143
image: backend-image
144-
container_name: coordinator
144+
container_name: test-coordinator
145145
restart: always
146146
environment:
147147
DEVELOPMENT: True
@@ -171,7 +171,7 @@ services:
171171

172172
postgres:
173173
image: postgres:${POSTGRES_VERSION:-14.2}-alpine
174-
container_name: sql
174+
container_name: test-sql
175175
restart: always
176176
environment:
177177
POSTGRES_PASSWORD: 'example'

docs/assets/schemas/api-latest.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,13 @@ components:
11061106
order_id:
11071107
type: integer
11081108
readOnly: true
1109+
status:
1110+
type: integer
1111+
readOnly: true
1112+
description: The `status` of the order when the notification was trigered
11091113
required:
11101114
- order_id
1115+
- status
11111116
ListOrder:
11121117
type: object
11131118
properties:

0 commit comments

Comments
 (0)