Skip to content

Instantly share code, notes, and snippets.

@sbeckeriv
Created January 17, 2017 01:13
Show Gist options
  • Save sbeckeriv/2d2328a51e5346b7cff3462d41e9f116 to your computer and use it in GitHub Desktop.
Save sbeckeriv/2d2328a51e5346b7cff3462d41e9f116 to your computer and use it in GitHub Desktop.
#[derive(Serialize,Associations, Identifiable, Deserialize, Queryable, Debug, Clone)]
#[table_name = "places"]
#[has_many(inspections)]
pub struct Place {
pub id: i32,
pub name: String,
pub program_identifier: String,
pub description: Option<String>,
pub phone: Option<String>,
pub address: String,
pub longitude: f64,
pub latitude: f64,
pub most_recent_score: Option<i32>,
}
#[derive(Serialize, Identifiable, Associations, Deserialize, Queryable, Debug, Clone)]
#[belongs_to(Place)]
#[table_name = "inspections"]
pub struct Inspection {
pub id: i32,
pub place_id: i32,
pub title: String,
pub published: bool,
pub closed: bool,
pub inspected_at: NaiveDateTime,
pub inspection_type: String,
pub inspection_score: i32,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment