-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs: #7
- Loading branch information
Showing
24 changed files
with
1,401 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- | ||
- 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 | ||
--> | ||
|
||
<Project> | ||
<PropertyGroup> | ||
<VersionPrefix>0.1.0</VersionPrefix> | ||
<VersionSuffix>rc.1</VersionSuffix> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "database", "database", "{CD0CFEEC-AE1A-4861-A9DA-1A6985271A2C}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "issuer", "issuer", "{F4C71A62-F592-42D1-981E-253B3C5F80D6}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SsiAuthoritySchemaRegistry.Entities", "database\SsiAuthoritySchemaRegistry.Entities\SsiAuthoritySchemaRegistry.Entities.csproj", "{FA3B20E3-D396-467E-A05C-B16808055B33}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SsiAuthoritySchemaRegistry.Migrations", "database\SsiAuthoritySchemaRegistry.Migrations\SsiAuthoritySchemaRegistry.Migrations.csproj", "{F68BA7A9-AD67-4E0B-B859-1505671304E9}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SsiAuthoritySchemaRegistry.Service", "registry\SsiAuthoritySchemaRegistry.Service\SsiAuthoritySchemaRegistry.Service.csproj", "{1AA22A40-802C-407B-AABF-E250931E4673}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{FA3B20E3-D396-467E-A05C-B16808055B33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{FA3B20E3-D396-467E-A05C-B16808055B33}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{FA3B20E3-D396-467E-A05C-B16808055B33}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{FA3B20E3-D396-467E-A05C-B16808055B33}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{F68BA7A9-AD67-4E0B-B859-1505671304E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F68BA7A9-AD67-4E0B-B859-1505671304E9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F68BA7A9-AD67-4E0B-B859-1505671304E9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F68BA7A9-AD67-4E0B-B859-1505671304E9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{1AA22A40-802C-407B-AABF-E250931E4673}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1AA22A40-802C-407B-AABF-E250931E4673}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1AA22A40-802C-407B-AABF-E250931E4673}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1AA22A40-802C-407B-AABF-E250931E4673}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{FA3B20E3-D396-467E-A05C-B16808055B33} = {CD0CFEEC-AE1A-4861-A9DA-1A6985271A2C} | ||
{F68BA7A9-AD67-4E0B-B859-1505671304E9} = {CD0CFEEC-AE1A-4861-A9DA-1A6985271A2C} | ||
{1AA22A40-802C-407B-AABF-E250931E4673} = {F4C71A62-F592-42D1-981E-253B3C5F80D6} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Program Files\dotnet\sdk\8.0.101\MSBuild.dll</s:String> | ||
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">1114112</s:Int64> | ||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=a173b283_002D24ae_002D4138_002D8542_002D8c42746d973b/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &lt;tests&gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> | ||
<Project Location="C:\projects\customers\bmw\policy-hub\src" Presentation="&lt;tests&gt;" /> | ||
</SessionState></s:String></wpf:ResourceDictionary> |
8 changes: 8 additions & 0 deletions
8
src/database/SsiAuthoritySchemaRegistry.Entities/Entities/Authority.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities.Entities; | ||
|
||
public class Authority(string bpn) | ||
{ | ||
public string Bpn { get; set; } = bpn; | ||
|
||
public ICollection<CredentialAuthority> CredentialAuthorities { get; private set; } = new HashSet<CredentialAuthority>(); | ||
} |
32 changes: 32 additions & 0 deletions
32
src/database/SsiAuthoritySchemaRegistry.Entities/Entities/Credential.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 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 Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities.Enums; | ||
|
||
namespace Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities.Entities; | ||
|
||
public class Credential(Guid id, CredentialTypeId typeId, string name) | ||
{ | ||
public Guid Id { get; set; } = id; | ||
public CredentialTypeId TypeId { get; set; } = typeId; | ||
public string Name { get; set; } = name; | ||
|
||
public ICollection<CredentialAuthority> Authorities { get; private set; } = new HashSet<CredentialAuthority>(); | ||
public virtual CredentialType? Type { get; private set; } | ||
} |
30 changes: 30 additions & 0 deletions
30
src/database/SsiAuthoritySchemaRegistry.Entities/Entities/CredentialAuthority.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 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 | ||
********************************************************************************/ | ||
|
||
namespace Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities.Entities; | ||
|
||
public class CredentialAuthority(Guid credentialId, string bpn) | ||
{ | ||
public Guid CredentialId { get; set; } = credentialId; | ||
public string Bpn { get; set; } = bpn; | ||
|
||
public virtual Credential? Credential { get; private set; } | ||
|
||
public virtual Authority? Authority { get; private set; } | ||
} |
37 changes: 37 additions & 0 deletions
37
src/database/SsiAuthoritySchemaRegistry.Entities/Entities/CredentialType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 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 Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities.Enums; | ||
|
||
namespace Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities.Entities; | ||
|
||
public class CredentialType() | ||
{ | ||
public CredentialType(CredentialTypeId typeId) | ||
: this() | ||
{ | ||
Id = typeId; | ||
Label = typeId.ToString(); | ||
} | ||
|
||
public CredentialTypeId Id { get; set; } | ||
public string Label { get; set; } = null!; | ||
|
||
public ICollection<Credential> Credentials { get; private set; } = new HashSet<Credential>(); | ||
} |
28 changes: 28 additions & 0 deletions
28
src/database/SsiAuthoritySchemaRegistry.Entities/Enums/CredentialTypeId.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 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 | ||
********************************************************************************/ | ||
|
||
namespace Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities.Enums; | ||
|
||
public enum CredentialTypeId | ||
{ | ||
BusinessPartnerNumber = 1, | ||
Membership = 2, | ||
Framework = 3, | ||
CompanyRole = 4 | ||
} |
87 changes: 87 additions & 0 deletions
87
src/database/SsiAuthoritySchemaRegistry.Entities/RegistryContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2024 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; | ||
using Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities.Entities; | ||
using Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities.Enums; | ||
|
||
namespace Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities; | ||
|
||
public class RegistryContext : DbContext | ||
{ | ||
public RegistryContext() | ||
{ | ||
} | ||
|
||
public RegistryContext(DbContextOptions<RegistryContext> options) | ||
: base(options) | ||
{ | ||
} | ||
|
||
public virtual DbSet<Credential> Credentials { get; set; } = default!; | ||
public virtual DbSet<CredentialAuthority> CredentialAuthorities { get; set; } = default!; | ||
public virtual DbSet<Authority> Authorities { get; set; } = default!; | ||
public virtual DbSet<CredentialType> CredentialTypes { get; set; } = default!; | ||
|
||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
optionsBuilder.UseSnakeCaseNamingConvention(); | ||
} | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.HasAnnotation("Relational:Collation", "en_US.utf8"); | ||
modelBuilder.HasDefaultSchema("ssi-authority-schema-registry"); | ||
|
||
modelBuilder.Entity<Authority>(e => | ||
{ | ||
e.HasKey(a => a.Bpn); | ||
}); | ||
|
||
modelBuilder.Entity<Credential>(e => | ||
{ | ||
e.HasMany(c => c.Authorities) | ||
.WithOne(c => c.Credential) | ||
.HasForeignKey(c => c.CredentialId) | ||
.OnDelete(DeleteBehavior.ClientSetNull); | ||
} | ||
); | ||
|
||
modelBuilder.Entity<CredentialAuthority>(e => | ||
{ | ||
e.HasKey(ca => new { ca.CredentialId, ca.Bpn }); | ||
|
||
e.HasOne(ca => ca.Credential) | ||
.WithMany(c => c.Authorities) | ||
.HasForeignKey(ca => ca.CredentialId) | ||
.OnDelete(DeleteBehavior.ClientSetNull); | ||
|
||
e.HasOne(ca => ca.Authority) | ||
.WithMany(c => c.CredentialAuthorities) | ||
.HasForeignKey(ca => ca.Bpn) | ||
.OnDelete(DeleteBehavior.ClientSetNull); | ||
}); | ||
|
||
modelBuilder.Entity<CredentialType>().HasData( | ||
Enum.GetValues(typeof(CredentialTypeId)) | ||
.Cast<CredentialTypeId>() | ||
.Select(e => new CredentialType(e)) | ||
); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/database/SsiAuthoritySchemaRegistry.Entities/SsiAuthoritySchemaRegistry.Entities.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- | ||
- Copyright (c) 2024 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 | ||
--> | ||
|
||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities</AssemblyName> | ||
<RootNamespace>Org.Eclipse.TractusX.SsiAuthoritySchemaRegistry.Entities</RootNamespace> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="EFCore.NamingConventions" Version="8.0.3" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.