Rename broadName
This commit is contained in:
parent
11dcfd6c2f
commit
f317308d61
|
@ -96,7 +96,7 @@ app.post('/api/login', async (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/createBoard', async (req, res) => {
|
app.post('/api/createBoard', async (req, res) => {
|
||||||
const { boardId, boardName } = req.body;
|
const { boardId, boardTitle } = req.body;
|
||||||
let login, token;
|
let login, token;
|
||||||
try {
|
try {
|
||||||
let currentSession = req.session;
|
let currentSession = req.session;
|
||||||
|
@ -112,7 +112,7 @@ app.post('/api/createBoard', async (req, res) => {
|
||||||
|
|
||||||
let queryRes = await db.query('SELECT * FROM boards WHERE board_id = $1::text', [boardId]);
|
let queryRes = await db.query('SELECT * FROM boards WHERE board_id = $1::text', [boardId]);
|
||||||
if (boardId.length == 0 || boardId.length > 5) return res.status(401).send("Неверный размер URI борды");
|
if (boardId.length == 0 || boardId.length > 5) return res.status(401).send("Неверный размер URI борды");
|
||||||
if (boardName.length == 0 || boardName.length > 32) return res.status(401).send("Неверный размер имени борды");
|
if (boardTitle.length == 0 || boardTitle.length > 32) return res.status(401).send("Неверный размер имени борды");
|
||||||
if (queryRes.rowCount > 0) return res.status(401).send("Такая борда уже существует.");
|
if (queryRes.rowCount > 0) return res.status(401).send("Такая борда уже существует.");
|
||||||
|
|
||||||
await db.query('INSERT INTO boards (board_id, board_name) VALUES ($1, $2)', [boardId, boardName]);
|
await db.query('INSERT INTO boards (board_id, board_name) VALUES ($1, $2)', [boardId, boardName]);
|
||||||
|
|
Loading…
Reference in New Issue