pohutukawa-2022 / gardenz

Empowering community gardens in New Zealand
0 stars 0 forks source link

Create a shop database #37

Open clementine-smart opened 2 years ago

clementine-smart commented 2 years ago

We are creating a shop to sell different products from each of the gardens and need to create a database table of all the products available and a table which joins together the products and gardens

Create and seed a database for the shop_products Database fields: { id: 1, name: 'large veggie box', description: 'a large box filled with fresh seasonal produce grown at your local garden', price: 29, image: 'www.linktowhereeverthisimageis.com', } Create and seed a database for garden_shop which joins the shop database and garden database together Database fields: { id: 1, garden_id: 3, //foreign key shop_products_id: 2, //foreign key stock: 15, } Create a db function and route '/api/v1/shop/:id' which sends back the products for a certain garden Data contract (Shape of json to send): [{ id: 1, productId: 2 name: 'large veggie box', description: 'a large box filled with fresh seasonal produce grown at your local garden', price: 29, image: 'www.linktowhereeverthisimageis.com', stock: 15, }] Consider: What tables you might need to join in order to get this information?

Luke-vanKan commented 2 years ago

https://github.com/pohutukawa-2022/gardenz/pull/55