add Data Support ...

This commit is contained in:
2025-12-06 22:23:17 +03:30
parent 15171511f5
commit 3ea6eb2012
13 changed files with 226 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
bin
obj
+9
View File
@@ -0,0 +1,9 @@
using xDataService.Events;
using xFileService.Interfaces.Entities;
using xFileService.Models.Entities;
namespace xFileService.DataHelper.Events
{
public class XFileEvents : XBaseRepositoryEvents<XFile>, IXFileEvents
{ }
}
@@ -0,0 +1,26 @@
using System;
using xDataService.Configuration;
using xDataService.GraphQL;
using xFileService.Interfaces.Entities;
using xFileService.Models.Entities;
namespace xFileService.DataHelper.GraphQL
{
public class XFileGraphQLTypeHelper : XBaseGraphQLTypeHelper<XFile, Guid>, IXFileGraphQLTypeHelper
{
public XFileGraphQLTypeHelper(
XDataServiceConfiguration configuration
) : base(configuration)
{ }
public override string GetInQueryCollectionName()
{
return "files";
}
public override string GetInQuerySingleName()
{
return "file";
}
}
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using GraphQL.Types;
using xDataService.Configuration;
using xDataService.GraphQL;
using xFileService.Interfaces.Entities;
using xFileService.Models.Entities;
namespace xFileService.DataHelper.GraphQL
{
public class XFileGraphQuery : XBaseGraphQLQuery<XFile, Guid, XFileGraphType, GuidGraphType>
{
public XFileGraphQuery(
XDataServiceConfiguration configuration,
IXFileRepository repository,
IXFileGraphQLTypeHelper helper
) : base(
configuration,
repository,
helper
)
{ }
}
}
+13
View File
@@ -0,0 +1,13 @@
using System;
using GraphQL.Types;
namespace xFileService.DataHelper.GraphQL
{
public class XFileGraphSchema : Schema
{
public XFileGraphSchema(IServiceProvider services) : base(services)
{
Query = (XFileGraphQuery)services.GetService(typeof(XFileGraphQuery));
}
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
using xDataService.GraphQL;
using xFileService.Models.Entities;
namespace xFileService.DataHelper.GraphQL
{
public class XFileGraphType : XBaseGraphObjectType<XFile, Guid>
{
public XFileGraphType() : base()
{
Field(x => x.Type);
Field(x => x.OwnerId);
Field(x => x.Name);
Field(x => x.Path);
Field(x => x.Thumb);
Field(x => x.ThumbPath);
Field(x => x.UploadedOn);
Field(x => x.FileName);
}
}
}
+8
View File
@@ -0,0 +1,8 @@
using xDataService.Interfaces;
using xFileService.Models.Entities;
namespace xFileService.Interfaces.Entities
{
public interface IXFileEvents : IXBaseRepositoryEvents<XFile>
{ }
}
@@ -0,0 +1,9 @@
using System;
using xDataService.Interfaces;
using xFileService.Models.Entities;
namespace xFileService.Interfaces.Entities
{
public interface IXFileGraphQLTypeHelper: IXBaseGraphQLTypeHelper<XFile, Guid>
{ }
}
+9
View File
@@ -0,0 +1,9 @@
using System;
using xDataService.Interfaces;
using xFileService.Models.Entities;
namespace xFileService.Interfaces.Entities
{
public interface IXFileRepository : IXBaseRepository<XFile, Guid>
{ }
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using xCommons.Constants;
using xModels.Base;
using xModels.Dtos;
namespace xFileService.Models.Dtos
{
public class XFileDto : XBaseDto
{
public Guid Id { get; set; }
public XFileType Type { get; set; }
public string Name { get; set; }
public string Thumb { get; set; }
public string Path { get; set; }
public string ThumbPath { get; set; }
public DateTime UploadedOn { get; set; }
public string FileName { get; set; }
public string OwnerId { get; set; }
public XPersonDto Owner { get; set; }
}
}
+13
View File
@@ -0,0 +1,13 @@
using System.IO;
using xModels.Base;
namespace xFileService.Models.Dtos
{
public class XFileStreamDescriptorDto : XBaseDto
{
public Stream Stream { get; set; }
public string MIMEType { get; set; }
public string Name { get; set; }
public string Path { get; set; }
}
}
+68
View File
@@ -0,0 +1,68 @@
using System;
using System.ComponentModel.DataAnnotations;
using xCommons.Constants;
using xModels.Base;
namespace xFileService.Models.Entities
{
/// <summary>
/// Specified File in Server ...
/// </summary>
public class XFile : XBaseGuidIDEntity
{
/// <summary>
/// Specified File Type ...
/// </summary>
/// <value></value>
public XFileType Type { get; set; }
/// <summary>
/// User Identifier ...
/// </summary>
/// <value></value>
[Required]
[StringLength(255)]
public string OwnerId { get; set; }
/// <summary>
/// File Name on Server ...
/// </summary>
/// <value></value>
[Required]
[StringLength(255)]
public string Name { get; set; }
/// <summary>
/// File Path On Server ...
/// </summary>
/// <value></value>
[Required]
public string Path { get; set; }
/// <summary>
/// Thumbnail FIle Name ...
/// if File Type Supported Thumbnail ...
/// </summary>
/// <value></value>
public string Thumb { get; set; }
/// <summary>
/// Thumbnail File Path ...
/// if File Type Supported Thumbnail ...
/// </summary>
/// <value></value>
public string ThumbPath { get; set; }
/// <summary>
/// File Uploading Time ...
/// </summary>
/// <value></value>
public DateTime UploadedOn { get; set; }
/// <summary>
/// Request For Upload File Name on Client ...
/// </summary>
/// <value></value>
public string FileName { get; set; }
}
}
+2
View File
@@ -24,6 +24,7 @@
<ItemGroup> <ItemGroup>
<!-- <PackageReference Include="xDashboard.xDataService" Version="1.0.0" /> --> <!-- <PackageReference Include="xDashboard.xDataService" Version="1.0.0" /> -->
<!-- <PackageReference Include="xDashboard.xStringService" Version="1.0.0" /> --> <!-- <PackageReference Include="xDashboard.xStringService" Version="1.0.0" /> -->
<!-- <PackageReference Include="xDashboard.xStorageService" Version="1.0.0" /> -->
<!-- <PackageReference Include="xDashboard.xIdentityService" Version="1.0.0" /> --> <!-- <PackageReference Include="xDashboard.xIdentityService" Version="1.0.0" /> -->
</ItemGroup> </ItemGroup>
@@ -32,6 +33,7 @@
<ProjectReference Include="../xPushService/xPushService.csproj" /> <ProjectReference Include="../xPushService/xPushService.csproj" />
<ProjectReference Include="../xIdentityService/xIdentityService.csproj" /> <ProjectReference Include="../xIdentityService/xIdentityService.csproj" />
<ProjectReference Include="../xDataService/xDataService.csproj" /> <ProjectReference Include="../xDataService/xDataService.csproj" />
<ProjectReference Include="../xStorageService/xStorageService.csproj" />
<!-- <!--
<ProjectReference Include="../xStringService/xStringService.csproj" /> <ProjectReference Include="../xStringService/xStringService.csproj" />
--> -->