Coffee journaling on ATProto (alpha) alpha.arabica.social
coffee

feat: add variety field to bean lexicon #15

merged opened by pdewey.com targeting main from push-wnpyruszormm
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:hm5f3dnm6jdhrc55qp2npdja/sh.tangled.repo.pull/3mfwm6zgljo22
+43
Diff #0
+6
internal/atproto/records.go
··· 169 169 if bean.Origin != "" { 170 170 record["origin"] = bean.Origin 171 171 } 172 + if bean.Variety != "" { 173 + record["variety"] = bean.Variety 174 + } 172 175 if bean.RoastLevel != "" { 173 176 record["roastLevel"] = bean.RoastLevel 174 177 } ··· 225 228 if origin, ok := record["origin"].(string); ok { 226 229 bean.Origin = origin 227 230 } 231 + if variety, ok := record["variety"].(string); ok { 232 + bean.Variety = variety 233 + } 228 234 if roastLevel, ok := record["roastLevel"].(string); ok { 229 235 bean.RoastLevel = roastLevel 230 236 }
+2
internal/atproto/store.go
··· 517 517 beanModel := &models.Bean{ 518 518 Name: bean.Name, 519 519 Origin: bean.Origin, 520 + Variety: bean.Variety, 520 521 RoastLevel: bean.RoastLevel, 521 522 Process: bean.Process, 522 523 Description: bean.Description, ··· 664 665 beanModel := &models.Bean{ 665 666 Name: bean.Name, 666 667 Origin: bean.Origin, 668 + Variety: bean.Variety, 667 669 RoastLevel: bean.RoastLevel, 668 670 Process: bean.Process, 669 671 Description: bean.Description,
+2
internal/handlers/entities.go
··· 164 164 req = models.CreateBeanRequest{ 165 165 Name: r.FormValue("name"), 166 166 Origin: r.FormValue("origin"), 167 + Variety: r.FormValue("variety"), 167 168 RoastLevel: r.FormValue("roast_level"), 168 169 Process: r.FormValue("process"), 169 170 Description: r.FormValue("description"), ··· 292 293 req = models.UpdateBeanRequest{ 293 294 Name: r.FormValue("name"), 294 295 Origin: r.FormValue("origin"), 296 + Variety: r.FormValue("variety"), 295 297 RoastLevel: r.FormValue("roast_level"), 296 298 Process: r.FormValue("process"), 297 299 Description: r.FormValue("description"),
+10
internal/models/models.go
··· 14 14 MaxNotesLength = 2000 15 15 MaxOriginLength = 200 16 16 MaxRoastLevelLength = 100 17 + MaxVarietyLength = 200 17 18 MaxProcessLength = 100 18 19 MaxMethodLength = 100 19 20 MaxGrindSizeLength = 100 ··· 44 45 RKey string `json:"rkey"` // Record key (AT Protocol or stringified ID for SQLite) 45 46 Name string `json:"name"` 46 47 Origin string `json:"origin"` 48 + Variety string `json:"variety"` 47 49 RoastLevel string `json:"roast_level"` 48 50 Process string `json:"process"` 49 51 Description string `json:"description"` ··· 136 138 type CreateBeanRequest struct { 137 139 Name string `json:"name"` 138 140 Origin string `json:"origin"` 141 + Variety string `json:"variety"` 139 142 RoastLevel string `json:"roast_level"` 140 143 Process string `json:"process"` 141 144 Description string `json:"description"` ··· 169 172 type UpdateBeanRequest struct { 170 173 Name string `json:"name"` 171 174 Origin string `json:"origin"` 175 + Variety string `json:"variety"` 172 176 RoastLevel string `json:"roast_level"` 173 177 Process string `json:"process"` 174 178 Description string `json:"description"` ··· 247 251 if len(r.Origin) > MaxOriginLength { 248 252 return ErrOriginTooLong 249 253 } 254 + if len(r.Variety) > MaxVarietyLength { 255 + return ErrFieldTooLong 256 + } 250 257 if len(r.RoastLevel) > MaxRoastLevelLength { 251 258 return ErrFieldTooLong 252 259 } ··· 270 277 if len(r.Origin) > MaxOriginLength { 271 278 return ErrOriginTooLong 272 279 } 280 + if len(r.Variety) > MaxVarietyLength { 281 + return ErrFieldTooLong 282 + } 273 283 if len(r.RoastLevel) > MaxRoastLevelLength { 274 284 return ErrFieldTooLong 275 285 }
+9
internal/web/components/dialog_modals.templ
··· 83 83 required 84 84 class="w-full form-input" 85 85 /> 86 + <input 87 + type="text" 88 + name="variety" 89 + value={ getStringValue(bean, "variety") } 90 + placeholder="Variety (e.g. SL28, Typica, Gesha)" 91 + class="w-full form-input" 92 + /> 86 93 <select 87 94 name="roaster_rkey" 88 95 class="w-full form-input" ··· 599 606 return e.Name 600 607 case "origin": 601 608 return e.Origin 609 + case "variety": 610 + return e.Variety 602 611 case "process": 603 612 return e.Process 604 613 case "description":
+8
internal/web/components/entity_tables.templ
··· 27 27 } 28 28 <th class="table-th whitespace-nowrap">๐Ÿท๏ธ Name</th> 29 29 <th class="table-th whitespace-nowrap">๐Ÿ“ Origin</th> 30 + <th class="table-th whitespace-nowrap">๐ŸŒฟ Variety</th> 30 31 <th class="table-th whitespace-nowrap">โ˜• Roaster</th> 31 32 <th class="table-th whitespace-nowrap">๐Ÿ”ฅ Roast Level</th> 32 33 <th class="table-th whitespace-nowrap">๐ŸŒฑ Process</th> ··· 56 57 } 57 58 </td> 58 59 <td class="px-6 py-4 text-sm text-brown-900">{ bean.Origin }</td> 60 + <td class="px-6 py-4 text-sm text-brown-900"> 61 + if bean.Variety != "" { 62 + { bean.Variety } 63 + } else { 64 + <span class="text-brown-400">-</span> 65 + } 66 + </td> 59 67 <td class="px-6 py-4 text-sm text-brown-900"> 60 68 if bean.Roaster != nil && bean.Roaster.Name != "" { 61 69 { bean.Roaster.Name }
+1
internal/web/pages/bean_view.templ
··· 58 58 } 59 59 <div class="grid grid-cols-2 gap-4"> 60 60 @components.DetailField(components.DetailFieldProps{Label: "๐Ÿ“ Origin", Value: props.Bean.Origin}) 61 + @components.DetailField(components.DetailFieldProps{Label: "๐ŸŒฟ Variety", Value: props.Bean.Variety}) 61 62 @components.DetailField(components.DetailFieldProps{Label: "๐Ÿ”ฅ Roast Level", Value: props.Bean.RoastLevel}) 62 63 @components.DetailField(components.DetailFieldProps{Label: "๐ŸŒฑ Process", Value: props.Bean.Process}) 63 64 if props.Bean.Closed {
+5
lexicons/social.arabica.alpha.bean.json
··· 20 20 "maxLength": 200, 21 21 "description": "Geographic origin of the beans (e.g., 'Ethiopia', 'Colombia')" 22 22 }, 23 + "variety": { 24 + "type": "string", 25 + "maxLength": 200, 26 + "description": "Coffee variety (e.g., 'SL28', 'Typica', 'Gesha', 'Caturra')" 27 + }, 23 28 "roastLevel": { 24 29 "type": "string", 25 30 "maxLength": 100,

History

1 round 0 comments
sign up or login to add to the discussion
pdewey.com submitted #0
1 commit
expand
feat: add variety field to bean lexicon
expand 0 comments
pull request successfully merged