mail/back/routers/mail.js
2023-03-13 00:13:17 +01:00

31 lines
1.0 KiB
JavaScript

const statusCodes = require("../utils/statusCodes.js").statusCodes;
const express = require('express');
const router = require('router');
/**
* Return all mailboxes and folders for an user
*/
router.get("/mailboxes", (req, res) => {
const {token} = req.params;
const query = ``;
});
/**
* @param {number} mailboxId the id of the mailbox from which to fetch the messages, 0 if from all
* @param {number} offset the offset of the query
* @param {number} limit the number of message to return
* @param {string} token the token of the user
* @return {object} a list of room and their preview
*/
router.get("/{mailboxId}/messages", (req, res) => {
const {token, mailboxId, offset, limit} = req.params;
// todo check token
// todo use offset
const query = ``;
// SELECT header_fields.value FROM header_fields INNER JOIN field_names WHERE header_fields.field = field_names.id AND (field_names.name = "subject" OR field_names.name = "date"); ORDER BY messages.idate
// number of message missed in the room
});
module.exports = router;