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 // API tokens controller
.route( .route(
"/api/tokens/create", "/api/token/create",
web::post().to(api_tokens_controller::create), web::post().to(api_tokens_controller::create),
) )
.route( .route(
"/api/tokens/list", "/api/token/list",
web::get().to(api_tokens_controller::list), web::get().to(api_tokens_controller::list),
) )
.route( .route(
"/api/tokens/{uid}", "/api/token/{uid}",
web::get().to(api_tokens_controller::get_single), web::get().to(api_tokens_controller::get_single),
) )
.route( .route(
"/api/tokens/{uid}", "/api/token/{uid}",
web::patch().to(api_tokens_controller::update), web::patch().to(api_tokens_controller::update),
) )
.route( .route(
"/api/tokens/{uid}", "/api/token/{uid}",
web::delete().to(api_tokens_controller::delete), web::delete().to(api_tokens_controller::delete),
) )
// Static assets // Static assets

View File

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

View File

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