hidden, color property
This commit is contained in:
		@@ -32,7 +32,7 @@ async function getShoppinglistsShared(username) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//INSERT new Shoppinglist
 | 
					//INSERT new Shoppinglist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function newShoppinglist(name, description, username) {
 | 
					async function newShoppinglist(name, description, username, color) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //generate sl_id
 | 
					    //generate sl_id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -50,7 +50,7 @@ async function newShoppinglist(name, description, username) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    //insert shoppinglist
 | 
					    //insert shoppinglist
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        await nonQuery('INSERT INTO "Shoppinglist" (sl_id, name, description) VALUES ($1, $2, $3);', [sl_id, name, description]);
 | 
					        await nonQuery('INSERT INTO "Shoppinglist" (sl_id, name, description, color) VALUES ($1, $2, $3, $4);', [sl_id, name, description, color]);
 | 
				
			||||||
    } 
 | 
					    } 
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    catch (error) {
 | 
					    catch (error) {
 | 
				
			||||||
@@ -109,10 +109,10 @@ async function deleteShoppinglist(sl_id) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//add group into shoppinglist
 | 
					//add group into shoppinglist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function addGroup(sl_id, name, color) {
 | 
					async function addGroup(sl_id, name, color, hidden) {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        let grid = generate_group_id();
 | 
					        let grid = generate_group_id();
 | 
				
			||||||
        await nonQuery('INSERT INTO "Group" VALUES ($1, $2, $3, $4);', [grid, sl_id, name, color]);
 | 
					        await nonQuery('INSERT INTO "Group" (group_id, sl_id, name, color, hidden) VALUES ($1, $2, $3, $4, $5);', [grid, sl_id, name, color, hidden]);
 | 
				
			||||||
    } 
 | 
					    } 
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    catch (error) {
 | 
					    catch (error) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,7 +97,7 @@ router.get("/sharedshoppinglists", async function(req, res, next) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
router.post("/shoppinglist", async function(req, res, next) {
 | 
					router.post("/shoppinglist", async function(req, res, next) {
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    res.status(200).send(await postgres.newShoppinglist(req.body.name, req.body.description, req.session.passport.user.profile.id));
 | 
					    res.status(200).send(await postgres.newShoppinglist(req.body.name, req.body.description, req.session.passport.user.profile.id, req.body.color));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  catch(err) {
 | 
					  catch(err) {
 | 
				
			||||||
@@ -133,7 +133,7 @@ router.delete("/shoppinglist", async (req, res) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
router.post("/group", async (req, res) => {
 | 
					router.post("/group", async (req, res) => {
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    res.status(200).send(await postgres.addGroup(req.body.sl_id, req.body.name, req.body.color));
 | 
					    res.status(200).send(await postgres.addGroup(req.body.sl_id, req.body.name, req.body.color, req.body.hidden));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  catch(err) {
 | 
					  catch(err) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user