brewlog/src/presentation/web/views/cups.rs
Jon Seager 6d12b71482
refactor(cups): remove rating field
Drop the rating column from cups. This removes the field from the
domain model, repository, API routes (including the PUT/update
endpoint), CLI, and all related tests.
2026-02-05 17:02:42 +00:00

28 lines
768 B
Rust

use crate::domain::cups::CupWithDetails;
#[derive(Clone)]
pub struct CupView {
pub id: String,
pub roast_name: String,
pub roaster_name: String,
pub roast_slug: String,
pub roaster_slug: String,
pub cafe_name: String,
pub cafe_slug: String,
pub created_at: String,
}
impl CupView {
pub fn from_domain(cup: CupWithDetails) -> Self {
Self {
id: cup.cup.id.to_string(),
roast_name: cup.roast_name,
roaster_name: cup.roaster_name,
roast_slug: cup.roast_slug,
roaster_slug: cup.roaster_slug,
cafe_name: cup.cafe_name,
cafe_slug: cup.cafe_slug,
created_at: cup.cup.created_at.format("%Y-%m-%d %H:%M").to_string(),
}
}
}