from sanic import response
from .base import View
[docs]class TileView(View):
[docs] async def put(self, request, wall_identifier, tile_identifier):
data = request.json
data['identifier'] = tile_identifier
tile = await self.tile_service.update_tile(wall_identifier, tile_identifier, data)
return response.json(tile)
[docs] async def delete(self, request, wall_identifier, tile_identifier):
await self.tile_service.remove_tile(wall_identifier, tile_identifier)
return response.HTTPResponse(status=204)
[docs]class TilesView(View):
[docs] async def post(self, request, wall_identifier):
data = request.json
tile = await self.tile_service.create_tile(wall_identifier, data)
return response.json(tile, status=201)