aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-01-29 20:39:07 +0200
committertranstrike <transtrike@gmail.com>2021-01-29 20:39:07 +0200
commitb38d6693476917972345397298b534af2b8b8f78 (patch)
tree5e62376cf693a7233cec4ab341f658be5d9c4ec2 /src/DevHive.Web
parent2417df3ff2939b67695b80905f301ef53c905260 (diff)
downloadDevHive-b38d6693476917972345397298b534af2b8b8f78.tar
DevHive-b38d6693476917972345397298b534af2b8b8f78.tar.gz
DevHive-b38d6693476917972345397298b534af2b8b8f78.zip
File Upload implemented; Post Layers adapted to File Uploading
Diffstat (limited to 'src/DevHive.Web')
-rw-r--r--src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs8
-rw-r--r--src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs4
-rw-r--r--src/DevHive.Web/Models/Post/Post/ReadPostWebModel.cs3
-rw-r--r--src/DevHive.Web/Models/Post/Post/UpdatePostWebModel.cs4
-rw-r--r--src/DevHive.Web/Startup.cs2
-rw-r--r--src/DevHive.Web/appsettings.json7
6 files changed, 23 insertions, 5 deletions
diff --git a/src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs b/src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs
index d7c859e..fe2c788 100644
--- a/src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs
+++ b/src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs
@@ -3,13 +3,14 @@ using DevHive.Data.Models;
using DevHive.Data.Repositories;
using DevHive.Services.Interfaces;
using DevHive.Services.Services;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace DevHive.Web.Configurations.Extensions
{
public static class ConfigureDependencyInjection
{
- public static void DependencyInjectionConfiguration(this IServiceCollection services)
+ public static void DependencyInjectionConfiguration(this IServiceCollection services, IConfiguration configuration)
{
services.AddTransient<ILanguageRepository, LanguageRepository>();
services.AddTransient<IRoleRepository, RoleRepository>();
@@ -25,6 +26,11 @@ namespace DevHive.Web.Configurations.Extensions
services.AddTransient<IUserService, UserService>();
services.AddTransient<IPostService, PostService>();
services.AddTransient<IFeedService, FeedService>();
+ services.AddTransient<ICloudService, CloudinaryService>(options =>
+ new CloudinaryService(
+ cloudName: configuration.GetSection("Cloud").GetSection("cloudName").Value,
+ apiKey: configuration.GetSection("Cloud").GetSection("apiKey").Value,
+ apiSecret: configuration.GetSection("Cloud").GetSection("apiSecret").Value));
}
}
}
diff --git a/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs b/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs
index b7b4cf4..e35a813 100644
--- a/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs
+++ b/src/DevHive.Web/Models/Post/Post/CreatePostWebModel.cs
@@ -1,6 +1,8 @@
using System;
+using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
+using Microsoft.AspNetCore.Http;
namespace DevHive.Web.Models.Post.Post
{
@@ -10,6 +12,6 @@ namespace DevHive.Web.Models.Post.Post
[Required]
public string Message { get; set; }
- // public List<IFormFile> Files { get; set; }
+ public List<IFormFile> Files { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Post/Post/ReadPostWebModel.cs b/src/DevHive.Web/Models/Post/Post/ReadPostWebModel.cs
index 04c6275..5d4da31 100644
--- a/src/DevHive.Web/Models/Post/Post/ReadPostWebModel.cs
+++ b/src/DevHive.Web/Models/Post/Post/ReadPostWebModel.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using DevHive.Web.Models.Post.Comment;
+using Microsoft.AspNetCore.Http;
namespace DevHive.Web.Models.Post.Post
{
@@ -20,6 +21,6 @@ namespace DevHive.Web.Models.Post.Post
public List<ReadCommentWebModel> Comments { get; set; }
- //public Files[] Files { get; set; }
+ public List<IFormFile> Files { get; set; }
}
}
diff --git a/src/DevHive.Web/Models/Post/Post/UpdatePostWebModel.cs b/src/DevHive.Web/Models/Post/Post/UpdatePostWebModel.cs
index 685f08b..ac84d2c 100644
--- a/src/DevHive.Web/Models/Post/Post/UpdatePostWebModel.cs
+++ b/src/DevHive.Web/Models/Post/Post/UpdatePostWebModel.cs
@@ -1,6 +1,8 @@
using System;
+using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
+using Microsoft.AspNetCore.Http;
namespace DevHive.Web.Models.Post.Post
{
@@ -13,5 +15,7 @@ namespace DevHive.Web.Models.Post.Post
[NotNull]
[Required]
public string NewMessage { get; set; }
+
+ public List<IFormFile> Files { get; set; } = new();
}
}
diff --git a/src/DevHive.Web/Startup.cs b/src/DevHive.Web/Startup.cs
index 92d4359..dd7e852 100644
--- a/src/DevHive.Web/Startup.cs
+++ b/src/DevHive.Web/Startup.cs
@@ -32,7 +32,7 @@ namespace DevHive.Web
services.SwaggerConfiguration();
services.JWTConfiguration(Configuration);
services.AutoMapperConfiguration();
- services.DependencyInjectionConfiguration();
+ services.DependencyInjectionConfiguration(this.Configuration);
services.ExceptionHandlerMiddlewareConfiguration();
}
diff --git a/src/DevHive.Web/appsettings.json b/src/DevHive.Web/appsettings.json
index 83932a7..bcdcae7 100644
--- a/src/DevHive.Web/appsettings.json
+++ b/src/DevHive.Web/appsettings.json
@@ -4,7 +4,12 @@
},
"ConnectionStrings": {
"DEV": "Server=localhost;Port=5432;Database=API;User Id=postgres;Password=;"
- },
+ },
+ "Cloud": {
+ "cloudName": "devhive",
+ "apiKey": "488664116365813",
+ "apiSecret": ""
+ },
"Logging": {
"LogLevel": {
"Default": "Information",