diff options
| author | Kamen Mladenov <kamen.d.mladenov@protonmail.com> | 2021-04-09 19:51:35 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-09 19:51:35 +0300 |
| commit | 233f38915ba0079079233eff55434ef349c05c45 (patch) | |
| tree | 6c5f69017865bcab87355e910c87339453da1406 /src/Services/DevHive.Services/Interfaces | |
| parent | f4a70c6430db923af9fa9958a11c2d6612cb52cc (diff) | |
| parent | a992357efcf1bc1ece81b95ecee5e05a0b73bfdc (diff) | |
| download | DevHive-heroku/main.tar DevHive-heroku/main.tar.gz DevHive-heroku/main.zip | |
Merge pull request #28 from Team-Kaleidoscope/devHEADv0.2mainheroku/main
Second stage: Complete
Diffstat (limited to 'src/Services/DevHive.Services/Interfaces')
11 files changed, 243 insertions, 0 deletions
diff --git a/src/Services/DevHive.Services/Interfaces/ICloudService.cs b/src/Services/DevHive.Services/Interfaces/ICloudService.cs new file mode 100644 index 0000000..040729f --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/ICloudService.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace DevHive.Services.Interfaces +{ + public interface ICloudService + { + Task<List<string>> UploadFilesToCloud(List<IFormFile> formFiles); + + Task<bool> RemoveFilesFromCloud(List<string> fileUrls); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/ICommentService.cs b/src/Services/DevHive.Services/Interfaces/ICommentService.cs new file mode 100644 index 0000000..6d92a5d --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/ICommentService.cs @@ -0,0 +1,20 @@ +using System; +using System.Threading.Tasks; +using DevHive.Services.Models.Comment; + +namespace DevHive.Services.Interfaces +{ + public interface ICommentService + { + Task<Guid> AddComment(CreateCommentServiceModel createCommentServiceModel); + + Task<ReadCommentServiceModel> GetCommentById(Guid id); + + Task<Guid> UpdateComment(UpdateCommentServiceModel updateCommentServiceModel); + + Task<bool> DeleteComment(Guid id); + + Task<bool> ValidateJwtForCreating(Guid userId, string rawTokenData); + Task<bool> ValidateJwtForComment(Guid commentId, string rawTokenData); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/IFeedService.cs b/src/Services/DevHive.Services/Interfaces/IFeedService.cs new file mode 100644 index 0000000..b507b3b --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/IFeedService.cs @@ -0,0 +1,11 @@ +using System.Threading.Tasks; +using DevHive.Services.Models; + +namespace DevHive.Services.Interfaces +{ + public interface IFeedService + { + Task<ReadPageServiceModel> GetPage(GetPageServiceModel getPageServiceModel); + Task<ReadPageServiceModel> GetUserPage(GetPageServiceModel model); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/IFriendsService.cs b/src/Services/DevHive.Services/Interfaces/IFriendsService.cs new file mode 100644 index 0000000..52f23f3 --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/IFriendsService.cs @@ -0,0 +1,11 @@ +using System; +using System.Threading.Tasks; + +namespace DevHive.Services.Interfaces +{ + public interface IFriendsService + { + Task<bool> AddFriend(Guid userId, string friendUsername); + Task<bool> RemoveFriend(Guid userId, string friendUsername); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/ILanguageService.cs b/src/Services/DevHive.Services/Interfaces/ILanguageService.cs new file mode 100644 index 0000000..fabbec2 --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/ILanguageService.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using DevHive.Services.Models.Language; + +namespace DevHive.Services.Interfaces +{ + public interface ILanguageService + { + Task<Guid> CreateLanguage(CreateLanguageServiceModel createLanguageServiceModel); + + Task<ReadLanguageServiceModel> GetLanguageById(Guid id); + HashSet<ReadLanguageServiceModel> GetLanguages(); + + Task<bool> UpdateLanguage(UpdateLanguageServiceModel languageServiceModel); + + Task<bool> DeleteLanguage(Guid id); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/IPostService.cs b/src/Services/DevHive.Services/Interfaces/IPostService.cs new file mode 100644 index 0000000..5ccecff --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/IPostService.cs @@ -0,0 +1,20 @@ +using System; +using System.Threading.Tasks; +using DevHive.Services.Models.Post; + +namespace DevHive.Services.Interfaces +{ + public interface IPostService + { + Task<Guid> CreatePost(CreatePostServiceModel createPostServiceModel); + + Task<ReadPostServiceModel> GetPostById(Guid id); + + Task<Guid> UpdatePost(UpdatePostServiceModel updatePostServiceModel); + + Task<bool> DeletePost(Guid id); + + Task<bool> ValidateJwtForCreating(Guid userId, string rawTokenData); + Task<bool> ValidateJwtForPost(Guid postId, string rawTokenData); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs b/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs new file mode 100644 index 0000000..edf2775 --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/IProfilePictureService.cs @@ -0,0 +1,30 @@ +using System; +using System.Threading.Tasks; +using DevHive.Services.Models.ProfilePicture; + +namespace DevHive.Services.Interfaces +{ + public interface IProfilePictureService + { + /// <summary> + /// Get a profile picture by it's Guid + /// </summary> + /// <param name="id">Profile picture's Guid</param> + /// <returns>The profile picture's URL in the cloud</returns> + Task<string> GetProfilePictureById(Guid id); + + /// <summary> + /// Uploads the given picture and assigns it's link to the user in the database + /// </summary> + /// <param name="profilePictureServiceModel">Contains User's Guid and the new picture to be updated</param> + /// <returns>The new profile picture's URL in the cloud</returns> + Task<string> UpdateProfilePicture(ProfilePictureServiceModel profilePictureServiceModel); + + /// <summary> + /// Delete a profile picture from the cloud and the database + /// </summary> + /// <param name="id">The profile picture's Guid</param> + /// <returns>True if the picture is deleted, false otherwise</returns> + Task<bool> DeleteProfilePicture(Guid id); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/IRatingService.cs b/src/Services/DevHive.Services/Interfaces/IRatingService.cs new file mode 100644 index 0000000..be33300 --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/IRatingService.cs @@ -0,0 +1,20 @@ +using System; +using System.Threading.Tasks; +using DevHive.Data.Models; +using DevHive.Services.Models.Rating; + +namespace DevHive.Services.Interfaces +{ + public interface IRatingService + { + Task<Guid> RatePost(CreateRatingServiceModel createRatingServiceModel); + + Task<ReadRatingServiceModel> GetRatingById(Guid ratingId); + Task<ReadRatingServiceModel> GetRatingByPostAndUser(Guid userId, Guid postId); + + + Task<ReadRatingServiceModel> UpdateRating(UpdateRatingServiceModel updateRatingServiceModel); + + Task<bool> DeleteRating(Guid ratingId); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/IRoleService.cs b/src/Services/DevHive.Services/Interfaces/IRoleService.cs new file mode 100644 index 0000000..36e5a01 --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/IRoleService.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading.Tasks; +using DevHive.Services.Models.Role; + +namespace DevHive.Services.Interfaces +{ + public interface IRoleService + { + Task<Guid> CreateRole(CreateRoleServiceModel createRoleServiceModel); + + Task<RoleServiceModel> GetRoleById(Guid id); + + Task<bool> UpdateRole(UpdateRoleServiceModel updateRoleServiceModel); + + Task<bool> DeleteRole(Guid id); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/ITechnologyService.cs b/src/Services/DevHive.Services/Interfaces/ITechnologyService.cs new file mode 100644 index 0000000..8f9510c --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/ITechnologyService.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using DevHive.Services.Models.Technology; + +namespace DevHive.Services.Interfaces +{ + public interface ITechnologyService + { + Task<Guid> CreateTechnology(CreateTechnologyServiceModel technologyServiceModel); + + Task<ReadTechnologyServiceModel> GetTechnologyById(Guid id); + HashSet<ReadTechnologyServiceModel> GetTechnologies(); + + Task<bool> UpdateTechnology(UpdateTechnologyServiceModel updateTechnologyServiceModel); + + Task<bool> DeleteTechnology(Guid id); + } +} diff --git a/src/Services/DevHive.Services/Interfaces/IUserService.cs b/src/Services/DevHive.Services/Interfaces/IUserService.cs new file mode 100644 index 0000000..da07507 --- /dev/null +++ b/src/Services/DevHive.Services/Interfaces/IUserService.cs @@ -0,0 +1,62 @@ +using System; +using System.Threading.Tasks; +using DevHive.Common.Models.Identity; +using DevHive.Services.Models.User; + +namespace DevHive.Services.Interfaces +{ + public interface IUserService + { + /// <summary> + /// Log ins an existing user and gives him/her a JWT Token for further authorization + /// </summary> + /// <param name="loginModel">Login service model, conaining user's username and password</param> + /// <returns>A JWT Token for authorization</returns> + Task<TokenModel> LoginUser(LoginServiceModel loginModel); + + /// <summary> + /// Registers a new user and gives him/her a JWT Token for further authorization + /// </summary> + /// <param name="registerModel">Register service model, containing the new user's data</param> + /// <returns>A JWT Token for authorization</returns> + Task<TokenModel> RegisterUser(RegisterServiceModel registerModel); + + /// <summary> + /// Get a user by his username. Used for querying profiles without provided authentication + /// </summary> + /// <param name="username">User's username, who's to be queried</param> + /// <returns>The queried user or null, if non existant</returns> + Task<UserServiceModel> GetUserByUsername(string username); + + /// <summary> + /// Get a user by his Guid. Used for querying full user's profile + /// Requires authenticated user + /// </summary> + /// <param name="id">User's username, who's to be queried</param> + /// <returns>The queried user or null, if non existant</returns> + Task<UserServiceModel> GetUserById(Guid id); + + /// <summary> + /// Updates a user's data, provided a full model with new details + /// Requires authenticated user + /// </summary> + /// <param name="updateUserServiceModel">Full update user model for updating</param> + /// <returns>Read model of the new user</returns> + Task<UserServiceModel> UpdateUser(UpdateUserServiceModel updateUserServiceModel); + + /// <summary> + /// Deletes a user from the database and removes his data entirely + /// Requires authenticated user + /// </summary> + /// <param name="id">The user's Guid, who's to be deleted</param> + /// <returns>True if successfull, false otherwise</returns> + Task<bool> DeleteUser(Guid id); + + /// <summary> + /// We don't talk about that! + /// </summary> + /// <param name="userId"></param> + /// <returns></returns> + Task<TokenModel> SuperSecretPromotionToAdmin(Guid userId); + } +} |
