File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,8 +82,8 @@ Configuration options are set in the file [config.js](https://github.com/evolute
8282| wComments | Allow for user comments. |
8383| wRating | Allow for user ratings. |
8484| wTimestamp | Timestamp columns u_date and c_date w/ date of record creation and last update. |
85-
8685| schemaQueries | Enables endpoints to query for lists of tables and columns in the database schema. |
86+ | GraphQL | Set GraphQL = true to unable GraphQL (Work In Progress) |
8787
8888<a name =" Models " ></a >
8989## Models
Original file line number Diff line number Diff line change 77*/
88
99const graphql = require ( 'graphql' ) ,
10- { connectionString } = require ( '../config' ) ,
10+ config = require ( '../config' ) ,
1111 pgp = require ( 'pg-promise' ) ( ) ,
1212 crud = require ( './crud' ) ,
1313 logger = require ( './utils/logger' ) ,
@@ -17,9 +17,8 @@ const graphql = require('graphql'),
1717 errors = require ( './utils/errors' )
1818
1919const mIds = dico . modelIds
20-
2120const db = { }
22- db . conn = pgp ( connectionString ) ;
21+ db . conn = pgp ( config . connectionString ) ;
2322
2423const {
2524 GraphQLObjectType,
@@ -78,7 +77,13 @@ const model2gqlObjectType = m => {
7877 // - add "shadow field" for text value of list/lov item
7978 fields [ f . id + '_txt' ] = gqlFieldLOVText ( f )
8079 }
81- } ) ;
80+ } )
81+
82+ // - "timestamp" columns to track creation and last modification.
83+ if ( config . wTimestamp ) {
84+ fields [ 'c_date' ] = gqlField ( { type : ft . datetime } )
85+ fields [ 'u_date' ] = gqlField ( { type : ft . datetime } )
86+ }
8287 return new GraphQLObjectType ( {
8388 name : m . id ,
8489 fields : fields ,
You can’t perform that action at this time.
0 commit comments