change full archi api backend
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Response } from "express";
|
||||
import { getAccounts, registerAccount } from "../db/api-db";
|
||||
import { getAccounts, getRooms, registerAccount } from "../db/api-db";
|
||||
import { getAddressId } from "../db/utils/mail";
|
||||
import logger from "../system/Logger";
|
||||
import statusCodes from "../utils/statusCodes";
|
||||
|
||||
export default class Account {
|
||||
@@ -23,4 +24,16 @@ export default class Account {
|
||||
});
|
||||
// todo change mailbox to account
|
||||
}
|
||||
|
||||
static async getRooms(body, res: Response) {
|
||||
const { mailboxId, offset, limit } = body;
|
||||
getRooms(mailboxId)
|
||||
.then((rooms) => {
|
||||
res.status(statusCodes.OK).json(rooms);
|
||||
})
|
||||
.catch((err) => {
|
||||
logger.err(err);
|
||||
res.status(statusCodes.INTERNAL_SERVER_ERROR);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,18 +61,6 @@ export default class Room {
|
||||
}
|
||||
}
|
||||
|
||||
static async getAll(body, res: Response) {
|
||||
const { mailboxId, offset, limit } = body;
|
||||
getRooms(mailboxId)
|
||||
.then((rooms) => {
|
||||
res.status(statusCode.OK).json(rooms);
|
||||
})
|
||||
.catch((err) => {
|
||||
logger.err(err);
|
||||
res.status(statusCode.INTERNAL_SERVER_ERROR);
|
||||
});
|
||||
}
|
||||
|
||||
static async getMessages(body, res: Response) {
|
||||
const { roomId } = body;
|
||||
getMessages(roomId)
|
||||
|
||||
Reference in New Issue
Block a user