Organisation descriptions
Diff
chartered-db/src/organisations.rs | 6 ++++++
chartered-db/src/schema.rs | 1 +
migrations/2021-08-31-214501_create_crates_table/up.sql | 5 +++--
chartered-frontend/src/pages/crate/OrganisationView.tsx | 5 ++---
chartered-web/src/endpoints/web_api/organisations/info.rs | 2 ++
5 files changed, 14 insertions(+), 5 deletions(-)
@@ -15,6 +15,7 @@
pub id: i32,
pub uuid: SqlUuid,
pub name: String,
pub description: String,
}
impl Organisation {
@@ -68,6 +69,11 @@
#[must_use]
pub fn permissions(&self) -> UserPermission {
self.permissions
}
#[must_use]
pub fn organisation(&self) -> &Organisation {
&self.organisation
}
pub async fn crates(self: Arc<Self>, conn: ConnectionPool) -> Result<Vec<Crate>> {
@@ -33,6 +33,7 @@
id -> Integer,
uuid -> Binary,
name -> Text,
description -> Text,
}
}
@@ -9,10 +9,11 @@
CREATE TABLE organisations (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
uuid BINARY(128) NOT NULL UNIQUE,
name VARCHAR(255) NOT NULL UNIQUE
name VARCHAR(255) NOT NULL UNIQUE,
description TEXT NOT NULL DEFAULT ""
);
INSERT INTO organisations (id, uuid, name) VALUES (1, X'936DA01F9ABD4D9D80C702AF85C822A8', "core");
INSERT INTO organisations (id, uuid, name, description) VALUES (1, X'936DA01F9ABD4D9D80C702AF85C822A8', "core", "My first organisation");
CREATE TABLE crates (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
@@ -24,6 +24,7 @@
possible_permissions?: string[];
crates: Crate[];
members: Member[];
description: string;
}
interface Crate {
@@ -63,8 +64,6 @@
return <Loading />;
}
const description = "a collection of things and stuff.";
return (
<div className="text-white">
<Nav />
@@ -82,7 +81,7 @@
<div className="px-2">
<h1 className="text-primary my-0">{organisation}</h1>
<p className="m-0">{description}</p>
<p className="m-0">{organisationDetails.description}</p>
</div>
</div>
</div>
@@ -40,6 +40,7 @@
)?;
Ok(Json(Response {
description: organisation.organisation().description.to_string(),
possible_permissions: can_manage_users.then(UserPermission::all),
crates: crates
.into_iter()
@@ -61,6 +62,7 @@
#[derive(Serialize)]
pub struct Response {
description: String,
possible_permissions: Option<UserPermission>,
crates: Vec<ResponseCrate>,
members: Vec<ResponseUser>,