Add some configuration options for instance admins

This commit is contained in:
Bat
2018-07-27 19:05:36 +02:00
parent 826772ca20
commit 74ec59e77c
21 changed files with 200 additions and 9 deletions
+21 -2
View File
@@ -13,7 +13,11 @@ pub struct Instance {
pub name: String,
pub local: bool,
pub blocked: bool,
pub creation_date: NaiveDateTime
pub creation_date: NaiveDateTime,
pub open_registrations: bool,
pub short_description: String,
pub long_description: String,
pub default_license : String
}
#[derive(Insertable)]
@@ -21,7 +25,11 @@ pub struct Instance {
pub struct NewInstance {
pub public_domain: String,
pub name: String,
pub local: bool
pub local: bool,
pub open_registrations: bool,
pub short_description: String,
pub long_description: String,
pub default_license : String
}
impl Instance {
@@ -68,4 +76,15 @@ impl Instance {
box_name = box_name
))
}
pub fn update(&self, conn: &PgConnection, name: String, open_registrations: bool, short_description: String, long_description: String) -> Instance {
diesel::update(self)
.set((
instances::name.eq(name),
instances::open_registrations.eq(open_registrations),
instances::short_description.eq(short_description),
instances::long_description.eq(long_description),
)).get_result::<Instance>(conn)
.expect("Couldn't update instance")
}
}