Finished up with channel rank/perms frontend.
This commit is contained in:
parent
edb4215929
commit
796bb033a7
22 changed files with 472 additions and 57 deletions
29
src/controllers/api/account/rankEnumController.js
Normal file
29
src/controllers/api/account/rankEnumController.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*Canopy - The next generation of stoner streaming software
|
||||
Copyright (C) 2024 Rainbownapkin and the TTN Community
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
||||
|
||||
//local imports
|
||||
const permissionModel = require('../../../schemas/permissionSchema.js');
|
||||
const {exceptionHandler} = require('../../../utils/loggerUtils.js');
|
||||
|
||||
//api account functions
|
||||
module.exports.get = async function(req, res){
|
||||
try{
|
||||
res.status(200);
|
||||
return res.send(permissionModel.rankEnum);
|
||||
}catch(err){
|
||||
return exceptionHandler(res, err);
|
||||
}
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ module.exports.get = async function(req, res){
|
|||
|
||||
//Send out the userlist we created
|
||||
res.status(200);
|
||||
res.send(userList);
|
||||
res.send(Object.fromEntries(userList));
|
||||
}else{
|
||||
//If we received bad input, we have only one action: bitch, moan, and complain!
|
||||
res.status(400);
|
||||
|
|
@ -97,10 +97,10 @@ module.exports.post = async function(req, res){
|
|||
}
|
||||
|
||||
//Set rank
|
||||
var rankList = await chanDB.setRank(userDB, data.rank);
|
||||
await chanDB.setRank(userDB, data.rank);
|
||||
|
||||
res.status(200);
|
||||
res.send(rankList);
|
||||
res.send(Object.fromEntries(await chanDB.getRankList()));
|
||||
}else{
|
||||
//If we received bad input, we have only one action: bitch, moan, and complain!
|
||||
res.status(400);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue