Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADMINAPI-1060] - Admin Console - Instances endpoint (/adminconsole/Instances) #178

Merged
merged 14 commits into from
Nov 6, 2024

Conversation

DavidJGapCR
Copy link

No description provided.

Base automatically changed from ADMINAPI-1077 to adminapi23-rc.0 November 5, 2024 15:44
var adminConsoleIsEnabled = builder.Configuration.GetValue<bool>("AppSettings:EnableAdminConsoleAPI");
if (adminConsoleIsEnabled)
{
ServiceRegistration.AddServices(builder.Services, builder.Configuration);
}

builder.Services.AddAutoMapper(typeof(AdminConsoleMappingProfile));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is no longer needed

@@ -23,6 +26,13 @@
builder.Services.AddSingleton<IRateLimitConfiguration, RateLimitConfiguration>();
builder.Services.AddInMemoryRateLimiting();

builder.Services.Configure<AdminConsoleSettings>(builder.Configuration.GetSection("AdminConsoleSettings"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code from line 29 to line 35 has to be moved to our static class for service registration like in line 39:
ServiceRegistration.AddServices(builder.Services, builder.Configuration);

because this has to be enabled only when the "EnableAdminConsoleAPI" flag is in true.

Also, the "AdminConsoleSettings" section is duplicated because the appsettings has already have it but with different, you will find it like this (It's up to you if you want to rename it):

"AdminConsole": {
    "CorsSettings": {
        "EnableCors": false,
        "AllowedOrigins": [
            "https://localhost"
        ]
    }
} 

@@ -25,6 +25,9 @@
"EnableSwagger": false,
"DefaultTenant": ""
},
"AdminConsoleSettings": {
"EncryptionKey": "abcdefghi"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to the section "AdminConsole"

internal async Task<IResult> GetInstances([FromServices] IGetInstancesQuery getInstancesQuery)
{
var instances = await getInstancesQuery.Execute();
return Results.Ok(instances);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if makes sense to return the entire payload, I would say and in terms to be consistent with adminconsole, we should return only the property "document" or a list of them, with this, it might help us to integrate it easily in the adminconsole webapp.

See the example
https://github.com/Ed-Fi-Alliance-OSS/AdminAPI-2.x/blob/main/docs/design/adminconsole/notes.md#endpoints

int? DocId { get; set; }
int InstanceId { get; set; }
int TenantId { get; set; }
int EdOrgId { get; set; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be optional field

public int? DocId { get; set; }
public required int InstanceId { get; set; }
public required int TenantId { get; set; }
public required int EdOrgId { get; set; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional field

var instances = await getInstancesQuery.Execute();
return Results.Ok(instances);
}
internal async Task<IResult> GetInstance([FromServices] IGetInstanceQuery getInstanceQuery, int docId)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The adminconsole sent the parameter tenantId, so I think is better to look for the tenantid instead of the docId

@jagudelo-gap jagudelo-gap merged commit f2a3d5f into adminapi23-rc.0 Nov 6, 2024
1 check passed
@jagudelo-gap jagudelo-gap deleted the ADMINAPI-1060-2 branch November 6, 2024 16:58
dfernandez-gap added a commit that referenced this pull request Jan 27, 2025
…nstances) (#178)

* Add Db Contexts

* Add correct injection of context

* Add GenericRepository

* Add tenantId

* Fix program.cs

* Fix github actions

* Fix single tenant pg

* Fix github actions

* Admin Console - Instances endpoint

* Fixes after rebase. Added db migration for pg.

* Fixes after rabase

* Some final cleanup

* Fix on program.cs file

* Fixes based on comments.

---------

Co-authored-by: Danny Fernandez A <dfernandeza@growthaccelerationpartners.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants