NickPerlich / Bettermo

1 stars 1 forks source link

Schema/API Design comments Sebastian Thau #4

Open Sebi2k opened 11 months ago

Sebi2k commented 11 months ago
  1. API Responses - For some of your endpoints you guys return a success boolean and for others an id. You may want to return both for all of them just to give more information.
  2. API Error Handling - Only success booleans are returned, consider adding status codes and error messages
  3. API Documentation - The explanations are a bit brief for certain endpoints.
  4. Schema Naming Conventions - Possibly use singular names for your table names, so instead of groups, you might want to use group. This aligns with the convention where table names usually represent a single entity.
  5. Column Constraints - For columns like name, email, and phone, consider adding a max length or other constraints to ensure you are getting data you want.
  6. Additional Columns - you might want to add more columns to capture additional information. For example, you might want to include an amount column in your purchases table or additional details in the users_to_group table.
  7. Table Descriptions - descriptions for tables and columns can be helpful for understanding the purpose of each component
  8. Nullable - Consider making some columns not nullable as a user with no name, phone, or email isn't really a user.
  9. Data Types - Use varchar instead of text if there's a maximum length for the data.
  10. Add Unique Constraints - Consider adding unique constraints to fields like email in the users table to ensure that there are no duplicate email addresses.
  11. Update - add an endpoint to update groups or user information. This will be more RESTful
  12. Delete- add an endpoint to delete groups or users. This will be more RESTful