Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(credentialType): rename membership certificate to membership #217

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private static async ValueTask HandleNotification(

var content = JsonSerializer.Serialize(new
{
Type = data.VerifiedCredentialTypeId,
Type = data.VerifiedCredentialExternalTypeId,
ExpiryDate = data.ExpiryDate?.ToString("O") ?? throw new ConflictException("Expiry Date must be set here"),
Version = data.DetailVersion,
CredentialId = data.Id,
Expand All @@ -179,9 +179,9 @@ private static async ValueTask HandleNotification(
{
await portalService.AddNotification(content, requesterId, NotificationTypeId.CREDENTIAL_EXPIRY,
cancellationToken).ConfigureAwait(ConfigureAwaitOptions.None);
var typeValue = data.VerifiedCredentialTypeId.GetEnumValue() ??
var typeValue = data.VerifiedCredentialExternalTypeId.GetEnumValue() ??
throw new UnexpectedConditionException(
$"VerifiedCredentialType {data.VerifiedCredentialTypeId} does not exists");
$"VerifiedCredentialType {data.VerifiedCredentialExternalTypeId} does not exists");
var mailParameters = new MailParameter[]
{
new("typeId", typeValue), new("version", data.DetailVersion ?? "no version"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public record CredentialExpiryData(
string? DetailVersion,
string Bpnl,
CompanySsiDetailStatusId CompanySsiDetailStatusId,
VerifiedCredentialTypeId VerifiedCredentialTypeId,
VerifiedCredentialExternalTypeId VerifiedCredentialExternalTypeId,
CredentialScheduleData ScheduleData);

public record CredentialScheduleData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.DBAccess.Models;

public record SsiApprovalData(
CompanySsiDetailStatusId Status,
VerifiedCredentialTypeId Type,
VerifiedCredentialExternalTypeId Type,
Guid? ProcessId,
VerifiedCredentialTypeKindId? Kind,
string Bpn,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public IAsyncEnumerable<OwnedVerifiedCredentialData> GetOwnCredentialDetails(str
true,
new SsiApprovalData(
x.CompanySsiDetailStatusId,
x.VerifiedCredentialTypeId,
x.VerifiedCredentialType!.VerifiedCredentialTypeAssignedExternalType!.VerifiedCredentialExternalTypeId,
x.ProcessId,
x.VerifiedCredentialType!.VerifiedCredentialTypeAssignedKind == null ? null : x.VerifiedCredentialType!.VerifiedCredentialTypeAssignedKind!.VerifiedCredentialTypeKindId,
x.Bpnl,
Expand All @@ -205,13 +205,13 @@ public IAsyncEnumerable<OwnedVerifiedCredentialData> GetOwnCredentialDetails(str
.SingleOrDefaultAsync();

/// <inheritdoc />
public Task<(bool Exists, CompanySsiDetailStatusId Status, VerifiedCredentialTypeId Type, string UserId, Guid? ProcessId, IEnumerable<Guid> ProcessStepIds)> GetSsiRejectionData(Guid credentialId) =>
public Task<(bool Exists, CompanySsiDetailStatusId Status, VerifiedCredentialExternalTypeId Type, string UserId, Guid? ProcessId, IEnumerable<Guid> ProcessStepIds)> GetSsiRejectionData(Guid credentialId) =>
context.CompanySsiDetails
.Where(x => x.Id == credentialId)
.Select(x => new ValueTuple<bool, CompanySsiDetailStatusId, VerifiedCredentialTypeId, string, Guid?, IEnumerable<Guid>>(
.Select(x => new ValueTuple<bool, CompanySsiDetailStatusId, VerifiedCredentialExternalTypeId, string, Guid?, IEnumerable<Guid>>(
true,
x.CompanySsiDetailStatusId,
x.VerifiedCredentialTypeId,
x.VerifiedCredentialType!.VerifiedCredentialTypeAssignedExternalType!.VerifiedCredentialExternalTypeId,
x.CreatorUserId,
x.ProcessId,
x.Process!.ProcessSteps.Where(ps => ps.ProcessStepStatusId == ProcessStepStatusId.TODO).Select(p => p.Id)
Expand Down Expand Up @@ -263,7 +263,7 @@ public IAsyncEnumerable<CredentialExpiryData> GetExpiryData(DateTimeOffset now,
x.Details.VerifiedCredentialExternalTypeDetailVersion!.Version,
x.Details.Bpnl,
x.Details.CompanySsiDetailStatusId,
x.Details.VerifiedCredentialTypeId,
x.Details.VerifiedCredentialType!.VerifiedCredentialTypeAssignedExternalType!.VerifiedCredentialExternalTypeId,
new CredentialScheduleData(
x.IsVcToDelete,
x.IsOneDayNotification,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ public void AttachAndModifyCredential(Guid credentialId, Action<CompanySsiDetail
modify(entity);
}

public Task<(VerifiedCredentialTypeId TypeId, string RequesterId)> GetCredentialNotificationData(Guid credentialId) =>
public Task<(VerifiedCredentialExternalTypeId ExternalTypeId, string RequesterId)> GetCredentialNotificationData(Guid credentialId) =>
dbContext.CompanySsiDetails
.Where(x => x.Id == credentialId)
.Select(x => new ValueTuple<VerifiedCredentialTypeId, string>(x.VerifiedCredentialTypeId, x.CreatorUserId))
.Select(x => new ValueTuple<VerifiedCredentialExternalTypeId, string>(x.VerifiedCredentialType!.VerifiedCredentialTypeAssignedExternalType!.VerifiedCredentialExternalTypeId, x.CreatorUserId))
.SingleOrDefaultAsync();

public Task<(bool Exists, bool IsSameCompany, IEnumerable<(DocumentStatusId StatusId, byte[] Content)> Documents)> GetSignedCredentialForCredentialId(Guid credentialId, string bpnl) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public interface ICompanySsiDetailsRepository
IAsyncEnumerable<OwnedVerifiedCredentialData> GetOwnCredentialDetails(string bpnl);

Task<(bool exists, SsiApprovalData data)> GetSsiApprovalData(Guid credentialId);
Task<(bool Exists, CompanySsiDetailStatusId Status, VerifiedCredentialTypeId Type, string UserId, Guid? ProcessId, IEnumerable<Guid> ProcessStepIds)> GetSsiRejectionData(Guid credentialId);
Task<(bool Exists, CompanySsiDetailStatusId Status, VerifiedCredentialExternalTypeId Type, string UserId, Guid? ProcessId, IEnumerable<Guid> ProcessStepIds)> GetSsiRejectionData(Guid credentialId);
void AttachAndModifyCompanySsiDetails(Guid id, Action<CompanySsiDetail>? initialize, Action<CompanySsiDetail> updateFields);
IAsyncEnumerable<VerifiedCredentialTypeId> GetCertificateTypes(string bpnl);
IAsyncEnumerable<CredentialExpiryData> GetExpiryData(DateTimeOffset now, DateTimeOffset inactiveVcsToDelete, DateTimeOffset expiredVcsToDelete);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface ICredentialRepository
Task<(string Bpn, string? CallbackUrl)> GetCallbackUrl(Guid credentialId);
Task<(bool Exists, bool IsSameBpnl, Guid? ExternalCredentialId, CompanySsiDetailStatusId StatusId, IEnumerable<(Guid DocumentId, DocumentStatusId DocumentStatusId)> Documents)> GetRevocationDataById(Guid credentialId, string bpnl);
void AttachAndModifyCredential(Guid credentialId, Action<CompanySsiDetail>? initialize, Action<CompanySsiDetail> modify);
Task<(VerifiedCredentialTypeId TypeId, string RequesterId)> GetCredentialNotificationData(Guid credentialId);
Task<(VerifiedCredentialExternalTypeId ExternalTypeId, string RequesterId)> GetCredentialNotificationData(Guid credentialId);
Task<(bool Exists, bool IsSameCompany, IEnumerable<(DocumentStatusId StatusId, byte[] Content)> Documents)> GetSignedCredentialForCredentialId(Guid credentialId, string bpnl);
Task<(bool Exists, bool IsSameCompany, string FileName, DocumentStatusId StatusId, byte[] Content, MediaTypeId MediaTypeId)> GetDocumentById(Guid documentId, string bpnl);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,31 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using System.Runtime.Serialization;

namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Entities.Enums;

public enum VerifiedCredentialTypeId
{
[EnumMember(Value = "Traceability Framework")]
TRACEABILITY_FRAMEWORK = 1,

[EnumMember(Value = "PCF Framework")]
PCF_FRAMEWORK = 2,

[EnumMember(Value = "Behavior Twin Framework")]
BEHAVIOR_TWIN_FRAMEWORK = 3,

[EnumMember(Value = "Membership Certificate")]
MEMBERSHIP_CERTIFICATE = 4,
MEMBERSHIP = 4,

[EnumMember(Value = "Circular Economy")]
CIRCULAR_ECONOMY = 5,

[EnumMember(Value = "frameworkAgreement.quality")]
FRAMEWORK_AGREEMENT_QUALITY = 6,

[EnumMember(Value = "BusinessPartnerCredential")]
BUSINESS_PARTNER_NUMBER = 7,

[EnumMember(Value = "Demand and Capacity Management")]
DEMAND_AND_CAPACITY_MANAGEMENT = 8,

[EnumMember(Value = "Demand and Capacity Management")]
DEMAND_AND_CAPACITY_MANAGEMENT_PURIS = 9,

[EnumMember(Value = "Business Partner Data Management")]
BUSINESS_PARTNER_DATA_MANAGEMENT = 10,

[EnumMember(Value = "Framework Agreement")]
FRAMEWORK_AGREEMENT = 11,

[EnumMember(Value = "Date Exchange Governance")]
DATA_EXCHANGE_GOVERNANCE_CREDENTIAL = 12
}
Loading