Skip to content

Commit 08d354a

Browse files
renemadsenclaude
andcommitted
feat(grpc): include UseOneMinuteIntervals on Site in GetRegistrationSites response
Adds bool use_one_minute_intervals = 23 to the Site message in settings.proto and the matching UseOneMinuteIntervals property on the C# Site DTO. Populates the new field from AssignedSite.UseOneMinuteIntervals in both GetAvailableSites (token path) and GetAllRegistrationSitesByCurrentUser (personal/JWT path) inside TimeSettingService, so the gRPC handler maps it through automatically. Also fills the field in GetResignedSites for symmetry across the three site-builders. Mobile clients (flutter-time kiosk mode) can now select the correct site-level minute-precision behavior at the registration step, before any GetAssignedSite call is made. Extends TimePlanningSettingsGrpcServiceTests GetRegistrationSitesByCurrentUser_Success_MapsSitesToGrpcResponse to cover both UseOneMinuteIntervals=true and =false sites and assert the field round-trips through the gRPC mapper. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ee2aaa2 commit 08d354a

5 files changed

Lines changed: 13 additions & 2 deletions

File tree

eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn.Test/GrpcServices/TimePlanningSettingsGrpcServiceTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public async Task GetRegistrationSitesByCurrentUser_Success_MapsSitesToGrpcRespo
4949
FourthShiftActive = false,
5050
FifthShiftActive = true,
5151
SnapshotEnabled = false,
52+
UseOneMinuteIntervals = true,
5253
Resigned = false,
5354
ResignedAtDate = DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc),
5455
AvatarUrl = "https://example.com/avatar1.png",
@@ -74,6 +75,7 @@ public async Task GetRegistrationSitesByCurrentUser_Success_MapsSitesToGrpcRespo
7475
FourthShiftActive = true,
7576
FifthShiftActive = false,
7677
SnapshotEnabled = true,
78+
UseOneMinuteIntervals = false,
7779
Resigned = true,
7880
ResignedAtDate = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc),
7981
AvatarUrl = "https://example.com/avatar2.png",
@@ -113,6 +115,7 @@ public async Task GetRegistrationSitesByCurrentUser_Success_MapsSitesToGrpcRespo
113115
Assert.That(site1.FourthShiftActive, Is.False);
114116
Assert.That(site1.FifthShiftActive, Is.True);
115117
Assert.That(site1.SnapshotEnabled, Is.False);
118+
Assert.That(site1.UseOneMinuteIntervals, Is.True);
116119
Assert.That(site1.Resigned, Is.False);
117120
Assert.That(site1.AvatarUrl, Is.EqualTo("https://example.com/avatar1.png"));
118121
Assert.That(site1.PhoneNumber, Is.EqualTo("+4512345678"));
@@ -136,6 +139,7 @@ public async Task GetRegistrationSitesByCurrentUser_Success_MapsSitesToGrpcRespo
136139
Assert.That(site2.FourthShiftActive, Is.True);
137140
Assert.That(site2.FifthShiftActive, Is.False);
138141
Assert.That(site2.SnapshotEnabled, Is.True);
142+
Assert.That(site2.UseOneMinuteIntervals, Is.False);
139143
Assert.That(site2.Resigned, Is.True);
140144
Assert.That(site2.AvatarUrl, Is.EqualTo("https://example.com/avatar2.png"));
141145
Assert.That(site2.PhoneNumber, Is.EqualTo("+4587654321"));

eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn/Infrastructure/Models/Settings/Site.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ public class Site
2828

2929
public DateTime ResignedAtDate { get; set; }
3030
public string? PhoneNumber { get; set; }
31+
public bool UseOneMinuteIntervals { get; set; }
3132
}

eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn/Protos/settings.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ message Site {
236236
bool resigned = 20;
237237
google.protobuf.Timestamp resigned_at_date = 21;
238238
string phone_number = 22;
239+
bool use_one_minute_intervals = 23;
239240
}
240241

241242
// Response wrappers matching C# OperationDataResult<T>

eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn/Services/GrpcServices/TimePlanningSettingsGrpcService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ public override async Task<GetRegistrationSitesResponse> GetRegistrationSites(
266266
ResignedAtDate = Timestamp.FromDateTime(
267267
DateTime.SpecifyKind(site.ResignedAtDate, DateTimeKind.Utc)),
268268
PhoneNumber = site.PhoneNumber ?? "",
269+
UseOneMinuteIntervals = site.UseOneMinuteIntervals,
269270
};
270271
response.Model.Add(grpcSite);
271272
}
@@ -318,6 +319,7 @@ public override async Task<GetRegistrationSitesResponse> GetRegistrationSitesByC
318319
ResignedAtDate = Timestamp.FromDateTime(
319320
DateTime.SpecifyKind(site.ResignedAtDate, DateTimeKind.Utc)),
320321
PhoneNumber = site.PhoneNumber ?? "",
322+
UseOneMinuteIntervals = site.UseOneMinuteIntervals,
321323
};
322324
response.Model.Add(grpcSite);
323325
}

eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn/Services/TimePlanningSettingService/TimeSettingService.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ planRegistrationForToday is
311311
FifthShiftActive = assignedSite.FifthShiftActive,
312312
Resigned = assignedSite.Resigned,
313313
ResignedAtDate = assignedSite.ResignedAtDate,
314-
SnapshotEnabled = assignedSite.SnapshotEnabled
314+
SnapshotEnabled = assignedSite.SnapshotEnabled,
315+
UseOneMinuteIntervals = assignedSite.UseOneMinuteIntervals
315316
};
316317
var workerEmail = (worker.Email ?? "").Trim().ToLower();
317318
var user = baseDbContext == null || string.IsNullOrEmpty(workerEmail) ? null : await baseDbContext.Users
@@ -617,7 +618,8 @@ planRegistrationForToday is
617618
FifthShiftActive = assignedSite.FifthShiftActive,
618619
Resigned = assignedSite.Resigned,
619620
ResignedAtDate = assignedSite.ResignedAtDate,
620-
SnapshotEnabled = assignedSite.SnapshotEnabled
621+
SnapshotEnabled = assignedSite.SnapshotEnabled,
622+
UseOneMinuteIntervals = assignedSite.UseOneMinuteIntervals
621623
};
622624
var workerEmail = (worker.Email ?? "").Trim().ToLower();
623625
var user = baseDbContext == null || string.IsNullOrEmpty(workerEmail) ? null : await baseDbContext.Users
@@ -892,6 +894,7 @@ planRegistrationForToday is
892894
FifthShiftActive = assignedSite.FifthShiftActive,
893895
Resigned = assignedSite.Resigned,
894896
ResignedAtDate = assignedSite.ResignedAtDate,
897+
UseOneMinuteIntervals = assignedSite.UseOneMinuteIntervals,
895898
};
896899
var workerEmail = (worker.Email ?? "").Trim().ToLower();
897900
var user = baseDbContext == null || string.IsNullOrEmpty(workerEmail) ? null : await baseDbContext.Users

0 commit comments

Comments
 (0)