Internship Problem Statement

Problem Statement

  1. Create an API backend for a restaurant app, using Godspeed Framework.
  • which has below REST API’s:

    Method URL Description
    GET /restaurant/:restaurantId Fetch a restaurant by restaurantId
    POST /restaurant Createa a new restaurant
    PUT /restaurant Update an existing restaurant
    DELETE /restaurant/:restaurantId Delete an existing restaurant
    POST /restaurant/search Fetch restaurants of a particular city, and have Menu Items also in the response, If `couponCode` is provided, it should filter only those menu items which are for that code.
  • Populate database with atleast 5 restaurants

  • Some coupon codes are HUNGRY25, HUNGRY50

Steps

  1. Install Godspeed CLI in your local machine. Here is a detailed guide.
  2. Create a new godspeed project restaurant-app using Godspeed CLI, You can follow this, Select postgresas database. and then Open it in VSCode.
  3. Inside VSCode click on Open in Container. Now you newly created project is running in dev container.
  4. From the terminal, run godspeed build and then godspeed dev. Your documentation will be served in selected port [default 3000].
  5. Copy below prisma schema in src/datasources/postgres.prisma. You can read about Prisma ORM and Schema.
generator client {
  provider = "prisma-client-js"
  output   = "./generated-clients/postgres"
  previewFeatures = ["metrics"]
}

datasource db {
  provider = "postgresql"
  url      = env("POSTGRES_URL")
}

model Owner {
  id      Int      @id @default(autoincrement())
  email   String   @unique
  name    String?
}

model Restaurant {
  id         Int        @id @default(autoincrement())
  createdAt  DateTime   @default(now())
  name      String
  since  DateTime
  isOpen  Boolean    @default(false)
  opsStartTime DateTime
  opsEndTime DateTime
  ownerId   Int?
  slug     String    @unique
  description String?
  location String
  menuItems MenuItems[]
}

model Category {
  id    Int    @id @default(autoincrement())
  name  String
}

model MenuItems {
  id  Int @id @default(autoincrement())
  name String
  description String?
  price Int
  couponCode String[]
  restaurant Restaurant @relation(fields: [restaurantId], references: id)
  restaurantId  Int
}

model Order {
  id Int @id @default(autoincrement())
  frmoRestaurant Int
  orderStatus OrderStatus @default(NOT_INITIATED)
  placedAt DateTime?
  fulfilledAt DateTime?
  orderItems OrderItem[]
}

model OrderItem {
  id Int @id @default(autoincrement())
  menuItemId Int
  quantity Int
  order Order @relation(fields: [orderId], references: id)
  orderId Int
}

enum OrderStatus {
  INITIATED
  NOT_INITIATED
  WAITING_FOR_APPROVAL_FROM_RESTAURANT
  WAITING_FOR_DELIVERY_PARTNER
  PLACED
  PICKUP_BY_DELIVERY_PARTNER
  DELIVERED
  READY_TO_PICKUP
}
  1. You can use godspeed gen-crud-api to auto-generate REST api based on your schema.
  2. For the last API in problem statement, These things might be helpful:

Evaluation

Your solution will be only evaluated if

  1. Your code is hosted in a public repository.
  2. You follow the GodspeedSystems github org.
  3. You star the gs-node-service repository of Godspeed.

References

  1. Getting started guide
  2. Documentation
  3. Demo video of the Godspeed framework part one, part two

godspeed CLI setup and create project but not godspeed create my_service
_ _
__ _ ___ | | ___ _ __ ___ ___ | |
/ | / _ \ / _ | / _| | ’ \ / _ \ / _ \ / ` |
| (
| | | (
) | | (| | _ \ | |) | | __/ | __/ | (| |
__, | _
/ _,| |
/ | ./ _| _| _,|
|
_/ ||
projectDir: /home/gurjot/cli-test/my_service projectTemplateDir undefined
project created
Do you need mongodb? [y/n] [default: n] n
Do you need postgresdb? [y/n] [default: n] y
Please enter name of the postgres database [default: test]
Do you need kafka? [y/n] [default: n] n
Do you need elastisearch? [y/n] [default: n] n
Please enter host port on which you want to run your service [default: 3000] 3100
Fetching release version information…
Please select release version of gs_service from the available list:
latest
1.0.0
1.0.1
1.0.10
1.0.11
1.0.12
1.0.13
1.0.2
1.0.3
1.0.4
1.0.5
1.0.6
1.0.7
1.0.8
1.0.9
base
dev
v1.0.13
Enter your version [default: latest] 1.0.13
Selected version 1.0.13
. . . . . . . . these are not ask please guide me

Hi @Anilkumar can you please put your query on our discord server so that team can help you with Godspeed

why i’m stuck at godspeed dev. it’s not moving forword

1 Like

Command failed: C:\Users\bonny\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\bonny.vscode\extensions\ms-vscode-remote.remote-containers-0.295.0\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\bonny\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --container-session-data-folder /tmp/devcontainers-60b0c575-7c53-4e75-a711-7ac667ce7af81688659803278 --workspace-folder d:\godspeed\godspeed_assignment --workspace-mount-consistency cached --id-label devcontainer.local_folder=d:\godspeed\godspeed_assignment --id-label devcontainer.config_file=d:\godspeed\godspeed_assignment.devcontainer\devcontainer.json --log-level debug --log-format json --config d:\godspeed\godspeed_assignment.devcontainer\devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
Getting this error.


getting error while creating app

1 Like

I’m also facing same error

1 Like