users
and shops
via migrations in the database. 2. users
table must contain name
, email
, password
(must be hashed), role
(ENUM type having User
, Admin
values), createdAt
and updatedAt
fields. 3. While shops
table must contain name
, description
, fk_user_id
(foreign key of users
table), address
, createdAt
, and updatedAt
fields. 4. There should be one to many relationship between users
and shops
.i.e. one user can have multiple shops. 5. You have to make three APIs. 6. First, you need to create login endpoint. The route will be POST: api/users/login
, which will return jwt token and the user data the provided credentials are correct. 7. Second, create shop API by creating POST: api/users/:userId/shops
route. Make sure to add middleware to authenticate the user via token. 8. Third, Only Admin can get all use