From d53caaea6094136bac3d01ce9dd2782bb1819fe2 Mon Sep 17 00:00:00 2001 From: transtrike Date: Thu, 25 Mar 2021 12:22:54 +0200 Subject: Profile Picture implemented; Tests and Front end work await --- .../Interfaces/IProfilePictureService.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs (limited to 'src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs') diff --git a/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs b/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs new file mode 100644 index 0000000..b0673ac --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs @@ -0,0 +1,22 @@ +using System; +using System.Threading.Tasks; +using DevHive.Services.Models.ProfilePicture; + +namespace DevHive.Services.Interfaces +{ + public interface IProfilePictureService + { + Task InsertProfilePicture(ProfilePictureServiceModel profilePictureServiceModel); + + Task GetProfilePictureById(Guid id); + + /// + /// Uploads the given picture and assigns it's link to the user in the database + /// + /// Contains User's Guid and the new picture to be updated + /// The new picture's URL + Task UpdateProfilePicture(ProfilePictureServiceModel profilePictureServiceModel); + + Task DeleteProfilePicture(Guid id); + } +} -- cgit v1.2.3 From 418c04807eae6220ef609a8c208d67c08cf7f723 Mon Sep 17 00:00:00 2001 From: transtrike Date: Sun, 28 Mar 2021 21:58:50 +0300 Subject: Added profile picture documentation --- .../ProfilePictureService.Tests.cs | 9 +++++++++ .../Interfaces/IProfilePictureService.cs | 17 ++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/Services/DevHive.Services.Tests/ProfilePictureService.Tests.cs (limited to 'src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs') diff --git a/src/Services/DevHive.Services.Tests/ProfilePictureService.Tests.cs b/src/Services/DevHive.Services.Tests/ProfilePictureService.Tests.cs new file mode 100644 index 0000000..691b8b5 --- /dev/null +++ b/src/Services/DevHive.Services.Tests/ProfilePictureService.Tests.cs @@ -0,0 +1,9 @@ +using System; + +namespace DevHive.Services.Tests +{ + public class ProfilePictureServiceTests + { + + } +} diff --git a/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs b/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs index b0673ac..c455831 100644 --- a/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs +++ b/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs @@ -6,17 +6,32 @@ namespace DevHive.Services.Interfaces { public interface IProfilePictureService { + /// + /// Inserts a user's profile picture in the database and cloud + /// + /// User's Guid and his/hers profile picture as file + /// The new profile picture's URL in the cloud Task InsertProfilePicture(ProfilePictureServiceModel profilePictureServiceModel); + /// + /// Get a profile picture by it's Guid + /// + /// Profile picture's Guid + /// The profile picture's URL in the cloud Task GetProfilePictureById(Guid id); /// /// Uploads the given picture and assigns it's link to the user in the database /// /// Contains User's Guid and the new picture to be updated - /// The new picture's URL + /// The new profile picture's URL in the cloud Task UpdateProfilePicture(ProfilePictureServiceModel profilePictureServiceModel); + /// + /// Delete a profile picture from the cloud and the database + /// + /// The profile picture's Guid + /// True if the picture is deleted, false otherwise Task DeleteProfilePicture(Guid id); } } -- cgit v1.2.3 From b0c6c6e1795a1cc8fe82a60ce16a263ab4cad397 Mon Sep 17 00:00:00 2001 From: transtrike Date: Fri, 2 Apr 2021 23:53:11 +0300 Subject: ReadProfilePic endpoint implemented --- .../DevHive.Services/Interfaces/IProfilePictureService.cs | 7 ------- .../DevHive.Web/Controllers/ProfilePictureController.cs | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs') diff --git a/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs b/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs index c455831..edf2775 100644 --- a/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs +++ b/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs @@ -6,13 +6,6 @@ namespace DevHive.Services.Interfaces { public interface IProfilePictureService { - /// - /// Inserts a user's profile picture in the database and cloud - /// - /// User's Guid and his/hers profile picture as file - /// The new profile picture's URL in the cloud - Task InsertProfilePicture(ProfilePictureServiceModel profilePictureServiceModel); - /// /// Get a profile picture by it's Guid /// diff --git a/src/Web/DevHive.Web/Controllers/ProfilePictureController.cs b/src/Web/DevHive.Web/Controllers/ProfilePictureController.cs index 1c736f6..9a76e2c 100644 --- a/src/Web/DevHive.Web/Controllers/ProfilePictureController.cs +++ b/src/Web/DevHive.Web/Controllers/ProfilePictureController.cs @@ -28,6 +28,20 @@ namespace DevHive.Web.Controllers this._profilePictureMapper = profilePictureMapper; } + /// + /// Get the URL of user's profile picture + /// + /// The profile picture's Id + /// JWT Bearer Token + /// The URL of the profile picture + [HttpGet] + [AllowAnonymous] + public async Task ReadProfilePicture(Guid profilePictureId, [FromHeader] string authorization) + { + string profilePicURL = await this._profilePictureService.GetProfilePictureById(profilePictureId); + return new OkObjectResult(new { ProfilePictureURL = profilePicURL} ); + } + /// /// Alter the profile picture of a user /// -- cgit v1.2.3