-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added search, fixed refresh token not saving for google oAuth etc
- Loading branch information
1 parent
cca560d
commit 33c8012
Showing
19 changed files
with
188 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using MyServe.Backend.Common.Constants; | ||
|
||
namespace MyServe.Backend.App.Application.Dto.Me; | ||
|
||
public class SearchDto | ||
{ | ||
public Guid Id { get; set; } | ||
public string Name { get; set; } | ||
public string Description { get; set; } | ||
public string Service { get; set; } | ||
public Dictionary<string, string?> Metadata { get; set; } = new(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
MyServe.Backend.App.Application/Features/Profile/Search/MeSearchQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using MyServe.Backend.App.Application.Abstract; | ||
|
||
namespace MyServe.Backend.App.Application.Features.Profile.Search; | ||
|
||
public class MeSearchQuery : IAppRequest<MeSearchResponse> | ||
{ | ||
public Guid UserId { get; set; } | ||
|
||
public string Search { get; set; } | ||
} |
29 changes: 29 additions & 0 deletions
29
MyServe.Backend.App.Application/Features/Profile/Search/MeSearchQueryHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using MediatR; | ||
using MyServe.Backend.App.Application.Services; | ||
using MyServe.Backend.App.Domain.Abstracts; | ||
|
||
namespace MyServe.Backend.App.Application.Features.Profile.Search; | ||
|
||
public class MeSearchQueryHandler( | ||
IProfileService profileService, | ||
IReadOnlyUnitOfWork readOnlyUnitOfWork | ||
) : IRequestHandler<MeSearchQuery, MeSearchResponse> | ||
{ | ||
public async Task<MeSearchResponse> Handle(MeSearchQuery request, CancellationToken cancellationToken) | ||
{ | ||
await using var uow = await readOnlyUnitOfWork.StartTransactionAsync(); | ||
try | ||
{ | ||
var matchedList = await profileService.SearchAsync(request, cancellationToken); | ||
return new MeSearchResponse() | ||
{ | ||
Matched = matchedList | ||
}; | ||
} | ||
catch (Exception e) | ||
{ | ||
await uow.RollbackAsync(); | ||
return new MeSearchResponse(); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
MyServe.Backend.App.Application/Features/Profile/Search/MeSearchResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using MyServe.Backend.App.Application.Dto.Me; | ||
|
||
namespace MyServe.Backend.App.Application.Features.Profile.Search; | ||
|
||
public class MeSearchResponse | ||
{ | ||
public List<SearchDto> Matched = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
using MyServe.Backend.App.Application.Dto.Me; | ||
using MyServe.Backend.App.Application.Dto.Profile; | ||
using MyServe.Backend.App.Application.Features.Profile.Create; | ||
using MyServe.Backend.App.Application.Features.Profile.Search; | ||
|
||
namespace MyServe.Backend.App.Application.Services; | ||
|
||
public interface IProfileService | ||
{ | ||
Task<ProfileDto?> GetProfileAsync(Guid userId, CancellationToken cancellationToken = default); | ||
|
||
Task<ProfileDto> CreateNewProfileAsync(CreateProfileCommand command, CancellationToken cancellationToken = default); | ||
Task<List<SearchDto>> SearchAsync(MeSearchQuery searchQuery, CancellationToken cancellationToken = default); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace MyServe.Backend.Common.Constants; | ||
|
||
public enum ServiceType | ||
{ | ||
File, | ||
Password, | ||
Calendar, | ||
Notes, | ||
ShareableLink | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace MyServe.Backend.App.Domain.Models; | ||
|
||
public interface IEntity | ||
{ | ||
public Guid Id { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
MyServe.Backend.App.Domain/Repositories/IProfileRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
using MyServe.Backend.App.Domain.Abstracts; | ||
using MyServe.Backend.App.Domain.Models; | ||
using MyServe.Backend.App.Domain.Models.Profile; | ||
|
||
namespace MyServe.Backend.App.Domain.Repositories; | ||
|
||
public interface IProfileRepository : IAppRepository<Profile> | ||
{ | ||
Task<bool> ExistsAsync(string emailAddress); | ||
Task<List<IEntity>> SearchAcrossProfileAsync(string search, Guid userId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using FluentValidation; | ||
using MyServe.Backend.App.Application.Features.Profile.Search; | ||
|
||
namespace MyServe.Backend.Api.Validators; | ||
|
||
public class MeSearchQueryValidator : AbstractValidator<MeSearchQuery> | ||
{ | ||
|
||
public MeSearchQueryValidator() | ||
{ | ||
RuleFor(x => x.Search) | ||
.MinimumLength(3) | ||
.WithMessage("Search length must be between 3"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
CREATE SCHEMA IF NOT EXISTS "public"; | ||
CREATE SCHEMA IF NOT EXISTS "files"; | ||
CREATE SCHEMA IF NOT EXISTS "files"; | ||
|
||
CREATE EXTENSION IF NOT EXISTS pg_trgm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters