Internship Problem Statement

Problem Statement

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

    Method URL Description
    GET /reataurant/:restaurantId Fetch a restaurant by restaurantId
    POST /reataurant Createa a new restaurant
    PUT /reataurant 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 you might helpful.
    - Prisma findMany link
    - Inline JS in Godspeed Workflow link
    - Example of multiple task with arguments link

Evaluation

  1. Your code is hosted in a public repository.
    Your solution will be only evaluated if,
  2. You follow the GodspeedSystems github org. link
  3. You have starred, gs-node-service repository of Godspeed. link

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

stuck while creating test project … Anyone knows how to resolve this?