mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-10-31 23:54:30 +01:00
97 lines
2.7 KiB
Python
97 lines
2.7 KiB
Python
# Copyright (C) 2018-2025 by BDE ENS Paris-Saclay
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
from rest_framework import serializers
|
|
|
|
from ..models import Allergen, Food, BasicFood, TransformedFood, QRCode, Dish, Supplement, Order, FoodTransaction
|
|
|
|
|
|
class AllergenSerializer(serializers.ModelSerializer):
|
|
"""
|
|
REST API Serializer for Allergen.
|
|
The djangorestframework plugin will analyse the model `Allergen` and parse all fields in the API.
|
|
"""
|
|
class Meta:
|
|
model = Allergen
|
|
fields = '__all__'
|
|
|
|
|
|
class FoodSerializer(serializers.ModelSerializer):
|
|
"""
|
|
REST API Serializer for Food.
|
|
The djangorestframework plugin will analyse the model `Food` and parse all fields in the API.
|
|
"""
|
|
class Meta:
|
|
model = Food
|
|
fields = '__all__'
|
|
|
|
|
|
class BasicFoodSerializer(serializers.ModelSerializer):
|
|
"""
|
|
REST API Serializer for BasicFood.
|
|
The djangorestframework plugin will analyse the model `BasicFood` and parse all fields in the API.
|
|
"""
|
|
class Meta:
|
|
model = BasicFood
|
|
fields = '__all__'
|
|
|
|
|
|
class TransformedFoodSerializer(serializers.ModelSerializer):
|
|
"""
|
|
REST API Serializer for TransformedFood.
|
|
The djangorestframework plugin will analyse the model `TransformedFood` and parse all fields in the API.
|
|
"""
|
|
class Meta:
|
|
model = TransformedFood
|
|
fields = '__all__'
|
|
|
|
|
|
class QRCodeSerializer(serializers.ModelSerializer):
|
|
"""
|
|
REST API Serializer for QRCode.
|
|
The djangorestframework plugin will analyse the model `QRCode` and parse all fields in the API.
|
|
"""
|
|
class Meta:
|
|
model = QRCode
|
|
fields = '__all__'
|
|
|
|
|
|
class DishSerializer(serializers.ModelSerializer):
|
|
"""
|
|
REST API Serializer for Dish.
|
|
The djangorestframework plugin will analyse the model `Dish` and parse all fields in the API.
|
|
"""
|
|
class Meta:
|
|
model = Dish
|
|
fields = '__all__'
|
|
|
|
|
|
class SupplementSerializer(serializers.ModelSerializer):
|
|
"""
|
|
REST API Serializer for Supplement.
|
|
The djangorestframework plugin will analyse the model `Supplement` and parse all fields in the API.
|
|
"""
|
|
class Meta:
|
|
model = Supplement
|
|
fields = '__all__'
|
|
|
|
|
|
class OrderSerializer(serializers.ModelSerializer):
|
|
"""
|
|
REST API Serializer for Order.
|
|
The djangorestframework plugin will analyse the model `Order` and parse all fields in the API.
|
|
"""
|
|
class Meta:
|
|
model = Order
|
|
fields = '__all__'
|
|
|
|
|
|
class FoodTransactionSerializer(serializers.ModelSerializer):
|
|
"""
|
|
REST API Serializer for FoodTransaction.
|
|
The djangorestframework plugin will analyse the model `FoodTransaction` and parse all fields in the API.
|
|
"""
|
|
class Meta:
|
|
model = FoodTransaction
|
|
fields = '__all__'
|