Rename /api/tokens -> /api/token
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Pierre HUBERT 2024-04-20 11:38:45 +02:00
parent ff35da5639
commit f1b700f832
3 changed files with 21 additions and 27 deletions

View File

@ -279,23 +279,23 @@ async fn main() -> std::io::Result<()> {
)
// API tokens controller
.route(
"/api/tokens/create",
"/api/token/create",
web::post().to(api_tokens_controller::create),
)
.route(
"/api/tokens/list",
"/api/token/list",
web::get().to(api_tokens_controller::list),
)
.route(
"/api/tokens/{uid}",
"/api/token/{uid}",
web::get().to(api_tokens_controller::get_single),
)
.route(
"/api/tokens/{uid}",
"/api/token/{uid}",
web::patch().to(api_tokens_controller::update),
)
.route(
"/api/tokens/{uid}",
"/api/token/{uid}",
web::delete().to(api_tokens_controller::delete),
)
// Static assets

View File

@ -41,7 +41,7 @@ export class TokensApi {
return (
await APIClient.exec({
method: "POST",
uri: "/tokens/create",
uri: "/token/create",
jsonData: n,
})
).data;
@ -54,7 +54,7 @@ export class TokensApi {
return (
await APIClient.exec({
method: "GET",
uri: "/tokens/list",
uri: "/token/list",
})
).data;
}
@ -66,7 +66,7 @@ export class TokensApi {
return (
await APIClient.exec({
method: "GET",
uri: `/tokens/${uuid}`,
uri: `/token/${uuid}`,
})
).data;
}
@ -78,7 +78,7 @@ export class TokensApi {
return (
await APIClient.exec({
method: "PATCH",
uri: `/tokens/${n.id}`,
uri: `/token/${n.id}`,
jsonData: n,
})
).data;
@ -90,7 +90,7 @@ export class TokensApi {
static async Delete(n: APIToken): Promise<void> {
await APIClient.exec({
method: "DELETE",
uri: `/tokens/${n.id}`,
uri: `/token/${n.id}`,
});
}
}

View File

@ -475,12 +475,12 @@ export function TokenRightsEditor(p: {
<RightsSection label="API tokens">
<RouteRight
{...p}
right={{ verb: "POST", path: "/api/tokens/create" }}
right={{ verb: "POST", path: "/api/token/create" }}
label="Create a new API token"
/>
<RouteRight
{...p}
right={{ verb: "GET", path: "/api/tokens/list" }}
right={{ verb: "GET", path: "/api/token/list" }}
label="Get list of API tokens"
/>
</RightsSection>
@ -502,17 +502,11 @@ export function TokenRightsEditor(p: {
<TableCell>
<i>All</i>
</TableCell>
<CellRight {...p} right={{ verb: "GET", path: "/api/token/*" }} />
<CellRight {...p} right={{ verb: "PUT", path: "/api/token/*" }} />
<CellRight
{...p}
right={{ verb: "GET", path: "/api/tokens/*" }}
/>
<CellRight
{...p}
right={{ verb: "PUT", path: "/api/tokens/*" }}
/>
<CellRight
{...p}
right={{ verb: "DELETE", path: "/api/tokens/*" }}
right={{ verb: "DELETE", path: "/api/token/*" }}
/>
</TableRow>
@ -522,18 +516,18 @@ export function TokenRightsEditor(p: {
<TableCell>{v.name}</TableCell>
<CellRight
{...p}
right={{ verb: "GET", path: `/api/tokens/${v.id}` }}
parent={{ verb: "GET", path: "/api/tokens/*" }}
right={{ verb: "GET", path: `/api/token/${v.id}` }}
parent={{ verb: "GET", path: "/api/token/*" }}
/>
<CellRight
{...p}
right={{ verb: "PUT", path: `/api/tokens/${v.id}` }}
parent={{ verb: "PUT", path: "/api/tokens/*" }}
right={{ verb: "PUT", path: `/api/token/${v.id}` }}
parent={{ verb: "PUT", path: "/api/token/*" }}
/>
<CellRight
{...p}
right={{ verb: "DELETE", path: `/api/tokens/${v.id}` }}
parent={{ verb: "DELETE", path: "/api/tokens/*" }}
right={{ verb: "DELETE", path: `/api/token/${v.id}` }}
parent={{ verb: "DELETE", path: "/api/token/*" }}
/>
</TableRow>
))}