-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b54628
commit 4447dab
Showing
6 changed files
with
86 additions
and
32 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 |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import paginate from '@/helpers/pagination' | ||
|
||
import type { QueryResolvers } from '../../__generated__/types.generated' | ||
|
||
const getTables: QueryResolvers['getTables'] = async ( | ||
_parent, | ||
_params, | ||
{ limit, offset, name }, | ||
context, | ||
) => { | ||
const tables = await context.currentUser | ||
const tables = context.currentUser | ||
.$relatedQuery('tables') | ||
.where((builder) => { | ||
if (name) { | ||
builder.where('table_metadata.name', 'ilike', `%${name}%`) | ||
} | ||
}) | ||
.orderBy('last_accessed_at', 'desc') | ||
|
||
return tables | ||
return paginate(tables, limit, offset) | ||
} | ||
|
||
export default getTables |
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 |
---|---|---|
@@ -1,12 +1,20 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const GET_TABLES = gql` | ||
query GetTables { | ||
getTables { | ||
id | ||
name | ||
lastAccessedAt | ||
role | ||
query GetTables($limit: Int!, $offset: Int!, $name: String) { | ||
getTables(limit: $limit, offset: $offset, name: $name) { | ||
pageInfo { | ||
currentPage | ||
totalCount | ||
} | ||
edges { | ||
node { | ||
id | ||
name | ||
lastAccessedAt | ||
role | ||
} | ||
} | ||
} | ||
} | ||
` |
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