Skip to content

Commit

Permalink
Fixed search and added FirstName and LastName to be searched on too.
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonsLover committed Feb 11, 2024
1 parent e8f7e08 commit 82114dd
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 43 deletions.
12 changes: 1 addition & 11 deletions Geesemon.DataAccess.Dapper/Providers/UserProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public async Task<List<User>> GetAsync(int take, int skip, string searchQuery, G
var tableName = GetTableName();
var query =
$@"SELECT * FROM {tableName}
WHERE(Identifier like '%' + @searchQuery + '%' or Email like '%' + @searchQuery + '%') and Id != @currentUserId
WHERE(Identifier like '%' + @searchQuery + '%' or Email like '%' + @searchQuery + '%' or LastName like '%' + @searchQuery + '%' or FirstName like '%' + @searchQuery + '%') and Id != @currentUserId
ORDER BY FirstName, LastName
OFFSET @skip ROWS
FETCH NEXT @take ROWS ONLY;";
Expand All @@ -26,14 +26,4 @@ OFFSET @skip ROWS

return result.ToList();
}
//public Task<List<User>> GetAsync(int take, int skip, string query, Guid? currentUserId = null)
//{
// return context.Users
// .Where(u => (u.Identifier.Contains(query) || (u.Email != null && u.Email.Contains(query))) && u.Id != currentUserId)
// .OrderBy(u => u.FirstName)
// .ThenBy(u => u.LastName)
// .Skip(skip)
// .Take(take)
// .ToListAsync();
//}
}
2 changes: 1 addition & 1 deletion Geesemon.Web/GraphQL/Queries/UserQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public UserQuery(UserManager userManager, IHttpContextAccessor httpContextAccess
.Argument<GuidGraphType>("UserId")
.ResolveAsync(async context =>
{
return await userManager.GetByIdAsync(context.GetArgument<Guid>("UserId"));
return await userProvider.GetByIdAsync(context.GetArgument<Guid>("UserId"));
})
.AuthorizeWith(AuthPolicies.Authenticated);

Expand Down
12 changes: 6 additions & 6 deletions Geesemon.Web/wwwroot/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.3d098d44.css",
"main.js": "/static/js/main.f16c4dd0.js",
"main.css": "/static/css/main.d5bb6875.css",
"main.js": "/static/js/main.e2795846.js",
"static/media/exit.svg": "/static/media/exit.f677459ab0bd060121fc5df5a1808023.svg",
"static/media/settings.svg": "/static/media/settings.5ce75b923316447e65b4193b76a349b5.svg",
"static/media/microphone.svg": "/static/media/microphone.0ee15e41889ee128084bfb787e311b3c.svg",
Expand Down Expand Up @@ -39,11 +39,11 @@
"static/media/next.svg": "/static/media/next.e616739078a36aa04268d4f7c2d952bf.svg",
"static/media/logout.svg": "/static/media/logout.a7631ed82996a1e1ee28481503244e15.svg",
"static/media/threeDots.svg": "/static/media/threeDots.687e2c923110b3319185cb227236b412.svg",
"main.3d098d44.css.map": "/static/css/main.3d098d44.css.map",
"main.f16c4dd0.js.map": "/static/js/main.f16c4dd0.js.map"
"main.d5bb6875.css.map": "/static/css/main.d5bb6875.css.map",
"main.e2795846.js.map": "/static/js/main.e2795846.js.map"
},
"entrypoints": [
"static/css/main.3d098d44.css",
"static/js/main.f16c4dd0.js"
"static/css/main.d5bb6875.css",
"static/js/main.e2795846.js"
]
}
2 changes: 1 addition & 1 deletion Geesemon.Web/wwwroot/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><link rel="manifest" href="/manifest.json"/><title>Geesemon</title><script defer="defer" src="/static/js/main.f16c4dd0.js"></script><link href="/static/css/main.3d098d44.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><div id="modal"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><link rel="manifest" href="/manifest.json"/><title>Geesemon</title><script defer="defer" src="/static/js/main.e2795846.js"></script><link href="/static/css/main.d5bb6875.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><div id="modal"></div></body></html>
11 changes: 0 additions & 11 deletions Geesemon.Web/wwwroot/static/css/main.3d098d44.css

This file was deleted.

1 change: 0 additions & 1 deletion Geesemon.Web/wwwroot/static/css/main.3d098d44.css.map

This file was deleted.

11 changes: 11 additions & 0 deletions Geesemon.Web/wwwroot/static/css/main.d5bb6875.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Geesemon.Web/wwwroot/static/css/main.d5bb6875.css.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Geesemon.Web/wwwroot/static/js/main.e2795846.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Geesemon.Web/wwwroot/static/js/main.e2795846.js.map

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions Geesemon.Web/wwwroot/static/js/main.f16c4dd0.js

This file was deleted.

1 change: 0 additions & 1 deletion Geesemon.Web/wwwroot/static/js/main.f16c4dd0.js.map

This file was deleted.

16 changes: 10 additions & 6 deletions Geesemon.WebClient/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Geesemon.WebClient/src/behavior/features/users/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const slice = createSlice({
state.skip = action.payload;
},
setQ: (state, action: PayloadAction<string>) => {
console.log(action);
state.query = action.payload;
},

Expand All @@ -72,7 +73,6 @@ const slice = createSlice({
state.hasNext = initialState.hasNext;
state.take = initialState.take;
state.skip = initialState.skip;
state.query = initialState.query;
},
resetReadBy: (state, action: PayloadAction) => {
state.readByGetLoading = initialState.readByGetLoading;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export const ChatsCreatePersonalChat: FC<Props> = () => {
};

const onQChange = (value: string) => {
dispatch(usersActions.setQ(value));
dispatch(usersActions.setUsers([]));
dispatch(usersActions.setSkip(0));
dispatch(usersActions.setHasNext(true));
dispatch(usersActions.setQ(value));
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const Search: FC<Props> = ({ onFocus, placeholder, value, setValue }) =>
setInputSearchFocused(false);
};

console.log(value);

return (
<div className={[s.wrapperInputSearch, inputSearchFocused && s.focused].join(' ')}>
<img src={searchSvg} width={20} className={inputSearchFocused ? 'primarySvg' : 'secondaryTextSvg'} alt={'searchSvg'} />
Expand Down

0 comments on commit 82114dd

Please sign in to comment.