mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-25 05:12:18 +03:00
3446fc33d3
Squashed commit of the following: commit f60870fcfe574dc4ab1343e25241b6ef7cc2721b Author: Reckless_Satoshi <reckless.satoshi@protonmail.com> Date: Thu Nov 10 10:30:42 2022 -0800 Fix internal error when entering chat commit f1eeb49f2a86575eb2e85cdff20460276e71b806 Author: Reckless_Satoshi <reckless.satoshi@protonmail.com> Date: Tue Nov 8 10:08:22 2022 -0800 Fix final serializer commit d0c08ba6ad4378a9539c0be83b6f4f8b958b532e Author: Reckless_Satoshi <reckless.satoshi@protonmail.com> Date: Tue Nov 8 09:44:57 2022 -0800 Chat API changes commit a66bf64edc06d936612db6bf75476b54e6a84334 Author: Reckless_Satoshi <reckless.satoshi@protonmail.com> Date: Tue Nov 8 09:28:29 2022 -0800 Fix param on post commit60b18d13c2
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com> Date: Tue Nov 8 08:56:25 2022 -0800 Fix serializer commit11212d30ee
Author: KoalaSat <yv1vtrul@duck.com> Date: Sun Nov 6 21:07:18 2022 +0100 CR 2 commitc82790cb81
Author: KoalaSat <yv1vtrul@duck.com> Date: Sun Nov 6 20:09:18 2022 +0100 Fix commit605a3b69a1
Author: KoalaSat <yv1vtrul@duck.com> Date: Sun Nov 6 14:44:42 2022 +0100 CR commit09776e9c8f
Author: KoalaSat <yv1vtrul@duck.com> Date: Wed Nov 2 18:12:29 2022 +0100 translations commit432e4d2399
Author: KoalaSat <yv1vtrul@duck.com> Date: Wed Nov 2 17:39:02 2022 +0100 Switch and better UX commitdf6e476613
Author: KoalaSat <yv1vtrul@duck.com> Date: Tue Nov 1 18:20:01 2022 +0100 Unused code commit5b8d6b4d32
Author: Reckless_Satoshi <reckless.satoshi@protonmail.com> Date: Mon Oct 31 09:20:20 2022 -0700 Add Chat Turtle Mode
38 lines
844 B
Python
38 lines
844 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_id", "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",
|
|
)
|
|
|
|
order_id = serializers.IntegerField(
|
|
allow_null=False,
|
|
required=True,
|
|
min_value=0,
|
|
help_text="Order ID of chatroom",
|
|
)
|