Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

Code-Nam
Copy link
Collaborator

**Implement getCanvasImage - json response

**Implement getCanvasImage - json response
@Code-Nam Code-Nam requested a review from TuberculeP February 19, 2024 10:48
backend/controllers/Canvas.ts Outdated Show resolved Hide resolved
* * Log the canvas initialization
*/
}
// TODO: Log the canvas initialization
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mettre

backend/controllers/Canvas.ts Outdated Show resolved Hide resolved
@Code-Nam Code-Nam requested a review from TuberculeP February 24, 2024 21:01
@Code-Nam Code-Nam added pending-review Lorsque vous envoyez votre PR, ajoutez ce label pour vérification. and removed in-correction labels Feb 24, 2024
@Kan-A-Pesh Kan-A-Pesh requested review from Kan-A-Pesh and removed request for TuberculeP February 26, 2024 11:00
@@ -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;
Copy link
Member

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));
Copy link
Member

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");
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

// TODO: Send the canvas image as a response
res.send(this.canvas);
Copy link
Member

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

@Kan-A-Pesh Kan-A-Pesh added in-correction and removed pending-review Lorsque vous envoyez votre PR, ajoutez ce label pour vérification. labels Feb 26, 2024
@Code-Nam Code-Nam closed this Feb 27, 2024
@Code-Nam Code-Nam deleted the features/get-canva branch February 27, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants