Skip to content

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperweber committed Jun 21, 2023
2 parents da59279 + 0ab6470 commit df433a4
Show file tree
Hide file tree
Showing 22 changed files with 583 additions and 502 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
Expand Down
1 change: 1 addition & 0 deletions Enterspeed.Cli.sln
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "releaseNotes", "releaseNote
releaseNotes\1.2.0.md = releaseNotes\1.2.0.md
releaseNotes\1.3.0.md = releaseNotes\1.3.0.md
releaseNotes\1.4.0.md = releaseNotes\1.4.0.md
releaseNotes\1.5.0.md = releaseNotes\1.5.0.md
EndProjectSection
EndProject
Global
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
vmPool: 'windows-latest'
majorVersion: 1
minorVersion: 4
minorVersion: 5
patchVersion: 0
version: $[format('{0}.{1}.{2}', variables.majorVersion, variables.minorVersion, variables.patchVersion)]
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
Expand Down
2 changes: 2 additions & 0 deletions releaseNotes/1.5.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### Added
- Added support for partial schemas (require new partial schemas enable on tenant)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class CreateMappingSchemaRequest : IRequest<CreateMappingSchemaResponse>
{
public string Name { get; set; }
public string ViewHandle { get; set; }
public string Type { get; set; }
}

public class CreateMappingSchemaResponse
Expand Down
54 changes: 0 additions & 54 deletions src/Enterspeed.Cli/Api/MappingSchema/DeployMappingSchema.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Enterspeed.Cli.Api.MappingSchema.Models;
using Enterspeed.Cli.Domain.Models;
using Enterspeed.Cli.Services.EnterspeedClient;
using MediatR;
using RestSharp;
Expand All @@ -16,6 +17,7 @@ public class GetMappingSchemaResponse
public string Name { get; set; }
public string ViewHandle { get; set; }
public int LatestVersion { get; set; }
public SchemaType Type { get; set; }
public MappingSchemaVersion Version { get; set; }
public List<DeploymentResponse> Deployments { get; set; }
}
Expand Down
46 changes: 0 additions & 46 deletions src/Enterspeed.Cli/Api/MappingSchema/ValidateMappingSchema.cs

This file was deleted.

61 changes: 61 additions & 0 deletions src/Enterspeed.Cli/Api/Release/CreateRelease.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Enterspeed.Cli.Domain.Models;
using Enterspeed.Cli.Services.EnterspeedClient;
using MediatR;
using RestSharp;
using System.Text.Json;

namespace Enterspeed.Cli.Api.Release;

public class CreateReleaseRequest : IRequest<CreateReleaseResponse>
{
public string EnvironmentId { get; set; }
public SchemaVersionId[] Schemas { get; set; }
}

public class SchemaVersionId
{
public string SchemaId { get; set; }
public int? Version { get; set; }
}

public class CreateReleaseResponse
{
public bool Success { get; set; }
public ApiErrorBaseResponse Error { get; set; }
}

public class CreateReleaseRequestHandler : IRequestHandler<CreateReleaseRequest, CreateReleaseResponse>
{
private readonly IEnterspeedClient _enterspeedClient;

public CreateReleaseRequestHandler(IEnterspeedClient enterspeedClient)
{
_enterspeedClient = enterspeedClient;
}

public async Task<CreateReleaseResponse> Handle(CreateReleaseRequest createRequest, CancellationToken cancellationToken)
{
var request = new RestRequest("tenant/releases", Method.Post)
.AddJsonBody(createRequest);

var response = await _enterspeedClient.ExecuteAsync(request, cancellationToken);

var createReleaseResponse = new CreateReleaseResponse { Success = response.IsSuccessful };

if (!response.IsSuccessful && !string.IsNullOrEmpty(response.Content))
{
var apiErrorBaseResponse = JsonSerializer.Deserialize<ApiErrorBaseResponse>(response.Content);

if (apiErrorBaseResponse.Code == ErrorCode.FailedToCreateRelease)
{
createReleaseResponse.Error = JsonSerializer.Deserialize<ApiGroupedErrorResponse>(response.Content);
}
else
{
createReleaseResponse.Error = JsonSerializer.Deserialize<ApiErrorResponse>(response.Content);
}
}

return createReleaseResponse;
}
}
Loading

0 comments on commit df433a4

Please sign in to comment.