#99 moving user public profile api to RMuseum
This commit is contained in:
parent
e1cb37487e
commit
28f057325a
@ -1,11 +1,9 @@
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RSecurityBackend.Services;
|
||||
using RSecurityBackend.Controllers;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Audit.WebApi;
|
||||
|
||||
namespace RMuseum.Controllers
|
||||
{
|
||||
@ -30,11 +28,11 @@ namespace RMuseum.Controllers
|
||||
: base(configuration, appUserService, httpContextAccessor, userPermissionChecker, emailSender, imageFileService, captchaService)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sign Up Email Subject
|
||||
@ -197,5 +195,6 @@ namespace RMuseum.Controllers
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,11 +3,13 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using RMuseum.Models.Auth.Memory;
|
||||
using RMuseum.Models.Auth.ViewModel;
|
||||
using RMuseum.Models.Ganjoor;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
using RMuseum.Models.GanjoorAudio.ViewModels;
|
||||
using RMuseum.Models.GanjoorIntegration.ViewModels;
|
||||
using RMuseum.Services;
|
||||
using RSecurityBackend.Models.Auth.ViewModels;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using RSecurityBackend.Models.Image;
|
||||
using RSecurityBackend.Services;
|
||||
@ -793,6 +795,40 @@ namespace RMuseum.Controllers
|
||||
return BadRequest(res.ExceptionString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get user public profile
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("user/profile/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(GanjoorUserPublicProfile))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||
public async Task<IActionResult> GetUserPublicProfile(Guid id)
|
||||
{
|
||||
RServiceResult<PublicRAppUser> userInfo = await _appUserService.GetUserInformation(id);
|
||||
if (userInfo.Result == null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(userInfo.ExceptionString))
|
||||
return NotFound();
|
||||
return BadRequest(userInfo.ExceptionString);
|
||||
}
|
||||
return Ok
|
||||
(
|
||||
new GanjoorUserPublicProfile()
|
||||
{
|
||||
Id = id,
|
||||
FirstName = userInfo.Result.FirstName,
|
||||
SureName = userInfo.Result.SureName,
|
||||
NickName = userInfo.Result.NickName,
|
||||
Bio = userInfo.Result.Bio,
|
||||
Website = userInfo.Result.Website,
|
||||
RImageId = userInfo.Result.RImageId
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get Verses By query
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace RSecurityBackend.Models.Auth.ViewModels
|
||||
namespace RMuseum.Models.Auth.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// user public profile
|
||||
/// ganjoor user public profile
|
||||
/// </summary>
|
||||
public class RUserPublicProfile
|
||||
public class GanjoorUserPublicProfile
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
@ -48,5 +48,6 @@ namespace RSecurityBackend.Models.Auth.ViewModels
|
||||
/// web site
|
||||
/// </summary>
|
||||
public string Website { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -842,6 +842,13 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetUserPublicProfile(System.Guid)">
|
||||
<summary>
|
||||
Get user public profile
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetVersesByQuery(System.String,System.Int32,RSecurityBackend.Models.Generic.PagingParameterModel)">
|
||||
<summary>
|
||||
Get Verses By query
|
||||
@ -2149,6 +2156,52 @@
|
||||
list of forms and their permissions
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.Auth.ViewModel.GanjoorUserPublicProfile">
|
||||
<summary>
|
||||
ganjoor user public profile
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Auth.ViewModel.GanjoorUserPublicProfile.Id">
|
||||
<summary>
|
||||
Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Auth.ViewModel.GanjoorUserPublicProfile.FirstName">
|
||||
<summary>
|
||||
First Name
|
||||
</summary>
|
||||
<example>
|
||||
Hamid Reza
|
||||
</example>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Auth.ViewModel.GanjoorUserPublicProfile.SureName">
|
||||
<summary>
|
||||
Sure Name
|
||||
</summary>
|
||||
<example>
|
||||
Mohammadi
|
||||
</example>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Auth.ViewModel.GanjoorUserPublicProfile.RImageId">
|
||||
<summary>
|
||||
user image
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Auth.ViewModel.GanjoorUserPublicProfile.NickName">
|
||||
<summary>
|
||||
nick name
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Auth.ViewModel.GanjoorUserPublicProfile.Bio">
|
||||
<summary>
|
||||
biography
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Auth.ViewModel.GanjoorUserPublicProfile.Website">
|
||||
<summary>
|
||||
web site
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.Bookmark.RBookmarkType">
|
||||
<summary>
|
||||
Bookmark Type
|
||||
|
||||
@ -254,44 +254,6 @@ namespace RSecurityBackend.Controllers
|
||||
return Ok(userInfo.Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get user public profile
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("profile/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(RUserPublicProfile))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||
[ProducesResponseType((int)HttpStatusCode.Forbidden)]
|
||||
public async Task<IActionResult> GetUserPublicProfile(Guid id)
|
||||
{
|
||||
RServiceResult<PublicRAppUser> userInfo = await _appUserService.GetUserInformation(id);
|
||||
if (userInfo.Result == null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(userInfo.ExceptionString))
|
||||
return NotFound();
|
||||
return BadRequest(userInfo.ExceptionString);
|
||||
}
|
||||
return Ok
|
||||
(
|
||||
new RUserPublicProfile()
|
||||
{
|
||||
Id = id,
|
||||
FirstName = userInfo.Result.FirstName,
|
||||
SureName = userInfo.Result.SureName,
|
||||
NickName = userInfo.Result.NickName,
|
||||
Bio = userInfo.Result.Bio,
|
||||
Website = userInfo.Result.Website,
|
||||
RImageId = userInfo.Result.RImageId
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// add a new user (if you are trying to add an admin user you yourself should be admin)
|
||||
/// </summary>
|
||||
|
||||
@ -116,13 +116,6 @@
|
||||
<param name="id">user id</param>
|
||||
<returns>user information</returns>
|
||||
</member>
|
||||
<member name="M:RSecurityBackend.Controllers.AppUserControllerBase.GetUserPublicProfile(System.Guid)">
|
||||
<summary>
|
||||
Get user public profile
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RSecurityBackend.Controllers.AppUserControllerBase.Post(RSecurityBackend.Models.Auth.ViewModels.RegisterRAppUser)">
|
||||
<summary>
|
||||
add a new user (if you are trying to add an admin user you yourself should be admin)
|
||||
@ -1400,52 +1393,6 @@
|
||||
Test!123
|
||||
</example>
|
||||
</member>
|
||||
<member name="T:RSecurityBackend.Models.Auth.ViewModels.RUserPublicProfile">
|
||||
<summary>
|
||||
user public profile
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RSecurityBackend.Models.Auth.ViewModels.RUserPublicProfile.Id">
|
||||
<summary>
|
||||
Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RSecurityBackend.Models.Auth.ViewModels.RUserPublicProfile.FirstName">
|
||||
<summary>
|
||||
First Name
|
||||
</summary>
|
||||
<example>
|
||||
Hamid Reza
|
||||
</example>
|
||||
</member>
|
||||
<member name="P:RSecurityBackend.Models.Auth.ViewModels.RUserPublicProfile.SureName">
|
||||
<summary>
|
||||
Sure Name
|
||||
</summary>
|
||||
<example>
|
||||
Mohammadi
|
||||
</example>
|
||||
</member>
|
||||
<member name="P:RSecurityBackend.Models.Auth.ViewModels.RUserPublicProfile.RImageId">
|
||||
<summary>
|
||||
user image
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RSecurityBackend.Models.Auth.ViewModels.RUserPublicProfile.NickName">
|
||||
<summary>
|
||||
nick name
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RSecurityBackend.Models.Auth.ViewModels.RUserPublicProfile.Bio">
|
||||
<summary>
|
||||
biography
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RSecurityBackend.Models.Auth.ViewModels.RUserPublicProfile.Website">
|
||||
<summary>
|
||||
web site
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RSecurityBackend.Models.Auth.ViewModels.SetPasswordModel">
|
||||
<summary>
|
||||
set password model
|
||||
|
||||
@ -342,6 +342,8 @@ namespace RSecurityBackend.Services.Implementation
|
||||
{
|
||||
RAppUser appUser =
|
||||
await _userManager.Users.Where(u => u.Id == userId).SingleOrDefaultAsync();
|
||||
if (appUser == null)
|
||||
return new RServiceResult<PublicRAppUser>(null);
|
||||
return new RServiceResult<PublicRAppUser>(
|
||||
new PublicRAppUser()
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user