Giter Site home page Giter Site logo

hrenovina's Issues

Add endpoint for bulk serial keys parsing POST /parse/bulk

Accepts body (JSON object):

  • items: array of serial keys (see limits for serial key string in issue #3 )

Response (JSON):

In case of any invalid data - 400 status code and JSON object:

  • items: array of serial key parsing errors.

In case of OK - 200 status code and JSON object:

  • items: array of parsed serial keys

Prometheus metrics

Implement several simple prometheus metrics (kind of http response count and duration split by HTTP method, URL and status_code).
All of them should be available via GET /metrics endpoint

Add endpoint POST /parse endpoint

Input parameters, JSON object:

  • key: string, required, not null, min len == max len == 40

Success response: 200 status code, JSON object (let's name it Parsed Serial Key)

  • feature_name: string, not empty, max len = 40
  • quota: int
  • expiration: datetime
  • language: string, len 5

Invalid serial key string, parsing error: 400 response, JSON object (let's call it Parsing Serial Key Error):

  • serial_key: string
  • code: string or int, short code for error reason (InvalidSerialKeyString, ParsingError and etc)
  • details: Human readable details of error

Add database layer for storing generated keys

On start it will contain one table for generated keys with following fields:

  • id: int, primary key, auto increment
  • ... fields from parsed serial key structure (see #3)
  • created_dt: date time
  • deleted_dt: date time

It's supposed to use goqu (http://doug-martin.github.io/goqu/) for building SQL queries. So don't use any ORM for it.
You need to add database migrations tool. I know about two:

Database access should be configured via connection string parameter (it can be a server parameter, environment variable or taken from configuration file)

Library for parsing and generating serial key

We need a library which can be used both in handlers or in any console tools for parsing, verifying or generating a new serial keys. It's just a kind of mock so it should be pretty simple. See issue #3 for structure of serial key data.

Add API endpoint for POST /keys for generating a new serial key

Input - JSON body (similar to response method in issue #3)

Success response: 200 status code, JSON object:

  • serial_key: string

Validation error response: 400 status code, JSON object:

  • details: Human readable error details
  • code: should be ValidationError
  • fields: array of objects having two fields - field_name and error

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.