This commit is contained in:
mmrbnjd
2025-07-12 16:59:25 +03:30
parent ff342a53c0
commit d397f70b9a
9 changed files with 82 additions and 87 deletions

View File

@@ -16,13 +16,14 @@ namespace Hushian.WebApi.Controllers.v1
private readonly ConversationService _conversationService;
private readonly CompanyService _companyService;
private readonly ExperService _experService;
public ConversationController(ConversationService conversationService, CompanyService companyService)
public ConversationController(ConversationService conversationService, CompanyService companyService, ExperService experService)
{
_conversationService = conversationService;
_companyService = companyService;
_experService = experService;
}
[HttpGet("MyConversation")]
[HttpPost("MyConversation")]
[Authorize(Roles = "Company,Exper")]
public async Task<ActionResult> MyConversation(ConversationStatus status)
{

View File

@@ -7,6 +7,7 @@ using Hushian.Application.Services;
using Hushian.Domain.Entites;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.Design;
using System.IdentityModel.Tokens.Jwt;
namespace Hushian.WebApi.Controllers.v1
@@ -16,7 +17,11 @@ namespace Hushian.WebApi.Controllers.v1
public class ExperController : ControllerBase
{
private readonly ExperService _experService;
public ExperController(ExperService experService)
{
_experService = experService;
}
[HttpPost("AddExper")]
[Authorize(Roles = "Company")]
@@ -33,7 +38,7 @@ namespace Hushian.WebApi.Controllers.v1
public async Task<ActionResult> GetExpersCompany(int CompanyID, int PageIndex = 1, int PageSize = 10)
{
var response = await _experService.GetExpersInCompany(CompanyID);
return Ok(response);
return Ok(response);
}
@@ -44,7 +49,7 @@ namespace Hushian.WebApi.Controllers.v1
string strExperID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
int ExperID = Convert.ToInt32(strExperID);
var response = await _experService.UpdateExper(editUser,ExperID);
var response = await _experService.UpdateExper(editUser, ExperID);
return response ? NoContent()
: BadRequest(new List<string> { "یافت نشد" });
}
@@ -56,11 +61,11 @@ namespace Hushian.WebApi.Controllers.v1
int ExperID = Convert.ToInt32(strExperID);
var response = await _experService.GetInfoExper(ExperID);
return response!=null ? Ok(response) : BadRequest(new List<string> { "یافت نشد" });
return response != null ? Ok(response) : BadRequest(new List<string> { "یافت نشد" });
}
[HttpPut("ExperEditingFromManager/{ExperID}")] //ویرایش کارشناس توسط مدیرش
[Authorize(Roles = "Company")]
public async Task<ActionResult> ExperEditingFromManager(int ExperID,[FromBody] Update_ExperDto editUser)
public async Task<ActionResult> ExperEditingFromManager(int ExperID, [FromBody] Update_ExperDto editUser)
{
var response = await _experService.UpdateExper(editUser, ExperID);
return response ? NoContent()
@@ -74,18 +79,18 @@ namespace Hushian.WebApi.Controllers.v1
string strExperID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
int ExperID = Convert.ToInt32(strExperID);
var response = await _experService.ChangePasswordExperFromExper(item,ExperID);
var response = await _experService.ChangePasswordExperFromExper(item, ExperID);
return response.Success && response.Value ? NoContent()
: BadRequest(response.Errors);
}
[HttpPut("ChangePasswordFromManager/{ExperID}")] //تغییر کلمه عبور کارشناس توسط مدیرش
[Authorize(Roles = "Company")]
public async Task<ActionResult> ChangePasswordFromManager(int ExperID,[FromBody] ChangePasswordDto item)
public async Task<ActionResult> ChangePasswordFromManager(int ExperID, [FromBody] ChangePasswordDto item)
{
string strCompanyID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
int CompanyID = Convert.ToInt32(strCompanyID);
var response = await _experService.ChangePasswordExperFromCompanyManaget(item, ExperID,CompanyID);
var response = await _experService.ChangePasswordExperFromCompanyManaget(item, ExperID, CompanyID);
return response.Success && response.Value ? NoContent()
: BadRequest(response.Errors);
}
@@ -97,11 +102,11 @@ namespace Hushian.WebApi.Controllers.v1
int CompanyID = Convert.ToInt32(strCompanyID);
var response = await _experService.ChangeAvailableExper(ExperID,CompanyID,Available);
var response = await _experService.ChangeAvailableExper(ExperID, CompanyID, Available);
return response ? NoContent()
: BadRequest(new List<string> { "یافت نشد"});
: BadRequest(new List<string> { "یافت نشد" });
}
[HttpDelete("DeleteExperFromManager/{ExperID}")]
[HttpDelete("DeleteExperFromManager/{ExperID}")]
[Authorize(Roles = "Company")]
public async Task<ActionResult> DeleteExperFromManager(int ExperID)
{
@@ -113,6 +118,21 @@ namespace Hushian.WebApi.Controllers.v1
return response ? NoContent()
: BadRequest(new List<string> { "یافت نشد" });
}
[HttpGet("CheckAvailableExperInCompany")]
public async Task<ActionResult> CheckAvailableExper(int? ExperID)
{
if (!ExperID.HasValue)
{
string strExperID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
ExperID = Convert.ToInt32(strExperID);
}
var response = await _experService.AvailableExperInCompany(ExperID.GetValueOrDefault());
return response ? NoContent()
: BadRequest();
}
}
}

View File

@@ -15,7 +15,6 @@ namespace Hushian.WebApi.Controllers.v1
_verificationService = verificationService;
}
//------ UserName by Exper - Mobile by Company
[HttpGet("ForgetPassword/{input}")]
public async Task<ActionResult<int>> GetIDAndSendCodeForForgetPasswordByUserID(string input)