Giter Club home page Giter Club logo

mikro-orm-graphql-example's People

Contributors

driescroons avatar olavfosse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mikro-orm-graphql-example's Issues

validate not called for class-validator

Great example! I've just one quick question, I don't see validate being called for any entity decorated with class-validator. Is this somehow being validated internally that I'm missing?
Thank you!

Build and start don't work

The dev mode works well, however not the build process.

npm install

Install ok.

npm run build

Error:

src/utils/services/loadFixtures.service.ts:65:9 - error TS2740: Type 'Tag[]' is missing the following properties from type 'Collection<Tag, unknown>': snapshot, dirty, _populated, _lazyInitialized, and 42 more.

65         book.tags = [orm.em.getRepository(Tag).getReference(tags[bookIndex].id)];
           ~~~~~~~~~

I comment this line. Build ok.

npm run start

Error:

> cross-env NODE_PATH=./dist/src node dist/src/index.js

node_modules/globby/index.js:28
	} catch {
	        ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (node_modules/@mikro-orm/core/cache/FileCacheAdapter.js:7:34)

`set_session_replication_role = 'replica'` error

I am trying to run you example and getting the above error:

❯ postgres --version

postgres (PostgreSQL) 13.0
❯ yarn loadFixtures
yarn run v1.22.5
$ yarn test --grep "should clear database and load fixtures"
$ cross-env NODE_DEV=true NODE_ENV=test ts-mocha ./tests/**/*.test.ts --package package.json --grep 'should clear database and load fixtures'


  Sample tests
== Migration20200809143205: migrating =======
== Migration20200809143205: migrated (0.119s)

🚀 http://localhost:8080/graphql
    1) should clear database and load fixtures


  0 passing (2s)
  1 failing

  1) Sample tests
       should clear database and load fixtures:
     DriverException: set session_replication_role = 'replica'; - permission denied to set parameter "session_replication_role"
      at PostgreSqlExceptionConverter.convertException (node_modules/@mikro-orm/core/platforms/ExceptionConverter.js:8:16)
      at PostgreSqlExceptionConverter.convertException (node_modules/@mikro-orm/postgresql/PostgreSqlExceptionConverter.js:40:22)
      at PostgreSqlDriver.convertException (node_modules/@mikro-orm/core/drivers/DatabaseDriver.js:147:54)
      at /Users/mandalarian/Downloads/mikro-orm-graphql-example/node_modules/@mikro-orm/core/drivers/DatabaseDriver.js:151:24
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at SchemaGenerator.execute (node_modules/@mikro-orm/knex/schema/SchemaGenerator.js:108:13)
      at SchemaGenerator.dropSchema (node_modules/@mikro-orm/knex/schema/SchemaGenerator.js:55:9)
      at Object.exports.clearDatabase (src/utils/services/clearDatabase.service.ts:5:5)
      at Context.<anonymous> (tests/sample.test.ts:25:9)

  previous error: set session_replication_role = 'replica'; - permission denied to set parameter "session_replication_role"
      at Parser.parseErrorMessage (node_modules/pg-protocol/src/parser.ts:357:11)
      at Parser.handlePacket (node_modules/pg-protocol/src/parser.ts:186:21)
      at Parser.parse (node_modules/pg-protocol/src/parser.ts:101:30)
      at Socket.<anonymous> (node_modules/pg-protocol/src/index.ts:7:48)
      at Socket.EventEmitter.emit (domain.js:485:12)
      at addChunk (_stream_readable.js:302:12)
      at readableAddChunk (_stream_readable.js:278:9)
      at Socket.Readable.push (_stream_readable.js:217:10)
      at TCP.onStreamRead (internal/stream_base_commons.js:186:23)



error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Am i missing a step from the Readme?

Thank for sharing.

Simple review

Was hoping to see the use of transactions here and here, and where you'd define that boundary.

As you're using ts-morph for metadata, did you run into any problems? I figured you'd have to generate types or something. In my project I stuck with reflect-metadata.

Glad to see you throwing up a repo :D

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.