add CancelSendVerificationSms flag to InstitutionContractExtensionCompleteRequest and update SMS sending logic

This commit is contained in:
2026-01-27 17:43:05 +03:30
parent 9596c8f8b6
commit a55492b16a
2 changed files with 19 additions and 12 deletions

View File

@@ -7,6 +7,7 @@ public class InstitutionContractExtensionCompleteRequest
public Guid TemporaryId { get; set; }
public bool IsInstallment { get; set; }
public long LawId { get; set; }
public bool CancelSendVerificationSms { get; set; }
}
public class InstitutionContractCreationCompleteRequest

View File

@@ -2269,7 +2269,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
extenstionTemp
);
var workshopIds = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?.Select(x => x.WorkshopId.Value)??[];
var workshopIds = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?.Select(x => x.WorkshopId.Value) ??
[];
var workshopsNotInInstitution = employerWorkshopIds.Where(x => !workshopIds.Contains(x)).ToList();
@@ -2317,7 +2318,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
WorkshopId = workshop?.id ?? 0,
RollCallInPerson = service.RollCallInPerson
};
}).ToList()??[];
}).ToList() ?? [];
var notIncludeWorskhopsLeftWork = await _context.LeftWorkList
.Where(x => workshopsNotInInstitution.Contains(x.WorkshopId) && x.StartWorkDate <= DateTime.Now &&
x.LeftWorkDate >= DateTime.Now)
@@ -2959,8 +2960,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
await SaveChangesAsync();
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
if (!request.CancelSendVerificationSms)
{
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
}
await SaveChangesAsync();
@@ -3363,10 +3367,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
? null
: institution.VerifierFullName,
VerifierPhoneNumber =
VerifierPhoneNumber =
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
? null
: institution.VerifierPhoneNumber,
? null
: institution.VerifierPhoneNumber,
VerifyCode = institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
? null
: institution.VerifyCode,
@@ -4366,8 +4370,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
bool tempCreated = false;
if (creationTemp == null)
{
creationTemp = new InstitutionContractCreationTemp();
await _institutionContractCreationTemp.InsertOneAsync(creationTemp);
creationTemp = new InstitutionContractCreationTemp();
await _institutionContractCreationTemp.InsertOneAsync(creationTemp);
}
List<WorkshopTempViewModel> workshopDetails = [];
@@ -5109,9 +5113,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
await SaveChangesAsync();
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
if (!request.CancelSendVerificationSms)
{
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId, contractingParty.id, entity.id);
}
await SaveChangesAsync();
await transaction.CommitAsync();