This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE Users ( | |
id SERIAL PRIMARY KEY, | |
email VARCHAR(255) UNIQUE NOT NULL, | |
name VARCHAR(255) | |
); | |
CREATE TABLE Booklets ( | |
id SERIAL PRIMARY KEY, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.put('/booklets/:bookletId', async (req, res) => { | |
const bookletId = req.params.bookletId; | |
const userId = req.user.sub; // Assuming you've set req.user.sub to the user's ID from the JWT. | |
// Fetch the user's role for the booklet. | |
// role could be an enum | |
const result = await db.query('SELECT role FROM UserBooklets WHERE user_id = $1 AND booklet_id = $2', [userId, bookletId]); | |
// If there's no role, the user doesn't have any relationship with the booklet. | |
if (result.rows.length === 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MotorsWheels: | |
def __init__( | |
self, r_wheel_forward=6, r_wheel_backward=13, l_wheel_forward=19, l_wheel_backward=26): | |
self.r_wheel_forward = r_wheel_forward | |
... | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(r_wheel_forward, GPIO.OUT) | |
GPIO.setup(r_wheel_backward, GPIO.OUT) | |
... |