Skip to content

Commit 4fc00db

Browse files
committed
refactor: improve code quality and add more control
1 parent 2dba488 commit 4fc00db

2 files changed

Lines changed: 5 additions & 28 deletions

File tree

.github/workflows/trigger-PR-pipeline.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Pipeline PR push
2-
2+
permissions:
3+
contents: read
4+
pull-requests: write
35
on:
46
pull_request:
57

src/ByteSync.ServerCommon/Commands/Authentication/AuthenticateCommandHandler.cs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public async Task<InitialAuthenticationResponse> Handle(AuthenticateRequest requ
7474
return client;
7575
});
7676

77-
BindSerialResponse bindSerialResponse = await BindSerial(result.Element!, request.LoginData);
77+
BindSerialResponse bindSerialResponse = await BindSerial(result.Element!);
7878

7979
var endPoint = _byteSyncEndpointFactory.BuildByteSyncEndpoint(result.Element!, bindSerialResponse.ProductSerialDescription);
8080

@@ -84,38 +84,13 @@ public async Task<InitialAuthenticationResponse> Handle(AuthenticateRequest requ
8484
return authenticationResponse;
8585
}
8686

87-
private Task<BindSerialResponse> BindSerial(Client _, LoginData loginData)
87+
private Task<BindSerialResponse> BindSerial(Client _)
8888
{
8989
BindSerialResponseStatus bindSerialResponseStatus;
90-
ProductSerial? productSerial;
9190

9291
bindSerialResponseStatus = BindSerialResponseStatus.NotSupplied;
93-
productSerial = null;
9492

9593
ProductSerialDescription? productSerialDescription = null;
96-
if (productSerial != null)
97-
{
98-
SerialStatus serialStatus;
99-
if (productSerial.IsExpired)
100-
{
101-
serialStatus = SerialStatus.Expired;
102-
}
103-
else
104-
{
105-
bool bindOK = true;
106-
107-
if (bindOK)
108-
{
109-
serialStatus = SerialStatus.OK;
110-
}
111-
else
112-
{
113-
serialStatus = SerialStatus.NoAvailableSlot;
114-
}
115-
}
116-
117-
productSerialDescription = BuildProductSerialDescription(productSerial, serialStatus);
118-
}
11994

12095
BindSerialResponse response = new BindSerialResponse(bindSerialResponseStatus, productSerialDescription);
12196

0 commit comments

Comments
 (0)