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