.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
namespace VizhTalk.Grpc.CDN;
|
||||
|
||||
public sealed partial class UploadFileCommand;
|
||||
@@ -4,6 +4,16 @@ option csharp_namespace="VizhTalk.Grpc.CDN";
|
||||
|
||||
package greet;
|
||||
|
||||
import "DTOs.proto";
|
||||
|
||||
message UploadFileCommand{
|
||||
bytes file = 1;
|
||||
Id mediaGroupId = 2;
|
||||
string clientId = 3;
|
||||
string fileName = 4;
|
||||
}
|
||||
message CreateMediaGroupCommand{
|
||||
string key = 1;
|
||||
bool isSecure = 2;
|
||||
string title = 3;
|
||||
}
|
||||
@@ -9,5 +9,8 @@ message Id{
|
||||
}
|
||||
|
||||
message UploadFileDTO{
|
||||
Id mediaGroupMediaId = 1;
|
||||
}
|
||||
message MediaGroupDTO{
|
||||
Id id = 1;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace VizhTalk.Grpc.CDN;
|
||||
|
||||
public sealed partial class Id
|
||||
{
|
||||
public static implicit operator string(Id id)
|
||||
=> EncryptionIdHelper.Decrypt(id.Value);
|
||||
|
||||
public static implicit operator Id(string id)
|
||||
=> new Id()
|
||||
{
|
||||
Value = EncryptionIdHelper.Encrypt(id)
|
||||
};
|
||||
|
||||
public static implicit operator int(Id id)
|
||||
=> int.Parse(EncryptionIdHelper.Decrypt(id.Value));
|
||||
|
||||
public static implicit operator Guid(Id id)
|
||||
=> Guid.Parse(EncryptionIdHelper.Decrypt(id.Value));
|
||||
|
||||
public static implicit operator long(Id id)
|
||||
=> long.Parse(EncryptionIdHelper.Decrypt(id.Value));
|
||||
|
||||
|
||||
public static implicit operator Id(int id)
|
||||
=> (Id)id.ToString();
|
||||
|
||||
public static implicit operator Id(long id)
|
||||
=> (Id)id.ToString();
|
||||
|
||||
public static implicit operator Id(Guid id)
|
||||
=> (Id)id.ToString();
|
||||
}
|
||||
@@ -9,4 +9,5 @@ import "Commands.proto";
|
||||
|
||||
service CDNGrpc{
|
||||
rpc UploadFile (UploadFileCommand) returns (UploadFileDTO);
|
||||
rpc CreateMediaGroup (CreateMediaGroupCommand) returns (MediaGroupDTO);
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.58.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VizhTalk.BuildingBlocks.Domain\VizhTalk.BuildingBlocks.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Protobuf Include="Services.proto" GrpcServices="Both" />
|
||||
<Protobuf Include="DTOs.proto" GrpcServices="Both" />
|
||||
|
||||
@@ -5,6 +5,10 @@ namespace Vizhtalk.CDN.Presentation.Services;
|
||||
|
||||
public class CDNService : CDNGrpc.CDNGrpcBase
|
||||
{
|
||||
public override Task<MediaGroupDTO> CreateMediaGroup(CreateMediaGroupCommand request, ServerCallContext context)
|
||||
{
|
||||
return base.CreateMediaGroup(request, context);
|
||||
}
|
||||
public override Task<UploadFileDTO> UploadFile(UploadFileCommand request, ServerCallContext context)
|
||||
{
|
||||
return base.UploadFile(request, context);
|
||||
|
||||
Reference in New Issue
Block a user