make get and post endpoints work, update enums to be strings, add log file output

This commit is contained in:
katefort 2025-04-23 15:34:19 -05:00
parent 79977f1a18
commit e762fc2abd
12 changed files with 94 additions and 72 deletions

View file

@ -4,59 +4,60 @@ import (
"time"
)
type ClaimType int
type ClaimType string
const (
ContainsMeat ClaimType = iota
ContainsFish
ContainsEggs
ContainsMilk
ContainsHoney
ContainsWax
ContainsFur
ContainsLeather
ContainsAnimalFibers
ContainsWool
ContainsFeathers
AnimalTesting
MonkeySlavery
ContainsMeat ClaimType = "meat"
ContainsFish ClaimType = "fish"
ContainsEgg ClaimType = "egg"
ContainsMilk ClaimType = "milk"
ContainsHoney ClaimType = "honey"
ContainsWax ClaimType = "wax"
ContainsFur ClaimType = "fur"
ContainsLeather ClaimType = "leather"
ContainsAnimalFibers ClaimType = "animal_fibers"
ContainsWool ClaimType = "wool"
ContainsFeathers ClaimType = "feathers"
AnimalTesting ClaimType = "animal_testing"
MonkeySlavery ClaimType = "monkey_slavery"
)
type WorkerType int
type WorkerType string
const (
Barnivore WorkerType = iota
Barnivore WorkerType = "barnivore"
)
type EvidenceType int
// Using a string here to make database modification easier.
type EvidenceType string
const (
ManufacturerWebsite EvidenceType = iota
IngredientsList
ManufacturerWebsite EvidenceType = "manufacturer"
IngredientsList EvidenceType = "ingredients"
)
type IngredientsListEvidence struct {
Ingredients string
}
type ClusterType int
type ClusterType string
const (
User ClusterType = iota
Automated
User ClusterType = "user"
Automated ClusterType = "auto"
)
// Generic claim type for combining both automated and user claims.
type Claim struct {
Id int
Worker_type WorkerType
Evidence_type EvidenceType
Evidence struct{}
Category ClaimType
Polarity bool
Created_at time.Time
Created_by string
Cluster ClusterType
Id int `ksql:"id"`
Worker_type *WorkerType `ksql:"worker_type"`
Evidence_type EvidenceType `ksql:"evidence_type"`
Evidence struct{} `ksql:"evidence"`
Category ClaimType `ksql:"category"`
Polarity bool `ksql:"polarity"`
Created_at time.Time `ksql:"created_at"`
Created_by string `ksql:"created_by"`
Cluster ClusterType `ksql:"cluster"`
}
type ProductClaims struct {