class InsertMainProducts(ModelViewSet): def __init__(self): super().__init__() self._insertImage = InsertImages() self._database = "PhotoExplorer" self._collection = "latestProduct" def create(self, request): datas = request.data['mainProducts'] self._insertImage.insert(self._database, self._collection, datas) return Response({"status": 201}, status=status.HTTP_201_CREATED)
class InsertProdutcSpecialsViewset(ModelViewSet): serializer_class = ProductSpecialSerializer def __init__(self): super().__init__() self._insertImage = InsertImages() self._database = "PhotoExplorer" self._collection = "productSpecial" def create(self, request): datas = request.data self._insertImage.insert(self._database, self._collection, datas) return Response({"status": 201}, status=status.HTTP_201_CREATED)
class InsertCategorieNameViewSet(ModelViewSet): serializer_class = CategorieNameSerializer def __init__(self): super().__init__() self._insertImages = InsertImages() self._database = "PhotoExplorer" self._collection = "categorieName" def create(self, request): self._insertImages.insert(self._database, self._collection, request.data) return Response({"status": 201}, status=status.HTTP_200_OK)
class CreateImages(ModelViewSet): serializer_class = SlidesSerializer def __init__(self): super().__init__() self._insert = InsertImages() self._database = "PhotoExplorer" self._collection = "Slide" def create(self, request): slides = request.data['slides'] self._insert.insert(self._database, self._collection, datas=slides) return Response({"response": "created"}, status=status.HTTP_201_CREATED)
def __init__(self): super().__init__() self._insertImage = InsertImages() self._database = "PhotoExplorer" self._collection = "latestProduct"
def __init__(self): super().__init__() self._insertImages = InsertImages() self._database = "PhotoExplorer" self._collection = "categorieName"
def __init__(self): super().__init__() self._insert = InsertImages() self._database = "PhotoExplorer" self._collection = "Slide"