Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"AUTH_SLYTHERINE_TENANT_GREGORY_GOYLE_LOGIN_WITHOUT_PERMISSIONS": "AUTH_SLYTHERINE_TENANT_GREGORY_GOYLE_LOGIN_WITHOUT_PERMISSIONS",
"AUTH_SLYTHERINE_TENANT_GREGORY_GOYLE_PASSWORD_WITHOUT_PERMISSIONS": "AUTH_SLYTHERINE_TENANT_GREGORY_GOYLE_PASSWORD_WITHOUT_PERMISSIONS",
"AUTH_API_ROOT_URL": "http://localhost:8507/api/auth",
"API_ROOT_URL": "http://localhost:4507/api",
"API_ROOT_URL": "http://localhost:4507",
"SHOULD_USE_FAKE_EXTERNAL_DEPENDENCIES": "true",
"ENABLE_EXCEPTION_DETAILS": "true"
},
Expand Down
2 changes: 1 addition & 1 deletion Api/Features/Internal/InternalContoller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Api.Features.Internal;

[Authorize]
[ApiController]
[Route("api/internal")]
[Route("internal")]
public class InternalController : ControllerBase
{
[EndpointSummary("Get employees tracked task hours")]
Expand Down
2 changes: 1 addition & 1 deletion Api/Features/Reporting/ReportingController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Api.Features.Reporting;

[Authorize]
[ApiController]
[Route("api/reporting")]
[Route("reporting")]
public class ReportingController : ControllerBase
{
[EndpointSummary("Get all employees")]
Expand Down
2 changes: 1 addition & 1 deletion Api/Features/Tracking/TrackingController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Api.Features.Tracking;

[Authorize]
[ApiController]
[Route("api/tracking")]
[Route("tracking")]
public class TrackingController : ControllerBase
{
[EndpointSummary("Get entries by period")]
Expand Down
2 changes: 1 addition & 1 deletion Api/Features/Tracking/TrackingControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task CreateTaskEntryAsync_ShouldThrowValidationErrorIfAtLeastOneOfR
Description = "Task description",
};

var response = await HttpClient.PostAsJsonAsync("/api/tracking/task-entries", createTaskEntryRequest);
var response = await HttpClient.PostAsJsonAsync("/tracking/task-entries", createTaskEntryRequest);

Assert.NotNull(response);
Assert.Equal(StatusCodes.Status400BadRequest, (int)response.StatusCode);
Expand Down
4 changes: 2 additions & 2 deletions Api/OpenApiConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public static void AddConfiguredOpenApi(this IServiceCollection services)

public static void AddOpenApiSchemaAndUI(this WebApplication app)
{
app.MapOpenApi("api/swagger/openapi.json");
app.MapOpenApi("swagger/openapi.json");

app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("openapi.json", "API");
options.RoutePrefix = "api/swagger";
options.RoutePrefix = "swagger";
});
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ The most useful is `PgAdmin` http://localhost:9507 (password is `postgres`).

## Swagger

You can fetch OpenApi endpoints and types contract using this URL http://localhost:4507/api/swagger/openapi.json. Swagger UI is accessible at http://localhost:4507/api/swagger/index.html.
You can fetch OpenApi endpoints and types contract using this URL http://localhost:4507/swagger/openapi.json. Swagger UI is accessible at http://localhost:4507/swagger/index.html.

However, UI doesn't support requests execution, this requires adding Auth dialog to pass a token. It is a bit trickier starting from .NET 9 due to the change in support of Swagger packagies family `Swashbuckle`, read [here](https://learn.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-8.0&tabs=visual-studio) and [there](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/overview?view=aspnetcore-9.0&preserve-view=true) about that more.

Expand Down
2 changes: 1 addition & 1 deletion ci/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ingress:
annotations:
cert-manager.io/cluster-issuer: letsencrypt
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/rewrite-target: /api/$2
nginx.ingress.kubernetes.io/rewrite-target: /$2
tls: true
ingressClassName: nginx

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ services:
AUTH_SLYTHERINE_TENANT_GREGORY_GOYLE_PASSWORD_WITHOUT_PERMISSIONS: "AUTH_SLYTHERINE_TENANT_GREGORY_GOYLE_PASSWORD_WITHOUT_PERMISSIONS"
# here the port is 1080 because it needs to be an internal port, not an external which is 8507 in this case
AUTH_API_ROOT_URL: "http://inner-circle-time-api-mock-server:1080/api/auth"
API_ROOT_URL: "http://inner-circle-time-api/api"
API_ROOT_URL: "http://inner-circle-time-api"
SHOULD_USE_FAKE_EXTERNAL_DEPENDENCIES: "true"
networks:
- inner-circle-time-api-network
Expand Down
2 changes: 1 addition & 1 deletion js-client/generation/generate.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
swagger-typescript-api generate \
--path 'http://localhost:6507/api/swagger/openapi.json' \
--path 'http://localhost:6507/swagger/openapi.json' \
--axios \
--name index.ts \
--output /local/out \
56 changes: 29 additions & 27 deletions js-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,14 @@ export class HttpClient<SecurityDataType = unknown> {
export class Api<
SecurityDataType extends unknown,
> extends HttpClient<SecurityDataType> {
api = {
tracking = {
/**
* No description
*
* @tags Tracking
* @name TrackingGetEntriesByPeriod
* @summary Get entries by period
* @request GET:/api/tracking/entries
* @request GET:/tracking/entries
*/
trackingGetEntriesByPeriod: (
query: {
Expand All @@ -367,7 +367,7 @@ export class Api<
params: RequestParams = {},
) =>
this.request<GetEntriesByPeriodResponse, any>({
path: `/api/tracking/entries`,
path: `/tracking/entries`,
method: "GET",
query: query,
format: "json",
Expand All @@ -380,14 +380,14 @@ export class Api<
* @tags Tracking
* @name TrackingCreateTaskEntry
* @summary Create a task entry
* @request POST:/api/tracking/task-entries
* @request POST:/tracking/task-entries
*/
trackingCreateTaskEntry: (
data: CreateTaskEntryRequest,
params: RequestParams = {},
) =>
this.request<CreateTaskEntryResponse, any>({
path: `/api/tracking/task-entries`,
path: `/tracking/task-entries`,
method: "POST",
body: data,
type: ContentType.Json,
Expand All @@ -401,14 +401,14 @@ export class Api<
* @tags Tracking
* @name TrackingCreateUnwellEntry
* @summary Create an unwell entry
* @request POST:/api/tracking/unwell-entries
* @request POST:/tracking/unwell-entries
*/
trackingCreateUnwellEntry: (
data: CreateUnwellEntryRequest,
params: RequestParams = {},
) =>
this.request<CreateUnwellResponse, any>({
path: `/api/tracking/unwell-entries`,
path: `/tracking/unwell-entries`,
method: "POST",
body: data,
type: ContentType.Json,
Expand All @@ -422,15 +422,15 @@ export class Api<
* @tags Tracking
* @name TrackingUpdateTaskEntry
* @summary Update a task entry
* @request POST:/api/tracking/task-entries/{taskEntryId}
* @request POST:/tracking/task-entries/{taskEntryId}
*/
trackingUpdateTaskEntry: (
taskEntryId: number,
data: UpdateTaskEntryRequest,
params: RequestParams = {},
) =>
this.request<void, any>({
path: `/api/tracking/task-entries/${taskEntryId}`,
path: `/tracking/task-entries/${taskEntryId}`,
method: "POST",
body: data,
type: ContentType.Json,
Expand All @@ -443,15 +443,15 @@ export class Api<
* @tags Tracking
* @name TrackingUpdateUnwellEntry
* @summary Update an unwell entry
* @request POST:/api/tracking/unwell-entries/{unwellEntryId}
* @request POST:/tracking/unwell-entries/{unwellEntryId}
*/
trackingUpdateUnwellEntry: (
unwellEntryId: number,
data: UpdateUnwellEntryRequest,
params: RequestParams = {},
) =>
this.request<void, any>({
path: `/api/tracking/unwell-entries/${unwellEntryId}`,
path: `/tracking/unwell-entries/${unwellEntryId}`,
method: "POST",
body: data,
type: ContentType.Json,
Expand All @@ -464,7 +464,7 @@ export class Api<
* @tags Tracking
* @name TrackingGetEmployeeProjectsByPeriod
* @summary Get employee projects by period
* @request GET:/api/tracking/task-entries/projects
* @request GET:/tracking/task-entries/projects
*/
trackingGetEmployeeProjectsByPeriod: (
query: {
Expand All @@ -476,7 +476,7 @@ export class Api<
params: RequestParams = {},
) =>
this.request<ProjectsResponse, any>({
path: `/api/tracking/task-entries/projects`,
path: `/tracking/task-entries/projects`,
method: "GET",
query: query,
format: "json",
Expand All @@ -489,11 +489,11 @@ export class Api<
* @tags Tracking
* @name TrackingHardDeleteEntry
* @summary Deletes specific entry
* @request DELETE:/api/tracking/entries/{entryId}/hard-delete
* @request DELETE:/tracking/entries/{entryId}/hard-delete
*/
trackingHardDeleteEntry: (entryId: number, params: RequestParams = {}) =>
this.request<void, any>({
path: `/api/tracking/entries/${entryId}/hard-delete`,
path: `/tracking/entries/${entryId}/hard-delete`,
method: "DELETE",
...params,
}),
Expand All @@ -504,32 +504,33 @@ export class Api<
* @tags Tracking
* @name TrackingSoftDeleteEntry
* @summary Soft deletes specific entry
* @request DELETE:/api/tracking/entries/{entryId}/soft-delete
* @request DELETE:/tracking/entries/{entryId}/soft-delete
*/
trackingSoftDeleteEntry: (
entryId: number,
data: SoftDeleteEntryRequest,
params: RequestParams = {},
) =>
this.request<void, any>({
path: `/api/tracking/entries/${entryId}/soft-delete`,
path: `/tracking/entries/${entryId}/soft-delete`,
method: "DELETE",
body: data,
type: ContentType.Json,
...params,
}),

};
reporting = {
/**
* No description
*
* @tags Reporting
* @name ReportingGetAllEmployees
* @summary Get all employees
* @request GET:/api/reporting/employees
* @request GET:/reporting/employees
*/
reportingGetAllEmployees: (params: RequestParams = {}) =>
this.request<GetAllEmployeesResponse, any>({
path: `/api/reporting/employees`,
path: `/reporting/employees`,
method: "GET",
format: "json",
...params,
Expand All @@ -541,7 +542,7 @@ export class Api<
* @tags Reporting
* @name ReportingGetPersonalReport
* @summary Get a personal employee report sorted by date in ascending order
* @request GET:/api/reporting/personal-report
* @request GET:/reporting/personal-report
*/
reportingGetPersonalReport: (
query: {
Expand All @@ -555,20 +556,21 @@ export class Api<
params: RequestParams = {},
) =>
this.request<GetPersonalReportResponse, any>({
path: `/api/reporting/personal-report`,
path: `/reporting/personal-report`,
method: "GET",
query: query,
format: "json",
...params,
}),

};
internal = {
/**
* No description
*
* @tags Internal
* @name InternalGetEmployeesTrackedTaskHours
* @summary Get employees tracked task hours
* @request GET:/api/internal/projects/tracked-task-hours
* @request GET:/internal/projects/tracked-task-hours
*/
internalGetEmployeesTrackedTaskHours: (
query: {
Expand All @@ -582,7 +584,7 @@ export class Api<
params: RequestParams = {},
) =>
this.request<GetEmployeesTrackedTaskHoursResponse, any>({
path: `/api/internal/projects/tracked-task-hours`,
path: `/internal/projects/tracked-task-hours`,
method: "GET",
query: query,
format: "json",
Expand All @@ -595,11 +597,11 @@ export class Api<
* @tags Internal
* @name InternalGetAllProjects
* @summary Get all projects
* @request GET:/api/internal/projects
* @request GET:/internal/projects
*/
internalGetAllProjects: (params: RequestParams = {}) =>
this.request<GetAllProjectsResponse, any>({
path: `/api/internal/projects`,
path: `/internal/projects`,
method: "GET",
format: "json",
...params,
Expand Down
Loading