From 1eb81092d7a3e7925ae8e4258aa35a009f911b6e Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Tue, 22 Nov 2022 20:42:34 +0100 Subject: add is_ranked attribute to matches --- planetwars-server/src/db/maps.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'planetwars-server/src/db/maps.rs') diff --git a/planetwars-server/src/db/maps.rs b/planetwars-server/src/db/maps.rs index 8972461..4f0e026 100644 --- a/planetwars-server/src/db/maps.rs +++ b/planetwars-server/src/db/maps.rs @@ -14,6 +14,7 @@ pub struct Map { pub id: i32, pub name: String, pub file_path: String, + pub is_ranked: bool, } pub fn create_map(new_map: NewMap, conn: &mut PgConnection) -> QueryResult { @@ -33,3 +34,9 @@ pub fn find_map_by_name(name: &str, conn: &mut PgConnection) -> QueryResult pub fn list_maps(conn: &mut PgConnection) -> QueryResult> { maps::table.get_results(conn) } + +pub fn get_ranked_maps(conn: &mut PgConnection) -> QueryResult> { + maps::table + .filter(maps::is_ranked.eq(true)) + .get_results(conn) +} -- cgit v1.2.3