From 5f774ef4b24b47489b01df9b97550321344c8880 Mon Sep 17 00:00:00 2001 From: Jason Park Date: Fri, 22 Sep 2023 01:45:54 +0900 Subject: [PATCH] chore: commenting out graphql stuff --- lib/constructs/business/api-endpoint.ts | 2 +- .../business/graphql-api-service.ts | 236 +++++++++--------- lib/constructs/business/service.ts | 2 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/lib/constructs/business/api-endpoint.ts b/lib/constructs/business/api-endpoint.ts index 88fca9cf5..ec1895fa2 100644 --- a/lib/constructs/business/api-endpoint.ts +++ b/lib/constructs/business/api-endpoint.ts @@ -12,7 +12,7 @@ import * as flatted from 'flatted'; import { defaultHeaders } from '../../configs/api-gateway/cors'; import { STAGE } from '../../configs/common/aws'; import { API_DOMAIN } from '../../configs/route53/domain'; -import { GraphqlApiService } from './graphql-api-service'; +// import { GraphqlApiService } from './graphql-api-service'; import { AbstractHttpApiService } from './http-api-service'; import { RestApiService } from './rest-api-service'; import { diff --git a/lib/constructs/business/graphql-api-service.ts b/lib/constructs/business/graphql-api-service.ts index 403fe3089..64b167daf 100644 --- a/lib/constructs/business/graphql-api-service.ts +++ b/lib/constructs/business/graphql-api-service.ts @@ -1,130 +1,130 @@ -import * as appsync from '@aws-cdk/aws-appsync-alpha'; -import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; -import { Construct } from 'constructs'; +// import * as appsync from '@aws-cdk/aws-appsync-alpha'; +// import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +// import { Construct } from 'constructs'; -import { - generateConnectionAndEdge, - int, - list_int, - list_of, - list_string, - PageInfo, - required, - required_string, - string, -} from '../../utils/appsync'; -import { AbstractGraphqlEndpoint } from './api-endpoint'; +// import { +// generateConnectionAndEdge, +// int, +// list_int, +// list_of, +// list_string, +// PageInfo, +// required, +// required_string, +// string, +// } from '../../utils/appsync'; +// import { AbstractGraphqlEndpoint } from './api-endpoint'; -export interface GraphqlApiServiceProps { - dataSource: dynamodb.ITable; - auth?: appsync.AuthorizationMode; -} +// export interface GraphqlApiServiceProps { +// dataSource: dynamodb.ITable; +// auth?: appsync.AuthorizationMode; +// } -export class GraphqlApiService extends Construct { - readonly resolvers: { [name: string]: appsync.Resolver }; +// export class GraphqlApiService extends Construct { +// readonly resolvers: { [name: string]: appsync.Resolver }; - constructor(scope: AbstractGraphqlEndpoint, id: string, props: GraphqlApiServiceProps) { - super(scope, id); - } -} +// constructor(scope: AbstractGraphqlEndpoint, id: string, props: GraphqlApiServiceProps) { +// super(scope, id); +// } +// } -export class CourseApiService extends GraphqlApiService { - readonly resolvers: { [name: string]: appsync.Resolver } = {}; +// export class CourseApiService extends GraphqlApiService { +// readonly resolvers: { [name: string]: appsync.Resolver } = {}; - constructor(scope: AbstractGraphqlEndpoint, id: string, props: GraphqlApiServiceProps) { - super(scope, id, props); +// constructor(scope: AbstractGraphqlEndpoint, id: string, props: GraphqlApiServiceProps) { +// super(scope, id, props); - const dataSource = scope.apiEndpoint.addDynamoDbDataSource('dynamo-db', props.dataSource, { - description: 'Syllabus table from DynamoDB.', - name: 'SyllabusTable', - }); +// const dataSource = scope.apiEndpoint.addDynamoDbDataSource('dynamo-db', props.dataSource, { +// description: 'Syllabus table from DynamoDB.', +// name: 'SyllabusTable', +// }); - const School = new appsync.EnumType('School', { - definition: [ - 'PSE', 'FSE', 'SSS', 'SILS', 'CSE', 'ASE', 'LAW', 'CMS', 'HSS', 'EDU', 'SOC', 'HUM', 'SPS', 'CJL', - 'GEC', 'CIE', 'ART', 'G_SPS', 'G_SE', 'G_LAW', 'G_LAS', 'G_SC', 'G_EDU', 'G_HUM', 'G_SSS', 'G_SAPS', - 'G_ITS', 'G_SJAL', 'G_IPS', 'G_WLS', 'G_SA', 'G_SPS', 'G_FSE', 'G_ASE', 'G_CSE', 'G_SEEE', 'G_WBS', - 'G_SICCS', - ], - }); - const Eval = new appsync.ObjectType('Evaluation', { - definition: { - type: int, - percent: int, - criteria: string, - }, - }); - const Occurrence = new appsync.ObjectType('Occurrence', { - definition: { - day: int, - period: int, - location: string, - }, - }); - const Course = new appsync.ObjectType('Course', { - definition: { - id: string, - category: string, - code: string, - credit: int, - evals: list_of(Eval), - instructor: string, - lang: list_int, - level: int, - minYear: int, - occurrences: list_of(Occurrence), - school: School.attribute(), - subtitle: string, - term: string, - title: string, - titleJp: string, - type: int, - }, - }); +// const School = new appsync.EnumType('School', { +// definition: [ +// 'PSE', 'FSE', 'SSS', 'SILS', 'CSE', 'ASE', 'LAW', 'CMS', 'HSS', 'EDU', 'SOC', 'HUM', 'SPS', 'CJL', +// 'GEC', 'CIE', 'ART', 'G_SPS', 'G_SE', 'G_LAW', 'G_LAS', 'G_SC', 'G_EDU', 'G_HUM', 'G_SSS', 'G_SAPS', +// 'G_ITS', 'G_SJAL', 'G_IPS', 'G_WLS', 'G_SA', 'G_SPS', 'G_FSE', 'G_ASE', 'G_CSE', 'G_SEEE', 'G_WBS', +// 'G_SICCS', +// ], +// }); +// const Eval = new appsync.ObjectType('Evaluation', { +// definition: { +// type: int, +// percent: int, +// criteria: string, +// }, +// }); +// const Occurrence = new appsync.ObjectType('Occurrence', { +// definition: { +// day: int, +// period: int, +// location: string, +// }, +// }); +// const Course = new appsync.ObjectType('Course', { +// definition: { +// id: string, +// category: string, +// code: string, +// credit: int, +// evals: list_of(Eval), +// instructor: string, +// lang: list_int, +// level: int, +// minYear: int, +// occurrences: list_of(Occurrence), +// school: School.attribute(), +// subtitle: string, +// term: string, +// title: string, +// titleJp: string, +// type: int, +// }, +// }); - const FilterForm = new appsync.InputType('FilterForm', { - definition: { - semester: list_string, - lang: list_int, - day: list_int, - period: list_int, - minYear: list_int, - credit: list_int, - evalType: int, - percent: int, - type: list_int, - level: list_int, - }, - }); +// const FilterForm = new appsync.InputType('FilterForm', { +// definition: { +// semester: list_string, +// lang: list_int, +// day: list_int, +// period: list_int, +// minYear: list_int, +// credit: list_int, +// evalType: int, +// percent: int, +// type: list_int, +// level: list_int, +// }, +// }); - const CourseConnection = generateConnectionAndEdge({ base: Course, target: Course }).connection; - const CourseEdge = generateConnectionAndEdge({ base: Course, target: Course }).edge; +// const CourseConnection = generateConnectionAndEdge({ base: Course, target: Course }).connection; +// const CourseEdge = generateConnectionAndEdge({ base: Course, target: Course }).edge; - [School, Eval, Occurrence, Course, CourseConnection, CourseEdge, PageInfo, FilterForm].forEach( - (type) => scope.apiEndpoint.addType(type), - ); +// [School, Eval, Occurrence, Course, CourseConnection, CourseEdge, PageInfo, FilterForm].forEach( +// (type) => scope.apiEndpoint.addType(type), +// ); - scope.apiEndpoint.addQuery('getCourse', new appsync.ResolvableField({ - returnType: Course.attribute(), - dataSource: dataSource, - args: { - id: required_string, - }, - requestMappingTemplate: appsync.MappingTemplate.dynamoDbGetItem('id', 'id'), - responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultItem(), - })); - scope.apiEndpoint.addQuery('filterCourses', new appsync.ResolvableField({ - returnType: CourseConnection.attribute(), - dataSource: dataSource, - args: { - form: required(FilterForm), - after: string, - first: int, - before: string, - last: int, - }, - requestMappingTemplate: appsync.MappingTemplate.fromFile('src/appsync/mapping/syllabus-filter-req.vtl'), - responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultList(), - })); - } -} +// scope.apiEndpoint.addQuery('getCourse', new appsync.ResolvableField({ +// returnType: Course.attribute(), +// dataSource: dataSource, +// args: { +// id: required_string, +// }, +// requestMappingTemplate: appsync.MappingTemplate.dynamoDbGetItem('id', 'id'), +// responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultItem(), +// })); +// scope.apiEndpoint.addQuery('filterCourses', new appsync.ResolvableField({ +// returnType: CourseConnection.attribute(), +// dataSource: dataSource, +// args: { +// form: required(FilterForm), +// after: string, +// first: int, +// before: string, +// last: int, +// }, +// requestMappingTemplate: appsync.MappingTemplate.fromFile('src/appsync/mapping/syllabus-filter-req.vtl'), +// responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultList(), +// })); +// } +// } diff --git a/lib/constructs/business/service.ts b/lib/constructs/business/service.ts index 1467c3a4d..a3a789dd8 100644 --- a/lib/constructs/business/service.ts +++ b/lib/constructs/business/service.ts @@ -1,4 +1,4 @@ -import * as gql from './graphql-api-service'; +// import * as gql from './graphql-api-service'; import * as rest from './rest-api-service'; export enum ApiEndpoint {