Coder Social home page Coder Social logo

itmodreamteam / myrest Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 862 KB

Automation of restaurants search, table reservation and interaction with staff

Kotlin 77.70% Swift 21.50% HTML 0.05% Dockerfile 0.07% Ruby 0.11% FreeMarker 0.56%
kotlin-multiplaform

myrest's People

Contributors

alexivchenko avatar kirillsmirnow avatar rznov avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

myrest's Issues

BPM engine

Integrate the system with the business process management engine, automate one business process and demonstrate its workflow.

Errors handling

  1. Implement AccessTokenProvider and register it
    class AccessTokenProviderImpl : AccessTokenProvider {
        var accessToken: String? {
            print("Retrieve access token from persistent storage")
            return "MyToken"
        }
    }

    AccessTokenProviderCompanion.init().INSTANCE = AccessTokenProviderImpl()

2. Implement UnauthenticatedErrorHandler and register it

    class UnauthenticatedErrorHandlerImpl : UnauthenticatedErrorHandler {
        func handle() {
            print("Redirect user to Sign In")
            print("Retrieve access token and persist it")
        }
    }

    UnauthenticatedErrorHandlerCompanion.init().INSTANCE = UnauthenticatedErrorHandlerImpl()

3. Implement DefaultErrorHandler and register it

    class DefaultErrorHandlerImpl : DefaultErrorHandler {
        func handle(clientException: ClientException) {
            print("Take one error from exception and display it")
        }
    }

    DefaultErrorHandlerCompanion.init().INSTANCE = DefaultErrorHandlerImpl()
  1. The Error contains ClientException, handleWithDefaultErrorHandler method of which should be invoked as default error handling strategy
    Screenshot at 2020-12-20 03-52-11

Representation of an Error:
Screenshot at 2020-12-20 03-06-01

  1. Extend ErrorHandler<CONTEXT> and implement its abstract methods, where CONTEXT is a type required for opening new UI view/screen. On each client method invocation implement exception handling as follows: errorHandler.handle(context, clientException).

Session

  • Session Entity
  • Phone number verification
  • Access token generation
  • Access token verification (token -> User)

Object attributes validation

Attributes of DTOs that come to the server via REST API must be validated. However, Spring Validation doesn't suit for those DTOs as they are placed in shared module, where multi-platform Kotlin is used.

Security / Permissions

To be implemented in #31 and #33

Authentication is performed based on the access token, provided via HTTP header

Types of authorization:

  • None (public API)
  • Requires authentication
  • By user role
  • Complex: if user has specific permission for specific domain object

iOS CI

  • Build shared module for iOS platform

Report Generation

Make use of report generation tools. Demonstrate report being generated, based on the template and input parameters, and exported, e.g. as PDF.

Restaurant Verification

When user registers restaurant, he/she becomes its manager. RestaurantStatus = PENDING. System admin gets notified.

System admin can change restaurant status (invoking updateStatus method) to any of these values:

enum class RestaurantStatus {
    PENDING,
    ACTIVE,
    BLOCKED,
    HIDDEN,
}

On status change, restaurant managers get notified.

Notifications

There are 2 types of messages:

  1. notification messages
    automatically displayed when the app is in the background
  2. data message
    to be displayed by the app when it is in the foreground

Firebase Cloud Messaging

Restaurant

  • Restaurant entity
  • CRUD
  • Simple search (by name)

Employees

  • Invite user to a restaurant
  • View employees/invitations
  • View restaurants/invitations
  • Update status by user
  • Update status by restaurant

Move converters to a separate layer

IMHO converter methods should not be in service level classes. It's usually different layer because of SRP.
Service does business logic as well as converting entities.
Why is it bad? Because

  1. Entity to be converted (say it "xxx") can contain references to other entities (say it "xxxRef") which should be converted as well. So in you XxxService you need to inject XxxRefService. This can lead to cycle dependencies between services which is pretty ok for spring, but may be a problem in tests (X requires Y, Y requires Z, Z requires X -> how to test X?). Cycle dependencies are evil but they are very common for converters so our services will have cycle dependencies even not for doing real business logic but for converting entities.
  2. (this is not really relevant for us, but anyway). What if we would want to have different implementation of TableService. We will need to implement the same logic for conversion what will lead to code duplication.

Originally posted by @AlexIvchenko in #19 (comment)

Tables

  • View tables of a restaurant
  • Create table
  • Update table info
  • Get table by ID
  • Delete table
  • Edit list of waiters, responsible for the table
  • View waiter's tables

API consumption

PoC: how clients communicate with server by means of multi-platform Kotlin

Restaurant Creator UserStatus

When restaurant is created, creator is added to its employees list as manager. RestaurantStatus = ACTIVE. UserStatus = PENDING (must be ACTIVE, too).

Exception handling

When an error occurs, we need to log it (appropriate logging level, provide as more info as possible, exception stack trace), convert to a readable message that we will show to user, and send this message in a response.

Book page

Page where a user can choose a table and reserve it

User

  • User Entity
  • Sign Up
  • Sign In

Table Reservation

  • Reserve table in a restaurant
  • Get reservation by ID
  • Get reservations of user
  • Get reservations of restaurant
  • Update status (by manager)
  • Confirm guest arrival (manager/waiter scans QR code)

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.