diff --git a/.gitignore b/.gitignore index e69de29..1746e32 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +bin +obj diff --git a/DataHelper/Events/XFileEvents.cs b/DataHelper/Events/XFileEvents.cs new file mode 100644 index 0000000..83faf48 --- /dev/null +++ b/DataHelper/Events/XFileEvents.cs @@ -0,0 +1,9 @@ +using xDataService.Events; +using xFileService.Interfaces.Entities; +using xFileService.Models.Entities; + +namespace xFileService.DataHelper.Events +{ + public class XFileEvents : XBaseRepositoryEvents, IXFileEvents + { } +} \ No newline at end of file diff --git a/DataHelper/GraphQL/XFileGraphQLTypeHelper.cs b/DataHelper/GraphQL/XFileGraphQLTypeHelper.cs new file mode 100644 index 0000000..1a7122c --- /dev/null +++ b/DataHelper/GraphQL/XFileGraphQLTypeHelper.cs @@ -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, IXFileGraphQLTypeHelper + { + public XFileGraphQLTypeHelper( + XDataServiceConfiguration configuration + ) : base(configuration) + { } + + public override string GetInQueryCollectionName() + { + return "files"; + } + + public override string GetInQuerySingleName() + { + return "file"; + } + } +} \ No newline at end of file diff --git a/DataHelper/GraphQL/XFileGraphQuery.cs b/DataHelper/GraphQL/XFileGraphQuery.cs new file mode 100644 index 0000000..e89f05e --- /dev/null +++ b/DataHelper/GraphQL/XFileGraphQuery.cs @@ -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 + { + public XFileGraphQuery( + XDataServiceConfiguration configuration, + IXFileRepository repository, + IXFileGraphQLTypeHelper helper + ) : base( + configuration, + repository, + helper + ) + { } + } +} \ No newline at end of file diff --git a/DataHelper/GraphQL/XFileGraphSchema.cs b/DataHelper/GraphQL/XFileGraphSchema.cs new file mode 100644 index 0000000..8231c53 --- /dev/null +++ b/DataHelper/GraphQL/XFileGraphSchema.cs @@ -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)); + } + } +} \ No newline at end of file diff --git a/DataHelper/GraphQL/XFileGraphType.cs b/DataHelper/GraphQL/XFileGraphType.cs new file mode 100644 index 0000000..7d81a9a --- /dev/null +++ b/DataHelper/GraphQL/XFileGraphType.cs @@ -0,0 +1,21 @@ +using System; +using xDataService.GraphQL; +using xFileService.Models.Entities; + +namespace xFileService.DataHelper.GraphQL +{ + public class XFileGraphType : XBaseGraphObjectType + { + 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); + } + } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXFileEvents.cs b/Interfaces/Entities/IXFileEvents.cs new file mode 100644 index 0000000..923d3d8 --- /dev/null +++ b/Interfaces/Entities/IXFileEvents.cs @@ -0,0 +1,8 @@ +using xDataService.Interfaces; +using xFileService.Models.Entities; + +namespace xFileService.Interfaces.Entities +{ + public interface IXFileEvents : IXBaseRepositoryEvents + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXFileGraphQLTypeHelper.cs b/Interfaces/Entities/IXFileGraphQLTypeHelper.cs new file mode 100644 index 0000000..119d220 --- /dev/null +++ b/Interfaces/Entities/IXFileGraphQLTypeHelper.cs @@ -0,0 +1,9 @@ +using System; +using xDataService.Interfaces; +using xFileService.Models.Entities; + +namespace xFileService.Interfaces.Entities +{ + public interface IXFileGraphQLTypeHelper: IXBaseGraphQLTypeHelper + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXFileRepository.cs b/Interfaces/Entities/IXFileRepository.cs new file mode 100644 index 0000000..afdc137 --- /dev/null +++ b/Interfaces/Entities/IXFileRepository.cs @@ -0,0 +1,9 @@ +using System; +using xDataService.Interfaces; +using xFileService.Models.Entities; + +namespace xFileService.Interfaces.Entities +{ + public interface IXFileRepository : IXBaseRepository + { } +} \ No newline at end of file diff --git a/Models/Dtos/XFileDto.cs b/Models/Dtos/XFileDto.cs new file mode 100644 index 0000000..de112ef --- /dev/null +++ b/Models/Dtos/XFileDto.cs @@ -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; } + } +} \ No newline at end of file diff --git a/Models/Dtos/XFileStreamDescriptorDto.cs b/Models/Dtos/XFileStreamDescriptorDto.cs new file mode 100644 index 0000000..a68d92f --- /dev/null +++ b/Models/Dtos/XFileStreamDescriptorDto.cs @@ -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; } + } +} \ No newline at end of file diff --git a/Models/Entities/XFile.cs b/Models/Entities/XFile.cs new file mode 100644 index 0000000..5ca1dbd --- /dev/null +++ b/Models/Entities/XFile.cs @@ -0,0 +1,68 @@ +using System; +using System.ComponentModel.DataAnnotations; +using xCommons.Constants; +using xModels.Base; + +namespace xFileService.Models.Entities +{ + /// + /// Specified File in Server ... + /// + public class XFile : XBaseGuidIDEntity + { + /// + /// Specified File Type ... + /// + /// + public XFileType Type { get; set; } + + /// + /// User Identifier ... + /// + /// + [Required] + [StringLength(255)] + public string OwnerId { get; set; } + + /// + /// File Name on Server ... + /// + /// + [Required] + [StringLength(255)] + public string Name { get; set; } + + /// + /// File Path On Server ... + /// + /// + [Required] + public string Path { get; set; } + + /// + /// Thumbnail FIle Name ... + /// if File Type Supported Thumbnail ... + /// + /// + public string Thumb { get; set; } + + /// + /// Thumbnail File Path ... + /// if File Type Supported Thumbnail ... + /// + /// + public string ThumbPath { get; set; } + + /// + /// File Uploading Time ... + /// + /// + public DateTime UploadedOn { get; set; } + + /// + /// Request For Upload File Name on Client ... + /// + /// + public string FileName { get; set; } + } +} \ No newline at end of file diff --git a/xFileService.csproj b/xFileService.csproj index 71e330c..aa893da 100644 --- a/xFileService.csproj +++ b/xFileService.csproj @@ -24,6 +24,7 @@ + @@ -32,6 +33,7 @@ +