robosats/chat/serializers.py
Reckless_Satoshi 79dad7afe2
Add Chat endpoint to API v0 (#288)
* Add /api/chat route and GET method

* Add message POST method

* Wrap /api/chat GET in /api/order GET

* Add send channel message on POST request

* Fix OAS schema bug
2022-10-16 21:11:48 +00:00

26 lines
785 B
Python

from rest_framework import serializers
from chat.models import Message
class ChatSerializer(serializers.ModelSerializer):
class Meta:
model = Message
fields = (
"index",
"sender",
"PGP_message",
"created_at",
)
depth = 0
class PostMessageSerializer(serializers.ModelSerializer):
class Meta:
model = Message
fields = ("PGP_message","order","offset")
depth = 0
offset = serializers.IntegerField(allow_null=True,
default=None,
required=False,
min_value=0,
help_text="Offset for message index to get as response")