Skip to content

Commit

Permalink
M4l2 collabapi (#15)
Browse files Browse the repository at this point in the history
* m4l2 - Collab API
  • Loading branch information
svok authored Apr 26, 2024
1 parent 92fc68c commit 7b71de8
Show file tree
Hide file tree
Showing 2 changed files with 390 additions and 0 deletions.
68 changes: 68 additions & 0 deletions docs/03-architecture/CollabAPI-back.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<mxfile host="app.diagrams.net" modified="2024-04-26T05:51:30.614Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" etag="_Rg0Z48JUxjlms79nvud" version="24.2.7" type="device">
<diagram name="Страница — 1" id="fwJDQmDWj_-vJRRBCIs1">
<mxGraphModel dx="1050" dy="556" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="WsvaUiyCxC51xsmZXI09-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="WsvaUiyCxC51xsmZXI09-10" target="WsvaUiyCxC51xsmZXI09-12">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="220" y="210" />
<mxPoint x="220" y="210" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-10" value="Clients" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;dashed=1;dashPattern=1 1;verticalAlign=top;" vertex="1" parent="1">
<mxGeometry x="50" y="170" width="80" height="273.25" as="geometry" />
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-2" value="" style="shape=actor;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="70" y="361.5" width="40" height="60" as="geometry" />
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;" edge="1" parent="1" source="WsvaUiyCxC51xsmZXI09-7" target="WsvaUiyCxC51xsmZXI09-4">
<mxGeometry relative="1" as="geometry">
<mxPoint x="360" y="318.29999999999995" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-6" value="Оповещаем об изменениях" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1.02;entryY=0.851;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="WsvaUiyCxC51xsmZXI09-4" target="WsvaUiyCxC51xsmZXI09-10">
<mxGeometry relative="1" as="geometry">
<mxPoint x="130" y="378" as="targetPoint" />
<Array as="points">
<mxPoint x="490" y="403" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-4" value="Delay,&lt;div&gt;Order,&lt;/div&gt;&lt;div&gt;Refine&lt;/div&gt;" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="430" y="291.5" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-16" value="Логи" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;dashed=1;dashPattern=1 1;strokeWidth=1;" edge="1" parent="1" source="WsvaUiyCxC51xsmZXI09-7" target="WsvaUiyCxC51xsmZXI09-12">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-7" value="WAL" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" vertex="1" parent="1">
<mxGeometry x="300" y="281.5" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-8" value="" style="shape=actor;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="70" y="291.5" width="40" height="60" as="geometry" />
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-9" value="" style="shape=actor;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="70" y="221.5" width="40" height="60" as="geometry" />
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-11" value="Команда на изменение" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="WsvaUiyCxC51xsmZXI09-10" target="WsvaUiyCxC51xsmZXI09-7">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="270" y="322" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-12" value="Собираем данные из лога, сохраняем как документ" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="270" y="180" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-14" value="Document" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" vertex="1" parent="1">
<mxGeometry x="450" y="170" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="WsvaUiyCxC51xsmZXI09-15" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="WsvaUiyCxC51xsmZXI09-12" target="WsvaUiyCxC51xsmZXI09-14">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
322 changes: 322 additions & 0 deletions specs/specs-ad-collab.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
openapi: 3.0.3
info:
title: Marketplace ${VERSION_APP}
description: This is a place where sellers and buyers meat each other
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
version: 3.0.0
servers:
- url: http://localhost:8080/v2
tags:
- name: ad
description: Объявление (о покупке или продаже)
paths:
/ad/edit:
post:
tags:
- ad
summary: Collaborative ad editing
operationId: adEdit
requestBody:
description: Request body
content:
application/json:
schema:
$ref: '#/components/schemas/AdCommand'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/AdEditReceive'
/ad/edit-insert:
post:
tags:
- ad
summary: Collaborative ad editing insert
requestBody:
description: Request body
content:
application/json:
schema:
$ref: '#/components/schemas/AdCommandInsertText'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/AdEditReceive'
/ad/edit-delete:
post:
tags:
- ad
summary: Collaborative ad editing delete
requestBody:
description: Request body
content:
application/json:
schema:
$ref: '#/components/schemas/AdCommandDeleteText'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/AdEditReceive'
/ad/change-product:
post:
tags:
- ad
summary: Collaborative ad editing delete
requestBody:
description: Request body
content:
application/json:
schema:
$ref: '#/components/schemas/AdCommandChangeProduct'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/AdEditReceive'
/ad/change-type:
post:
tags:
- ad
summary: Collaborative ad editing delete
requestBody:
description: Request body
content:
application/json:
schema:
$ref: '#/components/schemas/AdCommandChangeType'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/AdEditReceive'
/ad/change-visibility:
post:
tags:
- ad
summary: Collaborative ad editing delete
requestBody:
description: Request body
content:
application/json:
schema:
$ref: '#/components/schemas/AdCommandChangeVisibility'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/AdEditReceive'
components:
schemas:
AdCommand:
type: object
properties:
version:
$ref: '#/components/schemas/AdVersion'
debug:
$ref: '#/components/schemas/AdRequestDebug'
command:
type: string
description: Тип изменения
example: insert
discriminator:
propertyName: command
mapping:
get-updates: '#/components/schemas/AdCommandGetUpdates'
insert: '#/components/schemas/AdCommandInsertText'
delete: '#/components/schemas/AdCommandDeleteText'
change-prod: '#/components/schemas/AdCommandChangeProduct'
change-type: '#/components/schemas/AdCommandChangeType'
change-visibility: '#/components/schemas/AdCommandChangeVisibility'
anyOf:
- $ref: '#/components/schemas/AdCommandGetUpdates'
- $ref: '#/components/schemas/AdCommandInsertText'
- $ref: '#/components/schemas/AdCommandDeleteText'
- $ref: '#/components/schemas/AdCommandChangeProduct'
- $ref: '#/components/schemas/AdCommandChangeType'
- $ref: '#/components/schemas/AdCommandChangeVisibility'

AdTextFields:
type: string
enum:
- title
- description

AdCommandGetUpdates:
allOf:
- $ref: '#/components/schemas/AdCommand'
- description: "Пустая команда для получения последних обновлений"

AdCommandInsertText:
allOf:
- $ref: '#/components/schemas/AdCommand'
- type: object
description: "Вставка подстроки в текстовое поле"
properties:
field:
$ref: '#/components/schemas/AdTextFields'
pos:
type: integer
value:
type: string

AdCommandDeleteText:
allOf:
- $ref: '#/components/schemas/AdCommand'
- type: object
description: "Удаление подстроки из текстового поля"
properties:
command:
example: "delete"
field:
$ref: '#/components/schemas/AdTextFields'
posF:
type: integer
posT:
type: integer

AdCommandChangeProduct:
allOf:
- $ref: '#/components/schemas/AdCommand'
- type: object
description: "Изменить значение идентификатора продукта"
properties:
command:
example: "change-prod"
productId:
$ref: '#/components/schemas/ProductId'

AdCommandChangeType:
allOf:
- $ref: '#/components/schemas/AdCommand'
- type: object
description: "Изменить значение типа объявления"
properties:
command:
example: "change-type"
type:
$ref: '#/components/schemas/DealSide'

AdCommandChangeVisibility:
allOf:
- $ref: '#/components/schemas/AdCommand'
- type: object
description: "Изменить значение типа видимости объявления"
properties:
command:
example: "change-visibility"
visibility:
$ref: '#/components/schemas/AdVisibility'

AdEditReceive:
type: object
properties:
result:
$ref: '#/components/schemas/ResponseResult'
commands:
type: array
items:
$ref: '#/components/schemas/AdCommand'
errors:
type: array
items:
$ref: '#/components/schemas/Error'

Error:
type: object
properties:
code:
type: string
group:
type: string
field:
type: string
message:
type: string
level:
type: string
example: "info"
enum:
- debug
- info
- warn
- error

ResponseResult:
type: string
enum:
- success
- error
ProductId:
type: string
description: Идентификатор модели продукта, к которому относится объявление
AdVersion:
type: integer
description: Версия документа
example: 133
DealSide:
type: string
description: 'Сторона сделки: спрос или предложение'
enum:
- demand
- supply
AdVisibility:
type: string
description: >-
Тип видимости объявления. Возможные значения: видит только владелец,
только зарегистрированный в системе пользователь, видимо всем
enum:
- ownerOnly
- registeredOnly
- public
AdRequestDebugMode:
type: string
enum:
- prod
- test
- stub
AdRequestDebug:
type: object
properties:
debug:
$ref: '#/components/schemas/AdDebug'
AdDebug:
type: object
properties:
mode:
$ref: '#/components/schemas/AdRequestDebugMode'
stub:
$ref: '#/components/schemas/AdRequestDebugStubs'
AdRequestDebugStubs:
type: string
description: Перечисления всех стабов
enum:
- success
- notFound
- badId
- badTitle
- badDescription
- badVisibility
- cannotDelete
- badSearchString

0 comments on commit 7b71de8

Please sign in to comment.