typescript Apollo-Server,在本地提供服务时,我可以将AWSDateTime更改为Date吗?

jum4pzuy  于 2023-01-14  发布在  TypeScript
关注(0)|答案(1)|浏览(101)

我在AWS AppSync上有一个graphql服务器,我正在尝试为该服务器创建本地Apollo-Server以进行本地测试。当我在测试文件(localSchema.ts)上启动本地服务器时,收到错误:Unknown type "AWSDateTime".对于AppSync,日期需要为AWSDateTime,是否可以有条件地将其设置为日期类型?架构如下:

const typeDefs = gql`
  directive @aws_api_key on OBJECT
  directive @aws_cognito_user_pools on OBJECT
  directive @aws_api_key on FIELD_DEFINITION
  directive @aws_cognito_user_pools on FIELD_DEFINITION

  enum DeliveryMethodEnum {
    PRINT_BACK
    DELIVERY
    DELIVERY_WITH_REPORTS
    PICKUP
  }

  enum CompanyStatusEnum {
    ON_BOARDING
    ACTIVE
    TERMINATED
    FROZEN
    NSF
    PENDING_1ST_PAYROLL
    TEST
  }

  type Company @aws_api_key @aws_cognito_user_pools {
    id: Int!
    companyNo: String
    legalName: String
    dba: String
    fein: String
    companyStatus: CompanyStatusEnum
    companyType: String
    logoKey: String
    hubspotId: String
    productTourStarted: Boolean
    productTourDashboardStarted: Boolean
    hasWatchedDemoVideo: Boolean
    groupId: Int
    createdBy: String
    createdAt: AWSDateTime
    updatedBy: String
    updatedAt: AWSDateTime
  }

  type CompanySingleResponse @aws_api_key @aws_cognito_user_pools {
    resCode: Int!
    resMessage: String
    data: Company
  }

  type Query {
    getCompanyById(id: ID): CompanySingleResponse
      @aws_api_key
      @aws_cognito_user_pools
  }
`;

export default typeDefs;```
omhiaaxx

omhiaaxx1#

似乎需要使用scalar AWSDateTime定义它

相关问题