Skip to content

Commit

Permalink
Hide createdBy field on my-pbs page
Browse files Browse the repository at this point in the history
  • Loading branch information
big213 committed Apr 18, 2021
1 parent e467804 commit 9445546
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 121 deletions.
26 changes: 14 additions & 12 deletions backend/functions/src/schema/core/helpers/typeDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,13 +700,9 @@ function validateFieldPath(
// returns resolver object instead of a typeDef because it is also used to generate the rootResolver
export function generatePaginatorPivotResolverObject(params: {
pivotService: PaginatedService;
currentService?: NormalService;
filterByField?: string;
}) {
const { pivotService, currentService } = params;

const filterByField = currentService
? currentService.typename.toLowerCase() + ".id"
: null;
const { pivotService, filterByField } = params;

// if filterByField, ensure that filterByField is a valid filterField on pivotService
if (filterByField && !pivotService.filterFieldsMap[filterByField]) {
Expand All @@ -718,19 +714,25 @@ export function generatePaginatorPivotResolverObject(params: {
// generate sortByKey ScalarDefinition
const sortByScalarDefinition: ScalarDefinition = {
name: pivotService.typename + "SortByKey",
types: Object.entries(pivotService.sortFieldsMap).map(([key, value]) => {
// ensure the path exists
validateFieldPath(pivotService.getTypeDef(), value.field ?? key);

return `"${key}"`;
}),
types: [],
parseValue: (value) => {
if (typeof value !== "string" || !(value in pivotService.sortFieldsMap))
throw true;
return value;
},
};

process.nextTick(() => {
sortByScalarDefinition.types = Object.entries(
pivotService.sortFieldsMap
).map(([key, value]) => {
// ensure the path exists
validateFieldPath(pivotService.getTypeDef(), value.field ?? key);

return `"${key}"`;
});
});

const groupByScalarDefinition: ScalarDefinition = {
name: pivotService.typename + "GroupByKey",
types: Object.entries(pivotService.groupByFieldsMap).map(([key, value]) => {
Expand Down
157 changes: 60 additions & 97 deletions frontend/package-lock.json

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

9 changes: 4 additions & 5 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "set DEV=1 && nuxt-ts",
"build": "nuxt-ts build",
"start": "nuxt-ts start",
"generate": "nuxt-ts generate",
"dev": "set DEV=1 && nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",
"lint": "npm run lint:js"
},
"dependencies": {
"@nuxt/typescript-runtime": "^2.0.0",
"axios": "^0.21.0",
"convert-array-to-csv": "^2.0.0",
"core-js": "^3.6.5",
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/my-pbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default {
},
title: 'My PBs',
hiddenFilters: ['createdBy.id', 'isCurrent'],
hiddenHeaders: ['createdBy.name+createdBy.avatar'],
hiddenHeaders: ['createdBy.name+createdBy.avatar+createdBy.id'],
}
},
Expand Down
Loading

0 comments on commit 9445546

Please sign in to comment.