...
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
using Common.Models.Auth;
|
||||
using Common.Models.Auth.CompanySide;
|
||||
using Common.Models.Auth.UserSide;
|
||||
using Common.Validation;
|
||||
using Hushian.Application.Constants;
|
||||
using Hushian.Application.Contracts.Persistence;
|
||||
using Hushian.Application.Models;
|
||||
using Hushian.Application.Validation;
|
||||
using Hushian.Domain.Entites;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
@@ -1,18 +1,11 @@
|
||||
using AutoMapper;
|
||||
using Common.Dtos;
|
||||
using Common.Dtos.Company;
|
||||
using Common.Dtos.Exper;
|
||||
using Common.Validation;
|
||||
using Hushian.Application.Contracts.Persistence;
|
||||
using Hushian.Application.Models;
|
||||
using Hushian.Application.Validation;
|
||||
using Hushian.Domain.Entites;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hushian.Application.Services
|
||||
{
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using AutoMapper;
|
||||
using Common.Dtos.Conversation;
|
||||
using Common.Dtos.Conversation;
|
||||
using Common.Enums;
|
||||
using Hushian.Application.Contracts.Persistence;
|
||||
using Hushian.Application.Models;
|
||||
@@ -7,12 +6,6 @@ using Hushian.Domain.Entites;
|
||||
using Hushian.WebApi;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hushian.Application.Services
|
||||
{
|
||||
@@ -149,7 +142,7 @@ namespace Hushian.Application.Services
|
||||
UserFullName = s.User.FullName
|
||||
|
||||
}).ToListAsync();
|
||||
public async Task<List<Read_ConversationResponseDto>> GetConversationItems(int ConversationID, int? ExperID)
|
||||
public async Task<List<Read_ConversationResponseDto>> GetConversationItems(int ConversationID)
|
||||
{
|
||||
return await _ConversationResponseRepository.Get()
|
||||
.Include(inc=>inc.Exper)
|
||||
|
@@ -3,15 +3,9 @@ using Common.Dtos;
|
||||
using Common.Dtos.Exper;
|
||||
using Hushian.Application.Contracts.Persistence;
|
||||
using Hushian.Application.Models;
|
||||
using Hushian.Application.Validation;
|
||||
using Common.Validation;
|
||||
using Hushian.Domain.Entites;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hushian.Application.Services
|
||||
{
|
||||
|
@@ -3,14 +3,9 @@ using Common.Dtos.Exper;
|
||||
using Common.Dtos.Group;
|
||||
using Hushian.Application.Contracts.Persistence;
|
||||
using Hushian.Application.Models;
|
||||
using Hushian.Application.Validation;
|
||||
using Common.Validation;
|
||||
using Hushian.Domain.Entites;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hushian.Application.Services
|
||||
{
|
||||
|
@@ -4,17 +4,13 @@ using Common.Enums;
|
||||
using Common.Models.Auth;
|
||||
using Hushian.Application.Contracts.Persistence;
|
||||
using Hushian.Application.Models;
|
||||
using Hushian.Application.Validation;
|
||||
using Common.Validation;
|
||||
using Hushian.Domain.Entites;
|
||||
using Identity.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hushian.Application.Services
|
||||
{
|
||||
|
@@ -1,70 +0,0 @@
|
||||
using System.Text.RegularExpressions;
|
||||
namespace Hushian.Application.Validation
|
||||
{
|
||||
public static class FixedValidation
|
||||
{
|
||||
public static bool CheckLawPassword(this string password, ref List<string> errors)
|
||||
{
|
||||
bool ret = true;
|
||||
if (password.Length != 6)
|
||||
{
|
||||
errors.Add("کلمه عبور باید حداقل 6 گاراکتر باشد");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
// بررسی شامل بودن حداقل یک حرف
|
||||
if (!Regex.IsMatch(password, "[a-zA-Z]"))
|
||||
{
|
||||
errors.Add("کلمه عبور باید حداقل شامل یک حرف انگلیسی بزرگ یا کوچک باشد");
|
||||
|
||||
ret = false;
|
||||
}
|
||||
// بررسی شامل بودن حداقل یک عدد
|
||||
if (!Regex.IsMatch(password, "[0-9]"))
|
||||
{
|
||||
errors.Add("کلمه عبور باید حداقل شامل یک عدد باشد");
|
||||
ret = false;
|
||||
}
|
||||
// بررسی اینکه فقط حروف و اعداد انگلیسی باشد
|
||||
if(Regex.IsMatch(password, "^[a-zA-Z0-9]+$"))
|
||||
{
|
||||
errors.Add("کلمه عبور فقط عدد و حروف انگلیسی مجاز است");
|
||||
ret = false;
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
public static bool CheckUsername(this string Username)
|
||||
=> (Username.Length == 11 && Username.StartsWith("09"))
|
||||
|| (Username.Length == 9 && Username.StartsWith("E/"));
|
||||
public static bool CheckMobile(this string Mobile) => Mobile.Length == 11 && Mobile.StartsWith("09");
|
||||
public static bool IsValidEmail(this string email)
|
||||
{
|
||||
// الگوی ساده اما معتبر برای بررسی ایمیل
|
||||
string pattern = @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$";
|
||||
|
||||
return Regex.IsMatch(email, pattern);
|
||||
}
|
||||
public static bool IsOnlyPersianLetters(this string input)
|
||||
{
|
||||
// این الگو فقط اجازه حروف فارسی میدهد
|
||||
string pattern = @"^[\u0600-\u06FF\s]+$";
|
||||
|
||||
return Regex.IsMatch(input, pattern);
|
||||
}
|
||||
public static bool IsValidWebsite(this string url)
|
||||
{
|
||||
// پروتکل اختیاری است، فقط باید دامنه درست باشد
|
||||
string pattern = @"^(https?:\/\/)?(www\.)?[a-zA-Z0-9\-]+\.[a-zA-Z]{2,}(\S*)?$";
|
||||
return Regex.IsMatch(url, pattern);
|
||||
}
|
||||
public static bool IsValidImage(this byte[] imageData, int maxSizeInBytes = 5 * 1024 * 1024)
|
||||
{
|
||||
// بررسی خالی بودن یا حجم بیش از حد
|
||||
return imageData.Length <= maxSizeInBytes;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user