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

Support the Attachment object💡 #2616 #2622

Merged
merged 7 commits into from
Dec 9, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test
robertbasti committed Dec 4, 2024
commit e1fafe8b8ba75f32ba806773c4c24624f309be40
26 changes: 26 additions & 0 deletions Src/WitsmlExplorer.Api/HttpHandlers/AttachmentHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Collections.Generic;
using System.Threading.Tasks;

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

using WitsmlExplorer.Api.Models;
using WitsmlExplorer.Api.Services;

namespace WitsmlExplorer.Api.HttpHandlers
{
public static class AttachmentHandler
{
[Produces(typeof(IEnumerable<Attachment>))]
public static async Task<IResult> GetAttachments(string wellUid, string wellboreUid, IAttachmentService attachmentService)
{
return TypedResults.Ok(await attachmentService.GetAttachments(wellUid, wellboreUid));

}
[Produces(typeof(Attachment))]
public static async Task<IResult> GetAttachment(string wellUid, string wellboreUid, string attachmentUid, IAttachmentService attachmentService)
{
return TypedResults.Ok(await attachmentService.GetAttachment(wellUid, wellboreUid, attachmentUid));
}
}
}
3 changes: 3 additions & 0 deletions Src/WitsmlExplorer.Api/Routes.cs
Original file line number Diff line number Diff line change
@@ -57,6 +57,9 @@ public static void ConfigureApi(this WebApplication app, IConfiguration configur
app.MapGet(routes[EntityType.BhaRun], BhaRunHandler.GetBhaRuns, useOAuth2);
app.MapGet(routes[EntityType.BhaRun] + "/{bhaRunUid}", BhaRunHandler.GetBhaRun, useOAuth2);

app.MapGet(routes[EntityType.Attachment], AttachmentHandler.GetAttachments, useOAuth2);
app.MapGet(routes[EntityType.Attachment] + "/{attachmentUid}", AttachmentHandler.GetAttachment, useOAuth2);

app.MapGet("/wells/{wellUid}/wellbores/{wellboreUid}/changelogs", ChangeLogHandler.GetChangeLogs, useOAuth2);

app.MapGet(routes[EntityType.FluidsReport], FluidsReportHandler.GetFluidsReports, useOAuth2);