-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ **Implement CanvasController init() - buffer and changes #17
Conversation
**Implement getCanvasImage - json response
backend/controllers/Canvas.ts
Outdated
* * Log the canvas initialization | ||
*/ | ||
} | ||
// TODO: Log the canvas initialization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mettre
@@ -3,34 +3,45 @@ import type PlacePixelPayload from "common/requests/PlacePixel"; | |||
import type express from "express"; | |||
import type SocketIO from "socket.io"; | |||
|
|||
import getRedisClient from "../database/redis"; | |||
|
|||
class CanvasController { | |||
private static canvas: Canvas; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
underscore
|
||
// TODO: Log the canvas initialization (waiting merge) | ||
console.log("Canvas not found in the database, creating a new one"); | ||
await getRedisClient.set("canvas", JSON.stringify(this.canvas)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buffer dans une entrée
metadonnées dans une autres entrée
* * Log the canvas initialization | ||
*/ | ||
} | ||
const canvasBuffer = await getRedisClient.get("canvas"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??? tu récupères tout le canvas ou juste le buffer ducoup ?
await getRedisClient.set("canvas", JSON.stringify(this.canvas)); | ||
} else { | ||
console.log("Canvas found in the database, loading it"); | ||
this.canvas = JSON.parse(canvasBuffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO: Send the canvas image as a response | ||
res.send(this.canvas); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getCanvasImage doit renvoyer une image, ou du moins un buffer avec les données du buffer, d'autant que si il ne renvoie pas une image directement il doit être capable de réenvoyer des métadonnées comme la taille height et width pour être capable sur le frontend de parser ces données
**Implement getCanvasImage - json response