Skip to content

zrwusa/bunny-graphql

Repository files navigation

Description

Project setup

$ npm install

.env

POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=YOUR_DATABASE_PASSWORD
POSTGRES_DATABASE=YOUR_DATABASE_NAME

Compile and run the project

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Run tests

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

WebStorm Debugging

Node interpreter: versions/node/v22.10.0/bin/node) 22.10.0
TypeScript loader: None
Node parameters: 
Working directory: ~/projects/bunny-graphql
File: node_modules/.bin/nest
Application parameters: start --debug --watch
Environment variables: Environment variables

Graphql queries and mutations

Get users

query {
    users {
        id
        username
        provider
        settings {
            userId
            receiveEmails
            receiveNotifications
        }
        posts {
            id
            content
        }
    }
}

Create user

mutation {
    createUser(
        createUserInput: {
            username: "Maf"
            email: "[email protected]"
            password: "Zdd@fafdas"
        }
    ) {
        username
        email
        id
    }
}

Get user by id

query {
    user(id: "905081365494623249") {
        id
        email
        username
    }
}

Create user settings

mutation {
    createUserSettings(
        createUserSettingsInput: {
            userId: "905081365494623249"
            receiveEmails: true
            receiveNotifications: false
        }
    ) {
        id
        userId
    }
}

Get products

query {
    products {
        id
        name
        brand
        description
    }
}

Create post

mutation {
    createPost(
        createPostInput: {
            userId: "136964796021366197"
            title: "title 645"
            content: "content 544"
            price: 20
            image: "https://image.google.com/a.png"
        }
    ) {
        id
        image
        title
        content
    }
}

Get posts

query {
    posts {
        id
        image
        user {
            username
            provider
        }
    }
}

Get orders

query {
  orders(filterOrderInput: { page: 1, pageSize: 10 }) {
    status
    shippingStatus
    paymentStatus
    paymentMethod
    user {
      id
      username
    }
    products {
      price
      quantity
      product {
        name
        brand
      }
    }
  }
}

Enum

SELECT n.nspname AS schema_name,
       t.typname AS enum_name,
       e.enumlabel AS enum_value
FROM pg_type t
JOIN pg_enum e ON t.oid = e.enumtypid
JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace
WHERE n.nspname = 'public';

Deployment

$ npm install -g mau
$ mau deploy

With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.

Resources

Support

Stay in touch

License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published