Giter Club home page Giter Club logo

hackathon's Introduction

Hacaton)

Start app

docker-compose up -d --build

Если вдруг есть ошибка с psql ltree, то

В терминале:

psql postgresql://flash:dydka@localhost:5432/database

create extension ltree;

если написать еще раз create extension ltree; то напишет, мол уже установлено.

Endpoints

  • Healcheck GET /api/

  • Structure tree GET /api/structure/

    • args: flat(bool) - Optional

      • With flat=True return list of users
      • With flat=None or False return json format tree
    • Check return format ⬇️

  • Get node by id GET /api/tree

    • args: id(int)

    • Check return format ⬇️

  • Insert node POST /api/tree

    • args: json: { "parent_id":106 "name":"Кобанчик", "position":"Помогатор"}

    Check return format ⬇️

  • Delete node by id GET /api/tree

    • args: id(int)

    • Return

    {
        "message": "Node was removed",
        "node_id": 19, // id удалённой ноды
        "status": true
    }
  • Get task GET /api/task

    • args: Опционально фильтрация по..
      • id(int)
      • process_name(str)
      • owner_id(int)
      • assigner_id(int)
      • started(bool)

    example:

      /api/task?process_name=Поддержка&id=1
      
      Отфильтровать по "process_name" и "id".
    

    Check return format ⬇️

  • Send task POST /api/task

    • json:
    {   
        "name": str,
        "process_name": str,
        "start_time": int,
        "due_time": int,
        "owner_id": int, // Кто ставит задачу
        "assigner_id": int, // Кому ставит
        "priority": int, 
        "var_count": int
    }
    • Return
    {
        "status": true,
        "task_id": 5 // new task id
    }
  • Delete task DELETE /api/task

    • args: id(int)

    • Return

    {
        "message": "Was removed",
        "status": true,
        "task_id": 6 // id удалённой задачи
    }
  • Action with task POST /api/task/manage

    Change state task: start or stop Change assigner or owner

    • json:
        {   
            "id": int, // required task id
            "assigner_id": int, // optional
            "owner_id": int, // optional
            "state" : "start" or "stop" // optional
        }

    Check return format ⬇️

Structure tree return:

Query: /api/structure/
{
    "status": true,
    "tree": [
        {
            "children": [
                {
                    "children": [],
                    "id": 3,
                    "name": "Костя",
                    "path": "1.3",
                    "position": "Архитектор",
                    "task_count": 1
                },
                {
                    "children": [],
                    "id": 2,
                    "name": "Петя",
                    "path": "1.2",
                    "position": "Фронт",
                    "task_count": 2
                },
                {
                    "children": [],
                    "id": 4,
                    "name": "Катя",
                    "path": "1.4",
                    "position": "Маркетинг",
                    "task_count": 4
                },
                {
                    "children": [
                        {
                            "children": [],
                            "id": 12,
                            "name": "Абстрактный джун devopa",
                            "path": "1.5.12",
                            "position": "devOPs",
                            "task_count": 0
                        }
                    ],
                    "id": 5,
                    "name": "Ванёк",
                    "path": "1.5",
                    "position": "devOps",
                    "task_count": 0
                },
                {
                    "children": [],
                    "id": 6,
                    "name": "Ден",
                    "path": "1.6",
                    "position": "Десигн",
                    "task_count": 0
                }
            ],
            "id": 1,
            "name": "Василёк",
            "path": "1",
            "position": "Директор",
            "task_count": 1
        }
    ]
}
Query: /api/structure/flat=true
{
    "status": true,
    "users": [
        {
            "id": 1,
            "name": "Кирилл А.Э.",
            "path": "1",
            "task_count": 1
        },
        {
            "id": 3,
            "name": "Роман Д.Д.",
            "path": "1.3",
            "task_count": 0
        },
        {
            "id": 7,
            "name": "Владислав В.К.",
            "path": "1.3.7",
            "task_count": 1
        },
        ...
    ]
}

Get node by id return:

Query: /api/tree?id=106
{
    "node": {
        "children": [],
        "id": 106,
        "name": "bengal_tigers",
        "path": "101.102.106",
        "task_count": 2
    },
    "status": true
}

Insert node by id return:

Json: {
    "parent_id":106,
    "name":"koban`eze"
}
{
    "node": {
        "children": [],
        "id": 107,
        "name": "koban`eze",
        "path": "101.102.106.107",
        "task_count": 0
    },
    "status": true
}

Get task with filter return:

Query: /api/task?process_name=Поддержка&id=1
{
    "status": true,
    "tasks": [
        {
            "assigner_id": 19,
            "due_time": 1630200384,
            "end_time": 1630193184,
            "id": 1,
            "name": "Фикс чего-то там",
            "owner_id": 13,
            "priority": 75,
            "process_name": "Поддержка",
            "start_time": 1630171584,
            "started": false,
            "var_count": 2
        }
    ]
}

Action with task return:

Json: {
    "id": 4,
    "assigner_id": 10,
    "owner_id": 7
}
{
    "status": true,
    "task": {
        "assigner_id": 10,
        "due_time": 1630185413,
        "end_time": 1630183613,
        "id": 4,
        "name": "Нарисуй красиво",
        "owner_id": 7,
        "priority": 20,
        "process_name": "Сбор урожая",
        "start_time": 1630181813,
        "started": false,
        "var_count": 1
    }
}

hackathon's People

Contributors

jaysess avatar dubrovskijrd avatar aleasper avatar

Watchers

James Cloos avatar  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.