-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e92713b
commit c17cf92
Showing
186 changed files
with
4,402 additions
and
2,544 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<MasaFrameworkPackageVersion>1.2.0-preview.2</MasaFrameworkPackageVersion> | ||
<MasaStackSdksPackageVersion>1.2.1-preview.4</MasaStackSdksPackageVersion> | ||
<MasaFrameworkPackageVersion>1.2.0-preview.4</MasaFrameworkPackageVersion> | ||
<MasaStackSdksPackageVersion>1.2.1-preview.8</MasaStackSdksPackageVersion> | ||
</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,38 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Dcc.Infrastructure.Domain.Shared; | ||
|
||
[NotMapped] | ||
public class App | ||
{ | ||
public int Id { get; set; } | ||
|
||
public string Name { get; set; } = ""; | ||
|
||
public string Identity { get; set; } = ""; | ||
|
||
public AppTypes Type { get; set; } | ||
|
||
public ServiceTypes ServiceType { get; set; } | ||
|
||
public string Url { get; set; } = ""; | ||
|
||
public string SwaggerUrl { get; set; } = ""; | ||
|
||
public string Description { get; set; } = ""; | ||
|
||
public DateTime CreationTime { get; set; } | ||
|
||
public Guid Creator { get; set; } | ||
|
||
public DateTime ModificationTime { get; set; } | ||
|
||
public Guid Modifier { get; set; } | ||
|
||
private readonly List<AppConfigObject> _appConfigObjects = new(); | ||
public IReadOnlyCollection<AppConfigObject> AppConfigObjects => _appConfigObjects; | ||
|
||
private readonly List<AppSecret> _appSecrets = new(); | ||
public IReadOnlyCollection<AppSecret> AppSecrets => _appSecrets; | ||
} |
19 changes: 19 additions & 0 deletions
19
Masa.Dcc.Infrastructure.Domain.Shared/App/AppConfigObject.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,19 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Dcc.Infrastructure.Domain.Shared; | ||
|
||
[Table("AppConfigObjects")] | ||
public class AppConfigObject : ConfigObjectBase | ||
{ | ||
[Comment("AppId")] | ||
[Required] | ||
[Range(1, int.MaxValue)] | ||
public int AppId { get; private set; } | ||
|
||
public AppConfigObject(int appId, int environmentClusterId) | ||
{ | ||
EnvironmentClusterId = environmentClusterId; | ||
AppId = appId; | ||
} | ||
} |
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,16 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Dcc.Infrastructure.Domain.Shared; | ||
|
||
public class AppPin : FullAggregateRoot<int, Guid> | ||
{ | ||
[Required] | ||
[Range(1, int.MaxValue)] | ||
public int AppId { get; set; } | ||
|
||
public AppPin(int appId) | ||
{ | ||
AppId = appId; | ||
} | ||
} |
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,26 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Dcc.Infrastructure.Domain.Shared; | ||
|
||
[Table("AppSecrets")] | ||
public class AppSecret : FullAggregateRoot<int, Guid> | ||
{ | ||
[Required] | ||
[Range(1, int.MaxValue)] | ||
public int AppId { get; private set; } | ||
|
||
[Required] | ||
[Range(1, int.MaxValue)] | ||
public int EnvironmentId { get; private set; } | ||
|
||
[Required] | ||
[Range(1, int.MaxValue)] | ||
public SecretType Type { get; private set; } | ||
|
||
[Required] | ||
public Guid EncryptionSecret { get; private set; } | ||
|
||
[Required] | ||
public Guid Secret { get; private set; } | ||
} |
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) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Dcc.Infrastructure.Domain.Shared; | ||
|
||
[Table("BizConfigs")] | ||
public class BizConfig : FullAggregateRoot<int, Guid> | ||
{ | ||
[Required] | ||
public string Name { get; private set; } | ||
|
||
[Required] | ||
public string Identity { get; private set; } | ||
|
||
private readonly List<BizConfigObject> _bizConfigObjects = new(); | ||
public IReadOnlyCollection<BizConfigObject> BizConfigObjects => _bizConfigObjects; | ||
|
||
public BizConfig(string name, string identity) | ||
{ | ||
Name = name; | ||
Identity = identity; | ||
} | ||
|
||
public void Update(string name) | ||
{ | ||
Name = name; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
Masa.Dcc.Infrastructure.Domain.Shared/App/BizConfigObject.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,20 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Dcc.Infrastructure.Domain.Shared; | ||
|
||
[Table("BizConfigObjects")] | ||
public class BizConfigObject : ConfigObjectBase | ||
{ | ||
[Required] | ||
[Range(1, int.MaxValue)] | ||
public int BizConfigId { get; private set; } | ||
|
||
public BizConfig BizConfig { get; private set; } = null!; | ||
|
||
public BizConfigObject(int bizConfigId, int environmentClusterId) | ||
{ | ||
BizConfigId = bizConfigId; | ||
EnvironmentClusterId = environmentClusterId; | ||
} | ||
} |
116 changes: 116 additions & 0 deletions
116
Masa.Dcc.Infrastructure.Domain.Shared/App/ConfigObject.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,116 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Dcc.Infrastructure.Domain.Shared; | ||
|
||
[Table("ConfigObjects")] | ||
public class ConfigObject : FullAggregateRoot<int, Guid> | ||
{ | ||
[Comment("Name")] | ||
[Required(ErrorMessage = "Config object name is required")] | ||
[StringLength(100, MinimumLength = 2, ErrorMessage = "Config object name length range is [2-100]")] | ||
public string Name { get; private set; } | ||
|
||
[Comment("Format")] | ||
[Required(ErrorMessage = "Format Label Code is required")] | ||
[StringLength(100, MinimumLength = 2, ErrorMessage = "Format Label Code length range is [2-100]")] | ||
public string FormatLabelCode { get; private set; } | ||
|
||
[Comment("Type")] | ||
[Range(1, int.MaxValue, ErrorMessage = "Type is required")] | ||
public ConfigObjectType Type { get; private set; } | ||
|
||
[Required] | ||
public bool Encryption { get; private set; } | ||
|
||
[Required] | ||
public string Content { get; private set; } | ||
|
||
[Required] | ||
public string TempContent { get; private set; } | ||
|
||
[Comment("Relation config object Id")] | ||
public int RelationConfigObjectId { get; private set; } | ||
|
||
public bool FromRelation { get; private set; } | ||
|
||
public PublicConfigObject PublicConfigObject { get; private set; } = null!; | ||
|
||
public BizConfigObject BizConfigObject { get; set; } = null!; | ||
|
||
public AppConfigObject AppConfigObject { get; private set; } = null!; | ||
|
||
private readonly List<ConfigObjectRelease> _configObjectRelease = new(); | ||
public IReadOnlyCollection<ConfigObjectRelease> ConfigObjectRelease => _configObjectRelease; | ||
|
||
public ConfigObject(string name, string formatLabelCode, ConfigObjectType type, string content, string tempContent, int relationConfigObjectId = 0, bool fromRelation = false, bool encryption = false) | ||
{ | ||
Name = name; | ||
FormatLabelCode = formatLabelCode; | ||
Type = type; | ||
Content = content; | ||
TempContent = tempContent; | ||
RelationConfigObjectId = relationConfigObjectId; | ||
FromRelation = fromRelation; | ||
Encryption = encryption; | ||
} | ||
|
||
public void SetConfigObjectType(ConfigObjectType type) | ||
{ | ||
Type = type; | ||
} | ||
|
||
public void SetConfigObjectRelease(IEnumerable<ConfigObjectRelease> configObjectReleases) | ||
{ | ||
_configObjectRelease.Clear(); | ||
_configObjectRelease.TryAddRange(configObjectReleases); | ||
} | ||
|
||
public void SetConfigObjectRelease(ConfigObjectRelease configObjectRelease) | ||
{ | ||
_configObjectRelease.Clear(); | ||
_configObjectRelease.TryAdd(configObjectRelease); | ||
} | ||
|
||
public void UpdateContent(string content) | ||
{ | ||
Content = content; | ||
} | ||
|
||
public void AddContent(string content, string tempContent) | ||
{ | ||
Content = content; | ||
TempContent = tempContent; | ||
} | ||
|
||
public void SetPublicConfigObject(int publicConfigId, int environmentClusterId) | ||
{ | ||
PublicConfigObject = new PublicConfigObject(publicConfigId, environmentClusterId); | ||
} | ||
|
||
public void SetBizConfigObject(int bizId, int environmentClusterId) | ||
{ | ||
BizConfigObject = new BizConfigObject(bizId, environmentClusterId); | ||
} | ||
|
||
public void SetAppConfigObject(int appId, int environmentClusterId) | ||
{ | ||
AppConfigObject = new AppConfigObject(appId, environmentClusterId); | ||
} | ||
|
||
public void Revoke() | ||
{ | ||
Content = TempContent; | ||
} | ||
|
||
public void Relation(int relationConfigObjectId) | ||
{ | ||
RelationConfigObjectId = relationConfigObjectId; | ||
FromRelation = true; | ||
} | ||
|
||
public void UnRelation() | ||
{ | ||
RelationConfigObjectId = 0; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...Domain/App/Aggregates/ConfigObjectBase.cs → ...ure.Domain.Shared/App/ConfigObjectBase.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
57 changes: 57 additions & 0 deletions
57
Masa.Dcc.Infrastructure.Domain.Shared/App/ConfigObjectRelease.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,57 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Dcc.Infrastructure.Domain.Shared; | ||
|
||
[Table("ConfigObjectReleases")] | ||
public class ConfigObjectRelease : FullAggregateRoot<int, Guid> | ||
{ | ||
[Comment("Release type")] | ||
public ReleaseType Type { get; set; } | ||
|
||
[Comment("Config object Id")] | ||
[Required(ErrorMessage = "Config object Id is required")] | ||
[Range(minimum: 1, maximum: int.MaxValue, ErrorMessage = "Config object Id is required")] | ||
public int ConfigObjectId { get; set; } | ||
|
||
[Comment("Rollback From Release Id")] | ||
public int FromReleaseId { get; set; } | ||
|
||
[Comment("If it is rolled back, it will be true")] | ||
public bool IsInvalid { get; set; } | ||
|
||
[Comment("Version format is yyyyMMddHHmmss")] | ||
[Required(ErrorMessage = "Version is required")] | ||
public string Version { get; set; } | ||
|
||
[Comment("Name")] | ||
[Required(ErrorMessage = "Name is required", AllowEmptyStrings = true)] | ||
[StringLength(100, MinimumLength = 2, ErrorMessage = "Name length range is [2-100]")] | ||
public string Name { get; set; } | ||
|
||
[Comment("Comment")] | ||
[Required(ErrorMessage = "Comment is required", AllowEmptyStrings = true)] | ||
[StringLength(500, MinimumLength = 0, ErrorMessage = "Comment length range is [0-500]")] | ||
public string Comment { get; set; } | ||
|
||
[Comment("Content")] | ||
[Required(ErrorMessage = "Content is required", AllowEmptyStrings = true)] | ||
[StringLength(int.MaxValue, MinimumLength = 1, ErrorMessage = "Content length range is [1-2147483647]")] | ||
public string Content { get; set; } | ||
|
||
public ConfigObjectRelease(int configObjectId, string name, string comment, string content, string? version = null, int fromReleaseId = 0, ReleaseType type = ReleaseType.MainRelease) | ||
{ | ||
ConfigObjectId = configObjectId; | ||
Name = name; | ||
Comment = comment; | ||
Content = content; | ||
Version = version ?? DateTime.UtcNow.ToString("yyyyMMddHHmmss"); | ||
FromReleaseId = fromReleaseId; | ||
Type = type; | ||
} | ||
|
||
public void Invalid() | ||
{ | ||
IsInvalid = true; | ||
} | ||
} |
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,33 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the Apache License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Dcc.Infrastructure.Domain.Shared; | ||
|
||
[Table("PublicConfigs")] | ||
public class PublicConfig : FullAggregateRoot<int, Guid> | ||
{ | ||
[Required] | ||
public string Name { get; private set; } | ||
|
||
[Required] | ||
public string Identity { get; private set; } | ||
|
||
[Required] | ||
public string Description { get; private set; } | ||
|
||
private readonly List<PublicConfigObject> _publicConfigObjects = new(); | ||
public IReadOnlyCollection<PublicConfigObject> PublicConfigObjects => _publicConfigObjects; | ||
|
||
public PublicConfig(string name, string identity, string description = "") | ||
{ | ||
Name = name; | ||
Identity = identity; | ||
Description = description; | ||
} | ||
|
||
public void Update(string name, string description) | ||
{ | ||
Name = name; | ||
Description = description; | ||
} | ||
} |
Oops, something went wrong.