fix merge issues
This commit is contained in:
commit
560a3dbc4b
16
README.md
Normal file
16
README.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Vegan Barcode
|
||||||
|
|
||||||
|
The goal of this project is to be a crowd sourced resource to find out if a product is vegan
|
||||||
|
|
||||||
|
|
||||||
|
## 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?
|
|
@ -1,14 +1,19 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/labstack/gommon/log"
|
||||||
|
)
|
||||||
|
|
||||||
func testService(c *gin.Context) {
|
func testService(c *gin.Context) {
|
||||||
log.Debug("Test was successful.")
|
log.Debug("Test was successful.")
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{"message": "Hello World!"})
|
||||||
"message": "Hello World!"
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func claimsByBarcode(c *gin.Context) {
|
func claimsByBarcode(c *gin.Context) {
|
||||||
system := c.DefaultQuery("system", "upc")
|
system := c.DefaultQuery("system", "upc")
|
||||||
barcode := c.Query("barcode")
|
barcode := c.Query("barcode")
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
39
query_draft.sql
Normal file
39
query_draft.sql
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
SELECT
|
||||||
|
cluster,
|
||||||
|
id,
|
||||||
|
worker,
|
||||||
|
evidence_type,
|
||||||
|
evidence,
|
||||||
|
category,
|
||||||
|
polarity,
|
||||||
|
created_at,
|
||||||
|
created_by
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
cluster,
|
||||||
|
id,
|
||||||
|
worker,
|
||||||
|
evidence_type,
|
||||||
|
evidence,
|
||||||
|
category,
|
||||||
|
polarity,
|
||||||
|
created_at,
|
||||||
|
created_by,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY category ORDER BY created_at DESC) AS rn
|
||||||
|
FROM (
|
||||||
|
(
|
||||||
|
SELECT "user" as cluster, id, product_id, null as worker, evidence_type, evidence, unnest(claim) as category, true as polarity, created_at, created_by FROM user_claims
|
||||||
|
UNION ALL
|
||||||
|
SELECT "automated" as cluster, id, product_id, worker, null as evidence_type, evidence, unnest(claim) as category, true as polarity, created_at, null as created_by FROM automated_claims
|
||||||
|
)
|
||||||
|
UNION ALL
|
||||||
|
(
|
||||||
|
SELECT "user" as cluster, id, product_id, null as worker, evidence_type, evidence, unnest(counter_claim) as category, false as polarity, created_at, created_by FROM user_claims
|
||||||
|
UNION ALL
|
||||||
|
SELECT "automated" as cluster, id, product_id, worker, null as evidence_type, evidence, unnest(counter_claim) as category, false as polarity, created_at, null as created_by FROM automated_claims
|
||||||
|
)
|
||||||
|
)
|
||||||
|
WHERE product_id = ???
|
||||||
|
)
|
||||||
|
WHERE rn = 1
|
||||||
|
ORDER BY created_at;
|
Loading…
Reference in a new issue