diff --git a/rust_team_data/src/v1.rs b/rust_team_data/src/v1.rs index 699f8a944..2ca2c063d 100644 --- a/rust_team_data/src/v1.rs +++ b/rust_team_data/src/v1.rs @@ -23,6 +23,7 @@ pub struct Team { pub alumni: Vec, pub github: Option, pub website_data: Option, + pub roles: Vec, pub discord: Vec, } @@ -60,6 +61,12 @@ pub struct TeamWebsite { pub weight: i64, } +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct MemberRole { + pub id: String, + pub description: String, +} + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct TeamDiscord { pub name: String, diff --git a/src/static_api.rs b/src/static_api.rs index e4a074dda..4a49f0cc6 100644 --- a/src/static_api.rs +++ b/src/static_api.rs @@ -189,6 +189,14 @@ impl<'a> Generator<'a> { zulip_stream: ws.zulip_stream().map(|s| s.into()), weight: ws.weight(), }), + roles: team + .roles() + .iter() + .map(|role| v1::MemberRole { + id: role.id.clone(), + description: role.description.clone(), + }) + .collect(), discord: team .discord_roles() .map(|roles| { diff --git a/tests/static-api/_expected/v1/teams.json b/tests/static-api/_expected/v1/teams.json index a535a6d5a..9fdb6c2c1 100644 --- a/tests/static-api/_expected/v1/teams.json +++ b/tests/static-api/_expected/v1/teams.json @@ -14,6 +14,7 @@ "alumni": [], "github": null, "website_data": null, + "roles": [], "discord": [] }, "foo": { @@ -69,6 +70,7 @@ "zulip_stream": "t-foo", "weight": 1000 }, + "roles": [], "discord": [] }, "leaderless": { @@ -86,6 +88,7 @@ "alumni": [], "github": null, "website_data": null, + "roles": [], "discord": [] }, "leads-permissions": { @@ -115,6 +118,7 @@ "alumni": [], "github": null, "website_data": null, + "roles": [], "discord": [] }, "wg-test": { @@ -126,7 +130,10 @@ "name": "Second user", "github": "user-2", "github_id": 2, - "is_lead": true + "is_lead": true, + "roles": [ + "convener" + ] } ], "alumni": [ @@ -145,6 +152,12 @@ ], "github": null, "website_data": null, + "roles": [ + { + "id": "convener", + "description": "Convener" + } + ], "discord": [] } } \ No newline at end of file diff --git a/tests/static-api/_expected/v1/teams/alumni.json b/tests/static-api/_expected/v1/teams/alumni.json index 06bfebba0..eb9c6e9fa 100644 --- a/tests/static-api/_expected/v1/teams/alumni.json +++ b/tests/static-api/_expected/v1/teams/alumni.json @@ -13,5 +13,6 @@ "alumni": [], "github": null, "website_data": null, + "roles": [], "discord": [] } \ No newline at end of file diff --git a/tests/static-api/_expected/v1/teams/foo.json b/tests/static-api/_expected/v1/teams/foo.json index 36d1919cc..f8ff56030 100644 --- a/tests/static-api/_expected/v1/teams/foo.json +++ b/tests/static-api/_expected/v1/teams/foo.json @@ -51,5 +51,6 @@ "zulip_stream": "t-foo", "weight": 1000 }, + "roles": [], "discord": [] } \ No newline at end of file diff --git a/tests/static-api/_expected/v1/teams/leaderless.json b/tests/static-api/_expected/v1/teams/leaderless.json index 3978ae5b5..f827028ac 100644 --- a/tests/static-api/_expected/v1/teams/leaderless.json +++ b/tests/static-api/_expected/v1/teams/leaderless.json @@ -13,5 +13,6 @@ "alumni": [], "github": null, "website_data": null, + "roles": [], "discord": [] } \ No newline at end of file diff --git a/tests/static-api/_expected/v1/teams/leads-permissions.json b/tests/static-api/_expected/v1/teams/leads-permissions.json index 758b60542..5382ab995 100644 --- a/tests/static-api/_expected/v1/teams/leads-permissions.json +++ b/tests/static-api/_expected/v1/teams/leads-permissions.json @@ -25,5 +25,6 @@ "alumni": [], "github": null, "website_data": null, + "roles": [], "discord": [] } \ No newline at end of file diff --git a/tests/static-api/_expected/v1/teams/wg-test.json b/tests/static-api/_expected/v1/teams/wg-test.json index b89142fda..2e8b1455e 100644 --- a/tests/static-api/_expected/v1/teams/wg-test.json +++ b/tests/static-api/_expected/v1/teams/wg-test.json @@ -7,7 +7,10 @@ "name": "Second user", "github": "user-2", "github_id": 2, - "is_lead": true + "is_lead": true, + "roles": [ + "convener" + ] } ], "alumni": [ @@ -26,5 +29,11 @@ ], "github": null, "website_data": null, + "roles": [ + { + "id": "convener", + "description": "Convener" + } + ], "discord": [] } \ No newline at end of file diff --git a/tests/static-api/teams/wg-test.toml b/tests/static-api/teams/wg-test.toml index 849f4fb63..28fae95c8 100644 --- a/tests/static-api/teams/wg-test.toml +++ b/tests/static-api/teams/wg-test.toml @@ -3,5 +3,11 @@ kind = "working-group" [people] leads = ["user-2"] -members = ["user-2"] +members = [ + { github = "user-2", roles = ["convener"] }, +] alumni = ["user-0", "user-5"] + +[[roles]] +id = "convener" +description = "Convener"