Skip to content

Commit

Permalink
feat(ssi): add new credentials (#372)
Browse files Browse the repository at this point in the history
Refs: CPLP-3523
---------
Reviewed-by: Norbert Truchsess <[email protected]>
  • Loading branch information
Phil91 authored Dec 14, 2023
1 parent fb41bc4 commit ff5705a
Show file tree
Hide file tree
Showing 17 changed files with 8,932 additions and 30 deletions.
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

0 comments on commit ff5705a

Please sign in to comment.