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

feat(ssi): add new credentials #372

Merged
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 @@ -26,7 +26,7 @@ public record ExternalTypeDetailData(
Guid Id,
VerifiedCredentialExternalTypeId VerifiedCredentialExternalTypeId,
string Version,
string Template,
string? Template,
DateTimeOffset? ValidFrom,
DateTimeOffset? Expiry
);
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SsiRequesterData RequesterData

public record UseCaseDetailData(
VerifiedCredentialExternalTypeId VerifiedCredentialExternalTypeId,
string Template,
string? Template,
string Version
);

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/********************************************************************************
* Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations
{
/// <inheritdoc />
public partial class CPLP3523UpdateCredentials : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "template",
schema: "portal",
table: "verified_credential_external_type_use_case_detail_versions",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");

migrationBuilder.InsertData(
schema: "portal",
table: "verified_credential_external_types",
columns: new[] { "id", "label" },
values: new object[] { 6, "Quality_Credential" });

migrationBuilder.InsertData(
schema: "portal",
table: "verified_credential_types",
columns: new[] { "id", "label" },
values: new object[] { 6, "FRAMEWORK_AGREEMENT_QUALITY" });

migrationBuilder.Sql("UPDATE portal.verified_credential_type_assigned_use_cases SET use_case_id = 'b3948771-3372-4568-9e0e-acca4e674098' WHERE verified_credential_type_id = 3 and use_case_id = 'c065a349-f649-47f8-94d5-1a504a855419'");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("UPDATE portal.verified_credential_type_assigned_use_cases SET use_case_id = 'c065a349-f649-47f8-94d5-1a504a855419' WHERE verified_credential_type_id = 3 and use_case_id = 'b3948771-3372-4568-9e0e-acca4e674098'");

migrationBuilder.DeleteData(
schema: "portal",
table: "verified_credential_external_types",
keyColumn: "id",
keyValue: 6);

migrationBuilder.DeleteData(
schema: "portal",
table: "verified_credential_types",
keyColumn: "id",
keyValue: 6);

migrationBuilder.AlterColumn<string>(
name: "template",
schema: "portal",
table: "verified_credential_external_type_use_case_detail_versions",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
Expand Down Expand Up @@ -6369,6 +6369,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
Id = 5,
Label = "SUSTAINABILITY_CREDENTIAL"
},
new
{
Id = 6,
Label = "Quality_Credential"
});
});

Expand All @@ -6384,7 +6389,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnName("expiry");

b.Property<string>("Template")
.IsRequired()
.HasColumnType("text")
.HasColumnName("template");

Expand Down Expand Up @@ -6453,6 +6457,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
Id = 5,
Label = "SUSTAINABILITY_FRAMEWORK"
},
new
{
Id = 6,
Label = "FRAMEWORK_AGREEMENT_QUALITY"
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@
"use_case_id": "c065a349-f649-47f8-94d5-1a504a855419",
"description": "Quality Management",
"language_short_name": "en"
},
{
"use_case_id": "b3948771-3372-4568-9e0e-acca4e674098",
"description": "Behavior Twin",
"language_short_name": "en"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@
"id": "c065a349-f649-47f8-94d5-1a504a855419",
"name": "Quality Management",
"shortname": "QM"
},
{
"id": "b3948771-3372-4568-9e0e-acca4e674098",
"name": "Behavior Twin",
"shortname": "BT"
}
]
Original file line number Diff line number Diff line change
@@ -1,41 +1,33 @@
[
{
"id": "1268a76a-ca19-4dd8-b932-01f24071d561",
"verified_credential_external_type_id": 2,
"version": "1.0.0",
"template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Framework_Use_Case_Traceability/Catena_X_Use_Case_Rahmenbedingungen_Trace_3.0_DE.pdf",
"valid_from": "2023-06-01 00:00:00.000000 +00:00",
"expiry": "2023-09-30 00:00:00.000000 +00:00"
},
{
"id": "1268a76a-ca19-4dd8-b932-01f24071d562",
"verified_credential_external_type_id": 3,
"version": "1.0.0",
"template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Framework_Use_Case_Traceability/Catena_X_Use_Case_Rahmenbedingungen_Trace_3.0_DE.pdf",
"template": null,
"valid_from": "2023-06-01 00:00:00.000000 +00:00",
"expiry": "2023-09-30 00:00:00.000000 +00:00"
},
{
"id": "1268a76a-ca19-4dd8-b932-01f24071d563",
"verified_credential_external_type_id": 1,
"version": "2.0.0",
"template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Framework_Use_Case_Traceability/Catena_X_Use_Case_Rahmenbedingungen_Trace_3.0_DE.pdf",
"template": null,
"valid_from": "2023-06-01 00:00:00.000000 +00:00",
"expiry": "2023-12-23 00:00:00.000000 +00:00"
},
{
"id": "1268a76a-ca19-4dd8-b932-01f24071d564",
"verified_credential_external_type_id": 1,
"version": "3.0.0",
"template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Framework_Use_Case_Traceability/Catena_X_Use_Case_Rahmenbedingungen_Trace_3.0_DE.pdf",
"template": null,
"valid_from": "2024-01-01 00:00:00.000000 +00:00",
"expiry": "2024-12-31 00:00:00.000000 +00:00"
},
{
"id": "1268a76a-ca19-4dd8-b932-01f24071d565",
"verified_credential_external_type_id": 5,
"version": "1.0.0",
"template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Framework_Use_Case_Traceability/Catena_X_Use_Case_Rahmenbedingungen_Trace_3.0_DE.pdf",
"template": null,
"valid_from": "2024-01-01 00:00:00.000000 +00:00",
"expiry": "2024-12-31 00:00:00.000000 +00:00"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,24 @@
"id": "1268a76a-ca19-4dd8-b932-01f24071d560",
"verified_credential_external_type_id": 1,
"version": "1.0.0",
"template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Framework_Use_Case_Traceability/Catena_X_Use_Case_Rahmenbedingungen_Trace_3.0_DE.pdf",
"template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/231016_Catena-X_Use_Case_Framework_Traceability.pdf",
"valid_from": "2023-06-01 00:00:00.000000 +00:00",
"expiry": "2023-09-30 00:00:00.000000 +00:00"
},
{
"id": "1268a76a-ca19-4dd8-b932-01f24071d561",
"verified_credential_external_type_id": 2,
"version": "1.0.0",
"template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/231016_Catena-X_Use_Case_Framework_PCF.pdf",
"valid_from": "2023-06-01 00:00:00.000000 +00:00",
"expiry": "2023-09-30 00:00:00.000000 +00:00"
},
{
"id": "37aa6259-b452-4d50-b09e-827929dcfa15",
"verified_credential_external_type_id": 6,
"version": "1.0.0",
"template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/231016_Catena-X_Use_Case_Framework_PCF.pdf",
"valid_from": "2023-10-16 00:00:00.000000 +00:00",
"expiry": "2023-10-16 00:00:00.000000 +00:00"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@
{
"verified_credential_external_type_id": 5,
"verified_credential_type_id": 5
},
{
"verified_credential_external_type_id": 6,
"verified_credential_type_id": 6
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@
{
"verified_credential_type_id": 5,
"verified_credential_type_kind_id": 1
},
{
"verified_credential_type_id": 6,
"verified_credential_type_kind_id": 1
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
},
{
"verified_credential_type_id": 3,
"use_case_id": "c065a349-f649-47f8-94d5-1a504a855419"
"use_case_id": "b3948771-3372-4568-9e0e-acca4e674098"
},
{
"verified_credential_type_id": 5,
"use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd8"
},
{
"verified_credential_type_id": 6,
"use_case_id": "c065a349-f649-47f8-94d5-1a504a855419"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ public class VerifiedCredentialExternalTypeUseCaseDetailVersion : IBaseEntity
public VerifiedCredentialExternalTypeUseCaseDetailVersion()
{
Version = null!;
Template = null!;
CompanySsiDetails = new HashSet<CompanySsiDetail>();
}

public Guid Id { get; set; }
public VerifiedCredentialExternalTypeId VerifiedCredentialExternalTypeId { get; set; }
public string Version { get; set; }
public string Template { get; set; }
public string? Template { get; set; }
public DateTimeOffset ValidFrom { get; set; }
public DateTimeOffset? Expiry { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ public enum VerifiedCredentialExternalTypeId

[EnumMember(Value = "SustainabilityCredential")]
SUSTAINABILITY_CREDENTIAL = 5,

[EnumMember(Value = "QualityCredential")]
Quality_Credential = 6
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ public enum VerifiedCredentialTypeId

[EnumMember(Value = "Sustainability Framework")]
SUSTAINABILITY_FRAMEWORK = 5,

[EnumMember(Value = "frameworkAgreement.quality")]
FRAMEWORK_AGREEMENT_QUALITY = 6
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ public async Task GetDetailsForCompany_WithValidData_ReturnsExpected()
var result = await sut.GetUseCaseParticipationForCompany(_validCompanyId, "en").ToListAsync().ConfigureAwait(false);

// Assert
result.Should().HaveCount(4);
result.Where(x => x.Description != null).Should().HaveCount(4).And.Satisfy(
result.Should().HaveCount(5);
result.Where(x => x.Description != null).Should().HaveCount(5).And.Satisfy(
x => x.Description == "Traceability",
x => x.Description == "Sustainability & CO2-Footprint",
x => x.Description == "Behavior Twin",
x => x.Description == "Quality Management",
x => x.Description == "Circular Economy");
var traceability = result.Single(x => x.CredentialType == VerifiedCredentialTypeId.TRACEABILITY_FRAMEWORK);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
[
{
"id": "1268a76a-ca19-4dd8-b932-01f24071d561",
"verified_credential_external_type_id": 2,
"version": "1.0.0",
"template": "https://catena-x.net/.._Policies_Trace_3.0_EN.pdf",
"valid_from": "2023-06-01 00:00:00.000000 +00:00",
"expiry": "2023-09-30 00:00:00.000000 +00:00"
},
{
"id": "1268a76a-ca19-4dd8-b932-01f24071d562",
"verified_credential_external_type_id": 3,
Expand Down
Loading