Giter Club home page Giter Club logo

Comments (3)

maoosi avatar maoosi commented on June 17, 2024

The date format issue you're facing is due to Prisma Client. It always returns dates as DateTime, regardless of the database format used. Here are some open issues about it:

prisma/prisma#7490
prisma/prisma#4355

Prisma-AppSync only acts as a bridge that connects Prisma to AWS AppSync and doesn't alter the data. Supporting AWSDate like AWSDateTime can only happen after the Prisma team fixes this issue.

For your use case, I would suggest removing /// @gql(scalars: { asOfDate: "AWSDate" }) entirely, so the generated GraphQL field will fallback to AWSDateTime (similar format to Prisma Client). Even though the format returned will be a DateTime, it should still save as Date in your Database.

from prisma-appsync.

d-e-a-n-f avatar d-e-a-n-f commented on June 17, 2024

Hi @maoosi , Thanks for the response on this! I am aware of the Prisma issue which I dont think they will ever fix so thought it could be handled in this package potentially.

Although, I agree it is not an issue with this package!

We have a solution for this using the prisma middleware or extensions, is there anyway of overriding the prisma client in prisma-appsync that would allow us to carry over our extensions?

from prisma-appsync.

maoosi avatar maoosi commented on June 17, 2024

@d-e-a-n-f yes, absolutely! You can access the underlying Prisma Client instance like this:

// init prisma-appsync
const prismaAppSync = new PrismaAppSync()

// middleware
prismaAppSync.prismaClient.$use(async (params, next) => {
    return next(params)
})

// lambda resolver
export const main = async (event: AppSyncResolverEvent<any>) => {
    return await prismaAppSync.resolve({ event })
}

from prisma-appsync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.