Skip to content

Commit 048080e

Browse files
author
Jani Giannoudis
committed
added culture to case-value, collector, wage-type and to all payroll results
exchange import: added checks for missing script value and missiing payroll division name updated version to 0.9.0-beta.10
1 parent f6c4532 commit 048080e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+219
-43
lines changed

Client.Core/Command/ICommandConsole.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/// <summary>
44
/// Command console contract.
55
/// </summary>
6+
// ReSharper disable UnusedMemberInSuper.Global
67
public interface ICommandConsole
78
{
89
/// <summary>

Client.Core/ExceptionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private static ApiException GetApiException(Exception exception)
131131
/// <returns>The payroll API error, null on others errors</returns>
132132
private static string GetScriptErrors(Exception exception)
133133
{
134-
// script errors resulting to a http request exception with status code unprocessable
134+
// script errors resulting to http request exception with status code unprocessable
135135
if (exception is not HttpRequestException httpException ||
136136
httpException.StatusCode != HttpStatusCode.UnprocessableContent)
137137
{

Client.Core/Exchange/ExchangeImport.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,16 @@ protected override async Task SetupScriptAsync(IExchangeTenant tenant, IRegulati
302302
{
303303
await base.SetupScriptAsync(tenant, regulation, script, targetScript);
304304

305+
// update mode
306+
if (script.UpdateMode == UpdateMode.Update)
307+
{
308+
// content required
309+
if (string.IsNullOrWhiteSpace(script.Value))
310+
{
311+
throw new PayrollException($"Missing content in script {script.Name}.");
312+
}
313+
}
314+
305315
// update script
306316
await UpsertObjectAsync(RegulationApiEndpoints.RegulationScriptsUrl(tenant.Id, regulation.Id), script, targetScript);
307317
}
@@ -361,6 +371,16 @@ protected override async Task SetupPayrollAsync(IExchangeTenant tenant, IPayroll
361371
payroll.DivisionId = division.Id;
362372
}
363373

374+
// update mode
375+
if (payroll.UpdateMode == UpdateMode.Update)
376+
{
377+
// division id required
378+
if (payroll.DivisionId == 0)
379+
{
380+
throw new PayrollException($"Missing division name in payroll {payroll.Name}.");
381+
}
382+
}
383+
364384
// update payroll
365385
await UpsertObjectAsync(PayrollApiEndpoints.PayrollsUrl(tenant.Id), payroll, targetPayroll);
366386
}

Client.Core/IModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace PayrollEngine.Client;
55

66
/// <summary>Base for all Payroll models</summary>
7+
// ReSharper disable UnusedMemberInSuper.Global
78
public interface IModel
89
{
910
/// <summary>The unique object id (immutable)</summary>

Client.Core/Model/CaseValue.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,35 @@ public class CaseValue : ModelBase, ICaseValue
6363

6464
/// <inheritdoc/>
6565
[JsonPropertyOrder(111)]
66-
public CaseRelationReference CaseRelation { get; set; }
66+
public string Culture { get; set; }
6767

6868
/// <inheritdoc/>
6969
[JsonPropertyOrder(112)]
70-
public DateTime? CancellationDate { get; set; }
70+
public CaseRelationReference CaseRelation { get; set; }
7171

7272
/// <inheritdoc/>
7373
[JsonPropertyOrder(113)]
74-
public DateTime? Start { get; set; }
74+
public DateTime? CancellationDate { get; set; }
7575

7676
/// <inheritdoc/>
7777
[JsonPropertyOrder(114)]
78+
public DateTime? Start { get; set; }
79+
80+
/// <inheritdoc/>
81+
[JsonPropertyOrder(115)]
7882
public DateTime? End { get; set; }
7983

8084
/// <inheritdoc/>
8185
[StringLength(128)]
82-
[JsonPropertyOrder(115)]
86+
[JsonPropertyOrder(116)]
8387
public string Forecast { get; set; }
8488

8589
/// <inheritdoc/>
86-
[JsonPropertyOrder(116)]
90+
[JsonPropertyOrder(117)]
8791
public List<string> Tags { get; set; }
8892

8993
/// <inheritdoc/>
90-
[JsonPropertyOrder(117)]
94+
[JsonPropertyOrder(118)]
9195
public Dictionary<string, object> Attributes { get; set; }
9296

9397
/// <summary>Initializes a new instance</summary>

Client.Core/Model/Collector.cs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,54 @@ public class Collector : ModelBase, ICollector, INameObject
3535

3636
/// <inheritdoc/>
3737
[JsonPropertyOrder(106)]
38-
public List<string> CollectorGroups { get; set; }
38+
public string Culture { get; set; }
3939

4040
/// <inheritdoc/>
4141
[JsonPropertyOrder(107)]
42-
public decimal? Threshold { get; set; }
42+
public List<string> CollectorGroups { get; set; }
4343

4444
/// <inheritdoc/>
4545
[JsonPropertyOrder(108)]
46-
public decimal? MinResult { get; set; }
46+
public decimal? Threshold { get; set; }
4747

4848
/// <inheritdoc/>
4949
[JsonPropertyOrder(109)]
50-
public decimal? MaxResult { get; set; }
50+
public decimal? MinResult { get; set; }
5151

5252
/// <inheritdoc/>
5353
[JsonPropertyOrder(110)]
54-
public string StartExpression { get; set; }
54+
public decimal? MaxResult { get; set; }
5555

5656
/// <inheritdoc/>
5757
[JsonPropertyOrder(111)]
58-
public string StartExpressionFile { get; set; }
58+
public string StartExpression { get; set; }
5959

6060
/// <inheritdoc/>
6161
[JsonPropertyOrder(112)]
62-
public string ApplyExpression { get; set; }
62+
public string StartExpressionFile { get; set; }
6363

6464
/// <inheritdoc/>
6565
[JsonPropertyOrder(113)]
66-
public string ApplyExpressionFile { get; set; }
66+
public string ApplyExpression { get; set; }
6767

6868
/// <inheritdoc/>
6969
[JsonPropertyOrder(114)]
70-
public string EndExpression { get; set; }
70+
public string ApplyExpressionFile { get; set; }
7171

7272
/// <inheritdoc/>
7373
[JsonPropertyOrder(115)]
74-
public string EndExpressionFile { get; set; }
74+
public string EndExpression { get; set; }
7575

7676
/// <inheritdoc/>
7777
[JsonPropertyOrder(116)]
78-
public List<string> Clusters { get; set; }
78+
public string EndExpressionFile { get; set; }
7979

8080
/// <inheritdoc/>
8181
[JsonPropertyOrder(117)]
82+
public List<string> Clusters { get; set; }
83+
84+
/// <inheritdoc/>
85+
[JsonPropertyOrder(118)]
8286
public Dictionary<string, object> Attributes { get; set; }
8387

8488
/// <summary>Initializes a new instance</summary>

Client.Core/Model/CollectorCustomResult.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,22 @@ public class CollectorCustomResult : ModelBase, ICollectorCustomResult
3636

3737
/// <inheritdoc/>
3838
[JsonPropertyOrder(105)]
39-
public DateTime Start { get; set; }
39+
public string Culture { get; set; }
4040

4141
/// <inheritdoc/>
4242
[JsonPropertyOrder(106)]
43-
public DateTime End { get; set; }
43+
public DateTime Start { get; set; }
4444

4545
/// <inheritdoc/>
4646
[JsonPropertyOrder(107)]
47-
public List<string> Tags { get; set; }
47+
public DateTime End { get; set; }
4848

4949
/// <inheritdoc/>
5050
[JsonPropertyOrder(108)]
51+
public List<string> Tags { get; set; }
52+
53+
/// <inheritdoc/>
54+
[JsonPropertyOrder(109)]
5155
public Dictionary<string, object> Attributes { get; set; }
5256

5357
/// <summary>Initializes a new instance</summary>

Client.Core/Model/CollectorResult.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,22 @@ public class CollectorResult : ModelBase, ICollectorResult
4141

4242
/// <inheritdoc/>
4343
[JsonPropertyOrder(108)]
44-
public DateTime Start { get; set; }
44+
public string Culture { get; set; }
4545

4646
/// <inheritdoc/>
4747
[JsonPropertyOrder(109)]
48-
public DateTime End { get; set; }
48+
public DateTime Start { get; set; }
4949

5050
/// <inheritdoc/>
5151
[JsonPropertyOrder(110)]
52-
public List<string> Tags { get; set; }
52+
public DateTime End { get; set; }
5353

5454
/// <inheritdoc/>
5555
[JsonPropertyOrder(111)]
56+
public List<string> Tags { get; set; }
57+
58+
/// <inheritdoc/>
59+
[JsonPropertyOrder(112)]
5660
public Dictionary<string, object> Attributes { get; set; }
5761

5862
/// <summary>Initializes a new instance</summary>

Client.Core/Model/ICalendar.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PayrollEngine.Client.Model;
44

55
/// <summary>The payroll calendar client object</summary>
6+
// ReSharper disable UnusedMemberInSuper.Global
67
public interface ICalendar : IModel, IAttributeObject, IKeyEquatable<ICalendar>
78
{
89
/// <summary>The calendar name</summary>

Client.Core/Model/ICaseChange.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace PayrollEngine.Client.Model;
55

66
/// <summary>Payroll case value change client object</summary>
7+
// ReSharper disable UnusedMemberInSuper.Global
78
public interface ICaseChange : IModel, IEquatable<ICaseChange>
89
{
910
/// <summary>The change user id</summary>

0 commit comments

Comments
 (0)