Find a file
2025-04-21 18:28:55 -05:00
cmd/server messy 2025-04-21 16:56:58 -05:00
internal redesign structure, add get endpoint 2025-04-21 18:28:55 -05:00
.gitignore verify successful database interactions with test endpoint 2025-04-17 17:29:47 -05:00
flake.lock set up project 2025-03-29 19:06:07 -05:00
flake.nix set up project 2025-03-29 19:06:07 -05:00
go.mod redesign structure, add get endpoint 2025-04-21 18:28:55 -05:00
go.sum redesign structure, add get endpoint 2025-04-21 18:28:55 -05:00
query_draft.sql redesign structure, add get endpoint 2025-04-21 18:28:55 -05:00
README.md redesign structure, add get endpoint 2025-04-21 18:28:55 -05:00
shell.nix set up project 2025-03-29 19:06:07 -05:00

Vegan Barcode

The goal of this project is to be a crowd sourced resource to find out if a product is vegan

Project organization

  • handlers: gets query parameters to call service and responds with service output
  • services: takes parameters and performs business logic, calls functions to query database
  • user_claims.go in database package: queries database

Task list

  • figure out how we want to handle database migrations
  • database object models should be separated out from database migration function
  • create main process that runs database migration and then starts api
  • create search api
  • create upload api
  • create workers
    • barnivore lookup
    • alergen ingredient database lookup?
  • create mobile and desktop front ends
  • moderation tooling?

How to start database

  • Run brew services start postgresql
  • Create database
    • Setting environment variables:
      • PGHOST=localhost
      • DB_NAME=veganDB (Can be arbitrary)
    • Run createdb veganDB (To delete in future just run dropdb )

Troubleshooting

Error: 2025/04/17 16:21:21 ERROR: relation "idx_user_claims_product_id" already exists (SQLSTATE 42P07) Explanation: The database tables already exist and the program was trying to create them again.

Fix: Either don't create the databases again in the code, or run dropdb veganDB to allow it to recreate it.

Error: psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: database "<user>" does not exist Explanation: Postgres automatically tryes to connect to a database with the same name as the user. Specify user and database: psql -U username databaseName