Giter Club home page Giter Club logo

advertising's Introduction

Advertising

Description

The service creates, stores, updates and deletes adverts. Ads will be stored in a database. The service provides API running on top of HTTP in JSON format.

Start

Requirements

Run

  1. Run command to start project:

    docker compose up
  2. Connect to Swagger using http://localhost:8080/swagger-ui/.

Implementation

  • Using structure REST API.
  • Clean Architecture.
  • Using framework Actix.
  • Working with database Postgres and ORM Diesel.
  • Implementation Graceful Shutdown.
  • Execution from Docker.
  • Unit testing of handler levels, business logic and interaction with the database in a classic way and using mockups.
  • Checking the code for compliance with standards using a linter Clippy.
  • Auto generation OpenAPI documentation using utoipa.
  • CI/CD - test and build code using GitHub Actions.

Endpoints

Get adverts

  • GET /api/adverts - get list of adverts

    • Query parameters:

      • offset - Page number.
      • size - The maximum number of items per page. 1 page can contain no more than 50 advertising.
      • Sorting is by price (ascending/descending) and by date creation (ascending/descending).
        • price_[asc/desc]
        • created_at_[asc/desc]
    • Response:

      [
        {
          "id": 1,
          "title": "Advert 1",
          "price": 10000,
          "created_at": "2002-10-02T15:00:00Z"
        },
        {
          "id": 2,
          "title": "Advert 2",
          "price": 60000,
          "created_at": "2004-10-02T14:00:00Z"
        },
        {
          "id": 3,
          "title": "Advert 3",
          "price": 30000,
          "created_at": "2007-10-02T13:00:00Z"
        }
      ]
  • GET /api/adverts/:id - get advert by id

    • Query parameters:

      • fields - If flag is equal to true show all fields.
    • Response:

      // /api/adverts/:id
      {
        "id": 1,
        "title": "Advert 1",
        "price": 10000,
        "created_at": "2002-10-02T15:00:00Z"
      }
      // /api/adverts/:id?fields=true
      {
        "id": 1,
        "title": "Advert 1",
        "description": "Description 1",
        "photo": "link1",
        "price": 10000,
        "created_at": "2002-10-02T15:00:00Z"
      }
  • POST /api/adverts - create advert

    • Body:
      • title - Advert title.
      • description - Advert description.
      • photo - Links to photos.
      • price - Price.
  • DELETE /api/adverts/:id - delete advert by id

  • PUT /api/adverts/:id - update advert by id

    • Body:
      • title - Advert title.
      • description - Advert description.
      • photo - Links to photos.
      • price - Price.

advertising's People

Contributors

ivanprog00 avatar

Watchers

 avatar

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.