a lot of bugfixes, completed abstract products and products

This commit is contained in:
leca 2024-10-27 04:45:13 +03:00
parent a27ce5762c
commit 75f9fb6d7d
24 changed files with 462 additions and 284 deletions

View File

@ -1,135 +1,150 @@
<mxfile host="Electron" modified="2024-10-25T22:45:42.822Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.0.2 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36" etag="5By3CPPGDMnT9W5b2oTL" version="22.0.2" type="device"> <mxfile host="Electron" modified="2024-10-27T00:02:22.891Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.0.2 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36" etag="MBisub1aCyOUfmwGmKNG" version="22.0.2" type="device">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1"> <diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="499" dy="882" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1654" pageHeight="1169" math="0" shadow="0"> <mxGraphModel dx="1674" dy="838" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1654" pageHeight="1169" math="0" shadow="0">
<root> <root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" /> <mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" /> <mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="JJCkPNM4InE_l2XlKl3H-0" value="Users" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-0" value="Users" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry y="280" width="250" height="150" as="geometry" /> <mxGeometry y="280" width="250" height="150" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-1" value="ID SERIAL PRIMARY_KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0"> <mxCell id="JJCkPNM4InE_l2XlKl3H-1" value="ID SERIAL PRIMARY_KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-0" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" /> <mxGeometry y="30" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-2" value="username VARCHAR(32) UNIQUE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0"> <mxCell id="JJCkPNM4InE_l2XlKl3H-2" value="username VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-0" vertex="1">
<mxGeometry y="60" width="250" height="30" as="geometry" /> <mxGeometry y="60" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-3" value="password CHAR(60)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0"> <mxCell id="JJCkPNM4InE_l2XlKl3H-3" value="password CHAR(60)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-0" vertex="1">
<mxGeometry y="90" width="250" height="30" as="geometry" /> <mxGeometry y="90" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-16" value="groups INT[]" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0"> <mxCell id="JJCkPNM4InE_l2XlKl3H-16" value="groups INT[]" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-0" vertex="1">
<mxGeometry y="120" width="250" height="30" as="geometry" /> <mxGeometry y="120" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-4" value="Abstract_products" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-4" value="Abstract_products" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="577" y="130" width="250" height="270" as="geometry" /> <mxGeometry x="870" y="110" width="250" height="300" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-5" value="ID SERIAL PRIMARY_KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-5" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" /> <mxGeometry y="30" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-20" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-20" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="60" width="250" height="30" as="geometry" /> <mxGeometry y="60" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-19" value="barcode CHAR(13)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="4Zi9I1GNT6whHIKbPsLc-6" value="local_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="90" width="250" height="30" as="geometry" /> <mxGeometry y="90" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-6" value="name VARCHAR(128)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-19" value="barcode CHAR(13)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="120" width="250" height="30" as="geometry" /> <mxGeometry y="120" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-8" value="net_weight REAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-6" value="name VARCHAR(128)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="150" width="250" height="30" as="geometry" /> <mxGeometry y="150" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-9" value="image_filename CHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-8" value="net_weight REAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="180" width="250" height="30" as="geometry" /> <mxGeometry y="180" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-10" value="category INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-9" value="image_filename CHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="210" width="250" height="30" as="geometry" /> <mxGeometry y="210" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-11" value="unit INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-10" value="category INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="240" width="250" height="30" as="geometry" /> <mxGeometry y="240" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-12" value="Groups" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-11" value="unit INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry x="330" y="470" width="180" height="150" as="geometry" /> <mxGeometry y="270" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-13" value="ID SERIAL PRIMARY_KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12"> <mxCell id="JJCkPNM4InE_l2XlKl3H-12" value="Groups" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry y="30" width="180" height="30" as="geometry" /> <mxGeometry x="350" y="470" width="160" height="150" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-14" value="name VARCHAR(64) UNIQUE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12"> <mxCell id="JJCkPNM4InE_l2XlKl3H-13" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-12" vertex="1">
<mxGeometry y="60" width="180" height="30" as="geometry" /> <mxGeometry y="30" width="160" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-15" value="admin_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12"> <mxCell id="JJCkPNM4InE_l2XlKl3H-14" value="name VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-12" vertex="1">
<mxGeometry y="90" width="180" height="30" as="geometry" /> <mxGeometry y="60" width="160" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-36" value="password VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12"> <mxCell id="JJCkPNM4InE_l2XlKl3H-15" value="admin_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-12" vertex="1">
<mxGeometry y="120" width="180" height="30" as="geometry" /> <mxGeometry y="90" width="160" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-17" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-1" target="JJCkPNM4InE_l2XlKl3H-15"> <mxCell id="JJCkPNM4InE_l2XlKl3H-36" value="password VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-12" vertex="1">
<mxGeometry y="120" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-17" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-1" target="JJCkPNM4InE_l2XlKl3H-15" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="400" y="510" as="sourcePoint" /> <mxPoint x="400" y="510" as="sourcePoint" />
<mxPoint x="500" y="410" as="targetPoint" /> <mxPoint x="500" y="410" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-18" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERmany;startArrow=ERmany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-16" target="JJCkPNM4InE_l2XlKl3H-13"> <mxCell id="JJCkPNM4InE_l2XlKl3H-18" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERmany;startArrow=ERmany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-16" target="JJCkPNM4InE_l2XlKl3H-13" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="330" y="530" as="sourcePoint" /> <mxPoint x="330" y="530" as="sourcePoint" />
<mxPoint x="430" y="430" as="targetPoint" /> <mxPoint x="430" y="430" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-21" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-20"> <mxCell id="JJCkPNM4InE_l2XlKl3H-21" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-20" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="400" y="620" as="sourcePoint" /> <mxPoint x="400" y="620" as="sourcePoint" />
<mxPoint x="500" y="520" as="targetPoint" /> <mxPoint x="500" y="520" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-22" value="Categories" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-22" value="Categories" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="577" y="670" width="163" height="120" as="geometry" /> <mxGeometry x="577" y="670" width="140" height="150" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-23" value="ID SERIAL PRIMARY_KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22"> <mxCell id="JJCkPNM4InE_l2XlKl3H-23" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-22" vertex="1">
<mxGeometry y="30" width="163" height="30" as="geometry" /> <mxGeometry y="30" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-25" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22"> <mxCell id="JJCkPNM4InE_l2XlKl3H-25" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-22" vertex="1">
<mxGeometry y="60" width="163" height="30" as="geometry" /> <mxGeometry y="60" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-24" value="name VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22"> <mxCell id="dD14LHGxQFpW1-KiWxnH-1" value="local_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22">
<mxGeometry y="90" width="163" height="30" as="geometry" /> <mxGeometry y="90" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-26" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-25"> <mxCell id="JJCkPNM4InE_l2XlKl3H-24" value="name VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-22" vertex="1">
<mxGeometry y="120" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-26" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-25" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="340" y="600" as="sourcePoint" /> <mxPoint x="340" y="600" as="sourcePoint" />
<mxPoint x="440" y="500" as="targetPoint" /> <mxPoint x="440" y="500" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-27" value="Products&lt;br&gt;" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-27" value="Products&lt;br&gt;" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="930" y="470" width="190" height="210" as="geometry" /> <mxGeometry x="1200" y="450" width="190" height="240" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-28" value="ID SERIAL PRIMARY_KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-28" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="30" width="190" height="30" as="geometry" /> <mxGeometry y="30" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-29" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-29" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="60" width="190" height="30" as="geometry" /> <mxGeometry y="60" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-30" value="abstract_product_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="dD14LHGxQFpW1-KiWxnH-0" value="local_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27">
<mxGeometry y="90" width="190" height="30" as="geometry" /> <mxGeometry y="90" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-32" value="amount INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-30" value="abstract_product_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="120" width="190" height="30" as="geometry" /> <mxGeometry y="120" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-33" value="date_of_production DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-32" value="amount INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="150" width="190" height="30" as="geometry" /> <mxGeometry y="150" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-34" value="expiry_date DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-33" value="date_of_production DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="180" width="190" height="30" as="geometry" /> <mxGeometry y="180" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-31" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-29"> <mxCell id="JJCkPNM4InE_l2XlKl3H-34" value="expiry_date DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="210" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-31" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-29" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="660" y="580" as="sourcePoint" /> <mxPoint x="660" y="580" as="sourcePoint" />
<mxPoint x="760" y="480" as="targetPoint" /> <mxPoint x="760" y="480" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-35" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-5" target="JJCkPNM4InE_l2XlKl3H-30"> <mxCell id="JJCkPNM4InE_l2XlKl3H-35" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="4Zi9I1GNT6whHIKbPsLc-6" target="JJCkPNM4InE_l2XlKl3H-30" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="980" y="340" as="sourcePoint" /> <mxPoint x="980" y="340" as="sourcePoint" />
<mxPoint x="1080" y="240" as="targetPoint" /> <mxPoint x="1080" y="240" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="dD14LHGxQFpW1-KiWxnH-2" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERmany;startArrow=ERmany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="dD14LHGxQFpW1-KiWxnH-1" target="JJCkPNM4InE_l2XlKl3H-10">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="830" y="580" as="sourcePoint" />
<mxPoint x="930" y="480" as="targetPoint" />
</mxGeometry>
</mxCell>
</root> </root>
</mxGraphModel> </mxGraphModel>
</diagram> </diagram>

View File

@ -1,136 +0,0 @@
<mxfile host="Electron" modified="2024-10-25T23:03:19.789Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.0.2 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36" etag="RemdWc7X7YsC5QZmfqTC" version="22.0.2" type="device">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="499" dy="882" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1654" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="JJCkPNM4InE_l2XlKl3H-0" value="Users" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry y="280" width="250" height="150" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-1" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0">
<mxGeometry y="30" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-2" value="username VARCHAR(32) UNIQUE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0">
<mxGeometry y="60" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-3" value="password CHAR(60)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0">
<mxGeometry y="90" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-16" value="groups INT[]" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0">
<mxGeometry y="120" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-4" value="Abstract_products" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="577" y="130" width="250" height="270" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-5" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4">
<mxGeometry y="30" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-20" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4">
<mxGeometry y="60" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-19" value="barcode CHAR(13)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4">
<mxGeometry y="90" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-6" value="name VARCHAR(128)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4">
<mxGeometry y="120" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-8" value="net_weight REAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4">
<mxGeometry y="150" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-9" value="image_filename CHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4">
<mxGeometry y="180" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-10" value="category INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4">
<mxGeometry y="210" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-11" value="unit INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4">
<mxGeometry y="240" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-12" value="Groups" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="330" y="470" width="180" height="150" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-13" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12">
<mxGeometry y="30" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-14" value="name VARCHAR(64) UNIQUE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12">
<mxGeometry y="60" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-15" value="admin_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12">
<mxGeometry y="90" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-36" value="password VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12">
<mxGeometry y="120" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-17" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-1" target="JJCkPNM4InE_l2XlKl3H-15">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="400" y="510" as="sourcePoint" />
<mxPoint x="500" y="410" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-18" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERmany;startArrow=ERmany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-16" target="JJCkPNM4InE_l2XlKl3H-13">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="330" y="530" as="sourcePoint" />
<mxPoint x="430" y="430" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-21" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-20">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="400" y="620" as="sourcePoint" />
<mxPoint x="500" y="520" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-22" value="Categories" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="577" y="670" width="163" height="120" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-23" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22">
<mxGeometry y="30" width="163" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-25" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22">
<mxGeometry y="60" width="163" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-24" value="name VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22">
<mxGeometry y="90" width="163" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-26" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-25">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="340" y="600" as="sourcePoint" />
<mxPoint x="440" y="500" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-27" value="Products&lt;br&gt;" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="930" y="470" width="190" height="210" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-28" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27">
<mxGeometry y="30" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-29" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27">
<mxGeometry y="60" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-30" value="abstract_product_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27">
<mxGeometry y="90" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-32" value="amount INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27">
<mxGeometry y="120" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-33" value="date_of_production DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27">
<mxGeometry y="150" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-34" value="expiry_date DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27">
<mxGeometry y="180" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-31" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-29">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="660" y="580" as="sourcePoint" />
<mxPoint x="760" y="480" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-35" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-5" target="JJCkPNM4InE_l2XlKl3H-30">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="980" y="340" as="sourcePoint" />
<mxPoint x="1080" y="240" as="targetPoint" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

5
.gitignore vendored
View File

@ -130,3 +130,8 @@ dist
.yarn/install-state.gz .yarn/install-state.gz
.pnp.* .pnp.*
#Draw.io
.dtmp
.bkp

View File

@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS Groups (
CREATE TABLE IF NOT EXISTS Abstract_products ( CREATE TABLE IF NOT EXISTS Abstract_products (
ID SERIAL PRIMARY KEY, ID SERIAL PRIMARY KEY,
group_id INT, -- Abstract products are tied to a group of users they were created by group_id INT, -- Abstract products are tied to a group of users they were created by
local_id INT,
barcode CHAR(13), -- EAN13 barcode CHAR(13), -- EAN13
name VARCHAR(128), name VARCHAR(128),
net_weight REAL, net_weight REAL,
@ -26,6 +27,7 @@ CREATE TABLE IF NOT EXISTS Abstract_products (
CREATE TABLE IF NOT EXISTS Categories ( CREATE TABLE IF NOT EXISTS Categories (
ID SERIAL PRIMARY KEY, ID SERIAL PRIMARY KEY,
group_id INT, group_id INT,
local_id INT,
name VARCHAR(64) name VARCHAR(64)
); );

View File

@ -1,135 +1,150 @@
<mxfile host="Electron" modified="2024-10-25T23:03:15.235Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.0.2 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36" etag="Q2moAL3BISTiBrmvIWt3" version="22.0.2" type="device"> <mxfile host="Electron" modified="2024-10-27T00:28:58.581Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.0.2 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36" etag="BWJdj1JyoSHdudScOorK" version="22.0.2" type="device">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1"> <diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="499" dy="882" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1654" pageHeight="1169" math="0" shadow="0"> <mxGraphModel dx="1674" dy="838" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1654" pageHeight="1169" math="0" shadow="0">
<root> <root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" /> <mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" /> <mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="JJCkPNM4InE_l2XlKl3H-0" value="Users" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-0" value="Users" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry y="280" width="250" height="150" as="geometry" /> <mxGeometry y="280" width="250" height="150" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-1" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0"> <mxCell id="JJCkPNM4InE_l2XlKl3H-1" value="ID SERIAL PRIMARY_KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-0" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" /> <mxGeometry y="30" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-2" value="username VARCHAR(32) UNIQUE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0"> <mxCell id="JJCkPNM4InE_l2XlKl3H-2" value="username VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-0" vertex="1">
<mxGeometry y="60" width="250" height="30" as="geometry" /> <mxGeometry y="60" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-3" value="password CHAR(60)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0"> <mxCell id="JJCkPNM4InE_l2XlKl3H-3" value="password CHAR(60)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-0" vertex="1">
<mxGeometry y="90" width="250" height="30" as="geometry" /> <mxGeometry y="90" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-16" value="groups INT[]" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-0"> <mxCell id="JJCkPNM4InE_l2XlKl3H-16" value="groups INT[]" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-0" vertex="1">
<mxGeometry y="120" width="250" height="30" as="geometry" /> <mxGeometry y="120" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-4" value="Abstract_products" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-4" value="Abstract_products" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="577" y="130" width="250" height="270" as="geometry" /> <mxGeometry x="870" y="110" width="250" height="300" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-5" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-5" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" /> <mxGeometry y="30" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-20" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-20" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="60" width="250" height="30" as="geometry" /> <mxGeometry y="60" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-19" value="barcode CHAR(13)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="4Zi9I1GNT6whHIKbPsLc-6" value="local_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="90" width="250" height="30" as="geometry" /> <mxGeometry y="90" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-6" value="name VARCHAR(128)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-19" value="barcode CHAR(13)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="120" width="250" height="30" as="geometry" /> <mxGeometry y="120" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-8" value="net_weight REAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-6" value="name VARCHAR(128)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="150" width="250" height="30" as="geometry" /> <mxGeometry y="150" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-9" value="image_filename CHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-8" value="net_weight REAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="180" width="250" height="30" as="geometry" /> <mxGeometry y="180" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-10" value="category INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-9" value="image_filename CHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="210" width="250" height="30" as="geometry" /> <mxGeometry y="210" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-11" value="unit INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-4"> <mxCell id="JJCkPNM4InE_l2XlKl3H-10" value="category INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry y="240" width="250" height="30" as="geometry" /> <mxGeometry y="240" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-12" value="Groups" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-11" value="unit INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-4" vertex="1">
<mxGeometry x="330" y="470" width="180" height="150" as="geometry" /> <mxGeometry y="270" width="250" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-13" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12"> <mxCell id="JJCkPNM4InE_l2XlKl3H-12" value="Groups" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry y="30" width="180" height="30" as="geometry" /> <mxGeometry x="350" y="470" width="160" height="150" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-14" value="name VARCHAR(64) UNIQUE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12"> <mxCell id="JJCkPNM4InE_l2XlKl3H-13" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-12" vertex="1">
<mxGeometry y="60" width="180" height="30" as="geometry" /> <mxGeometry y="30" width="160" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-15" value="admin_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12"> <mxCell id="JJCkPNM4InE_l2XlKl3H-14" value="name VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-12" vertex="1">
<mxGeometry y="90" width="180" height="30" as="geometry" /> <mxGeometry y="60" width="160" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-36" value="password VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-12"> <mxCell id="JJCkPNM4InE_l2XlKl3H-15" value="admin_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-12" vertex="1">
<mxGeometry y="120" width="180" height="30" as="geometry" /> <mxGeometry y="90" width="160" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-17" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-1" target="JJCkPNM4InE_l2XlKl3H-15"> <mxCell id="JJCkPNM4InE_l2XlKl3H-36" value="password VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-12" vertex="1">
<mxGeometry y="120" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-17" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-1" target="JJCkPNM4InE_l2XlKl3H-15" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="400" y="510" as="sourcePoint" /> <mxPoint x="400" y="510" as="sourcePoint" />
<mxPoint x="500" y="410" as="targetPoint" /> <mxPoint x="500" y="410" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-18" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERmany;startArrow=ERmany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-16" target="JJCkPNM4InE_l2XlKl3H-13"> <mxCell id="JJCkPNM4InE_l2XlKl3H-18" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERmany;startArrow=ERmany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-16" target="JJCkPNM4InE_l2XlKl3H-13" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="330" y="530" as="sourcePoint" /> <mxPoint x="330" y="530" as="sourcePoint" />
<mxPoint x="430" y="430" as="targetPoint" /> <mxPoint x="430" y="430" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-21" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-20"> <mxCell id="JJCkPNM4InE_l2XlKl3H-21" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-20" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="400" y="620" as="sourcePoint" /> <mxPoint x="400" y="620" as="sourcePoint" />
<mxPoint x="500" y="520" as="targetPoint" /> <mxPoint x="500" y="520" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-22" value="Categories" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-22" value="Categories" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="577" y="670" width="163" height="120" as="geometry" /> <mxGeometry x="577" y="670" width="140" height="150" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-23" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22"> <mxCell id="JJCkPNM4InE_l2XlKl3H-23" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-22" vertex="1">
<mxGeometry y="30" width="163" height="30" as="geometry" /> <mxGeometry y="30" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-25" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22"> <mxCell id="JJCkPNM4InE_l2XlKl3H-25" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-22" vertex="1">
<mxGeometry y="60" width="163" height="30" as="geometry" /> <mxGeometry y="60" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-24" value="name VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22"> <mxCell id="dD14LHGxQFpW1-KiWxnH-1" value="local_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-22">
<mxGeometry y="90" width="163" height="30" as="geometry" /> <mxGeometry y="90" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-26" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-25"> <mxCell id="JJCkPNM4InE_l2XlKl3H-24" value="name VARCHAR(64)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-22" vertex="1">
<mxGeometry y="120" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-26" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-25" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="340" y="600" as="sourcePoint" /> <mxPoint x="340" y="600" as="sourcePoint" />
<mxPoint x="440" y="500" as="targetPoint" /> <mxPoint x="440" y="500" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-27" value="Products&lt;br&gt;" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="JJCkPNM4InE_l2XlKl3H-27" value="Products&lt;br&gt;" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="930" y="470" width="190" height="210" as="geometry" /> <mxGeometry x="1200" y="450" width="190" height="240" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-28" value="ID SERIAL PRIMARY KEY" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-28" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="30" width="190" height="30" as="geometry" /> <mxGeometry y="30" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-29" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-29" value="group_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="60" width="190" height="30" as="geometry" /> <mxGeometry y="60" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-30" value="abstract_product_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="dD14LHGxQFpW1-KiWxnH-0" value="local_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27">
<mxGeometry y="90" width="190" height="30" as="geometry" /> <mxGeometry y="90" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-32" value="amount INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-30" value="abstract_product_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="120" width="190" height="30" as="geometry" /> <mxGeometry y="120" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-33" value="date_of_production DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-32" value="amount INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="150" width="190" height="30" as="geometry" /> <mxGeometry y="150" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-34" value="expiry_date DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="JJCkPNM4InE_l2XlKl3H-27"> <mxCell id="JJCkPNM4InE_l2XlKl3H-33" value="date_of_production DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="180" width="190" height="30" as="geometry" /> <mxGeometry y="180" width="190" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-31" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-29"> <mxCell id="JJCkPNM4InE_l2XlKl3H-34" value="expiry_date DATE" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="JJCkPNM4InE_l2XlKl3H-27" vertex="1">
<mxGeometry y="210" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-31" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-13" target="JJCkPNM4InE_l2XlKl3H-29" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="660" y="580" as="sourcePoint" /> <mxPoint x="660" y="580" as="sourcePoint" />
<mxPoint x="760" y="480" as="targetPoint" /> <mxPoint x="760" y="480" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="JJCkPNM4InE_l2XlKl3H-35" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="JJCkPNM4InE_l2XlKl3H-5" target="JJCkPNM4InE_l2XlKl3H-30"> <mxCell id="JJCkPNM4InE_l2XlKl3H-35" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERoneToMany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="4Zi9I1GNT6whHIKbPsLc-6" target="JJCkPNM4InE_l2XlKl3H-30" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="980" y="340" as="sourcePoint" /> <mxPoint x="980" y="340" as="sourcePoint" />
<mxPoint x="1080" y="240" as="targetPoint" /> <mxPoint x="1080" y="240" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="dD14LHGxQFpW1-KiWxnH-2" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERmany;startArrow=ERmany;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="dD14LHGxQFpW1-KiWxnH-1" target="JJCkPNM4InE_l2XlKl3H-10">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="830" y="580" as="sourcePoint" />
<mxPoint x="930" y="480" as="targetPoint" />
</mxGeometry>
</mxCell>
</root> </root>
</mxGraphModel> </mxGraphModel>
</diagram> </diagram>

View File

@ -1,13 +1,53 @@
import AbstractProductService from '../services/abstractproduct.js'; import AbstractProductService from '../services/abstractproduct.js';
import statuses from '../utils/status.js';
import log from '../utils/log.js';
const TAG = "/controllers/abstractproduct.js" const TAG = "/controllers/abstractproduct.js"
class AbstractProductController { class AbstractProductController {
async create(req, res) { async create(req, res) {
const { groupId, barcode, name, net_weight, image_filename, category, unit } = req.body; try {
// console.log(groupId, barcode, name, net_weight, image_filename, category, unit) const { groupId, localId, barcode, name, net_weight, image_filename, category, unit } = req.body;
await AbstractProductService.create(groupId, barcode, name, net_weight, image_filename, category, unit); await AbstractProductService.create(groupId, localId, barcode, name, net_weight, image_filename, category, unit);
return res.status(200).send("Successfull"); return res.status(200).send("Successfull");
} catch (e) {
switch (e.status) {
case statuses.duplicate:
return res.status(400).send(e.message);
default:
log.error(e.original)
return res.status(500).send(e.message)
}
}
}
async update(req, res) {
try {
let { groupId, localId, barcode, name, net_weight, image_filename, category, unit } = req.body;
if (barcode) await AbstractProductService.updateBarcode(groupId, localId, barcode);
if (name) await AbstractProductService.updateName(groupId, localId, name);
if (net_weight) await AbstractProductService.updateNetWeight(groupId, localId, net_weight);
if (image_filename) await AbstractProductService.updateImageFilename(groupId, localId, image_filename);
if (category) await AbstractProductService.updateCategory(groupId, localId, category);
if (unit) await AbstractProductService.updateUnit(groupId, localId, unit);
return res.status(200).send("Successfull");
} catch (e) {
switch (e.status) {
case statuses.invalid_syntax:
log.error(e.original);
return res.status(400).send(e.message);
default:
log.error(e.original);
return res.status(500).send(e.message);
}
}
} }
}; };

View File

@ -0,0 +1,48 @@
import ProductService from '../services/product.js';
import statuses from '../utils/status.js';
import log from '../utils/log.js';
const TAG = "/controllers/product.js"
class AbstractProductController {
async create(req, res) {
try {
const { groupId, localId, abstract_product_id, amount, date_of_production, expiry_date } = req.body;
await ProductService.create(groupId, localId, abstract_product_id, amount, date_of_production, expiry_date);
return res.status(200).send("Successfull");
} catch (e) {
switch (e.status) {
case statuses.duplicate:
return res.status(400).send(e.message);
default:
log.error(e.original)
return res.status(500).send(e.message)
}
}
}
async update(req, res) {
try {
let { groupId, localId, abstract_product_id, amount, date_of_production, expiry_date } = req.body;
if (abstract_product_id) await ProductService.updateAbstractProductId(groupId, localId, abstract_product_id);
if (amount) await ProductService.updateAmount(groupId, localId, amount)
if (date_of_production) await ProductService.updateDateOfProduction(groupId, localId, date_of_production);
if (expiry_date) await ProductService.updateExpiryDate(groupId, localId, expiry_date);
} catch (e) {
switch (e.status) {
case statuses.invalid_syntax:
log.error(e.original);
return res.status(400).send(e.message);
}
}
return res.status(200).send("Successfull");
}
};
export default new AbstractProductController();

View File

@ -2,13 +2,15 @@ import UserService from '../services/user.js';
import log from '../utils/log.js'; import log from '../utils/log.js';
import bcrypt from 'bcrypt'; import bcrypt from 'bcrypt';
import genToken from '../utils/jwt.js'; import genToken from '../utils/jwt.js';
import AbstractProductService from '../services/abstractproduct.js';
import ProductService from '../services/product.js';
const TAG = "/controllers/userjs" const TAG = "/controllers/userjs"
class UserController { class UserController {
async register (req, res) { async register(req, res) {
try { try {
const {username, password} = req.body; const { username, password } = req.body;
await UserService.create(username, password); await UserService.create(username, password);
@ -19,7 +21,7 @@ class UserController {
async login(req, res) { async login(req, res) {
try { try {
const {username, password} = req.body; const { username, password } = req.body;
const user = await UserService.getByUsername(username); const user = await UserService.getByUsername(username);
if (!bcrypt.compareSync(password, user.password)) return res.status(401).send("Wrong password"); if (!bcrypt.compareSync(password, user.password)) return res.status(401).send("Wrong password");
@ -28,6 +30,19 @@ class UserController {
return res.status(200).send(token); return res.status(200).send(token);
} catch (e) { res.status(500).send(log.unknownError(`${TAG}/login: ${e}`)); } } catch (e) { res.status(500).send(log.unknownError(`${TAG}/login: ${e}`)); }
} }
async synchronize(req, res) {
try {
const { groupId } = req.params;
let result = {}
result.abstract_products = await AbstractProductService.getAll(groupId);
result.products = await ProductService.getAll(groupId);
// result.categories = await CategoryService.getAll(groupId);
return res.status(200).json(result);
} catch (e) { res.status(500).send(log.unknownError(`${TAG}/synchronize: ${e}`)); }
}
} }
export default new UserController() export default new UserController()

View File

@ -6,7 +6,7 @@ import config from '../config.json' with {type: "json"};
const { Pool } = pg; const { Pool } = pg;
log.debug( log.debug(
`Connecting to PG database ${config.dbname}@${config.dbhost}:${config.dbport} with credentials: `Connecting to PG database ${config.dbname}@${config.dbhost}:${config.dbport} with credentials:
username: ${config.dbuser} username: ${config.dbuser}
password: <hidden>` password: <hidden>`
); );
@ -19,7 +19,7 @@ const pool = new Pool({
password: config.dbpassword password: config.dbpassword
}); });
log.debug("Database connection successful. Creating tables"); log.debug("Database connection successfull. Creating tables");
pool.query(fs.readFileSync('./db_schema.psql').toString()); pool.query(fs.readFileSync('./db_schema.psql').toString());

View File

@ -2,19 +2,20 @@ import express from 'express';
import UserRouter from './routers/user.js'; import UserRouter from './routers/user.js';
import GroupRouter from './routers/group.js'; import GroupRouter from './routers/group.js';
import AbstractProductRouter from './routers/abstractproduct.js'; import AbstractProductRouter from './routers/abstractproduct.js';
// import AdminRouter from './routers/admin.js';
import log from './utils/log.js' import log from './utils/log.js'
import config from '../config.json' with {type: "json"}; import config from '../config.json' with {type: "json"};
import ProductRouter from './routers/product.js';
const app = express(); const app = express();
app.use(express.urlencoded({extended: true})); app.use(express.urlencoded({ extended: true }));
app.use(express.json()); app.use(express.json());
app.use('/api/user/', UserRouter); app.use('/api/user/', UserRouter);
app.use('/api/group/', GroupRouter); app.use('/api/group/', GroupRouter);
app.use('/api/abstractproduct', AbstractProductRouter); app.use('/api/abstractproduct', AbstractProductRouter);
// app.use('/api/admin/', AdminRouter); app.use('/api/product', ProductRouter);
app.listen(config.port, () => { app.listen(config.port, () => {
log.info(`Application has started on port ${config.port}`) log.info(`Application has started on port ${config.port}`)

View File

@ -10,9 +10,9 @@ const requireUsername = async (req, res, next) => {
if (req.method == "OPTIONS") next(); if (req.method == "OPTIONS") next();
try { try {
const {username} = req.body; const { username } = req.body;
if (!username) return res.status(400).send("Username is required"); if (!username) return res.status(400).send("Username is required");
next(); next();
} catch (e) { return res.status(500).send(unknownError(`${TAG}/requireUsername: ${e}`)); } } catch (e) { return res.status(500).send(unknownError(`${TAG}/requireUsername: ${e}`)); }
} }
@ -20,9 +20,9 @@ const requirePassword = async (req, res, next) => {
if (req.method == "OPTIONS") next(); if (req.method == "OPTIONS") next();
try { try {
const {password} = req.body; const { password } = req.body;
if (!password) return res.status(400).send("Password is required"); if (!password) return res.status(400).send("Password is required");
next(); next();
} catch (e) { return res.status(500).send(unknownError(`${TAG}/requirePassword: ${e}`)); } } catch (e) { return res.status(500).send(unknownError(`${TAG}/requirePassword: ${e}`)); }
} }
@ -67,7 +67,7 @@ const checkGroupPassword = async (req, res, next) => {
if (groupPassword != password) return res.status(403).send("Wrong password"); if (groupPassword != password) return res.status(403).send("Wrong password");
next(); next();
} catch (e) {return res.status(500).send(log.unknownError(`${TAG}/checkGroupPassword: ${e}`));} } catch (e) { return res.status(500).send(log.unknownError(`${TAG}/checkGroupPassword: ${e}`)); }
} }
const userIsInGroup = async (req, res, next) => { const userIsInGroup = async (req, res, next) => {

View File

@ -1,5 +1,7 @@
import UserService from '../services/user.js'; import UserService from '../services/user.js';
import GroupService from '../services/group.js'; import GroupService from '../services/group.js';
import AbstractProductService from '../services/abstractproduct.js';
import ProductService from '../services/product.js';
import log from '../utils/log.js'; import log from '../utils/log.js';
import statuses from '../utils/status.js'; import statuses from '../utils/status.js';
@ -57,4 +59,34 @@ const groupNameDoesntExist = async (req, res, next) => {
} catch (e) { return res.status(500).send(log.unknownError(`${TAG}/groupNameDoesntExist: ${e}`)) } } catch (e) { return res.status(500).send(log.unknownError(`${TAG}/groupNameDoesntExist: ${e}`)) }
} }
export default { usernameExists, usernameDoesntExist, groupExists, groupDoesntExist, groupNameDoesntExist } const abstractProductExists = async (req, res, next) => {
try {
const { groupId, localId } = req.body;
let result = await AbstractProductService.exists(groupId, localId);
if (!result) return res.status(404).send("Abstract product not found");
next();
} catch (e) { return res.status(500).send(log.unknownError(`${TAG}/abstractProductExists: ${e}`)) }
}
const productExists = async (req, res, next) => {
try {
const { groupId, localId } = req.body;
let result = await ProductService.exists(groupId, localId);
if (!result) return res.status(404).send("Product not found");
next();
} catch (e) { return res.status(500).send(log.unknownError(`${TAG}/productExists: ${e}`)) }
}
export default {
usernameExists,
usernameDoesntExist,
groupExists,
groupDoesntExist,
groupNameDoesntExist,
abstractProductExists,
productExists
}

View File

@ -6,5 +6,6 @@ import existance from '../middlewares/existance.js';
const AbstractProductRouter = new Router(); const AbstractProductRouter = new Router();
AbstractProductRouter.post('/create', auth.authenticate, existance.groupExists, auth.userIsInGroup, AbstractProductController.create); AbstractProductRouter.post('/create', auth.authenticate, existance.groupExists, auth.userIsInGroup, AbstractProductController.create);
AbstractProductRouter.post('/update', auth.authenticate, existance.groupExists, auth.userIsInGroup, existance.abstractProductExists, AbstractProductController.update)
export default AbstractProductRouter; export default AbstractProductRouter;

11
src/routers/product.js Normal file
View File

@ -0,0 +1,11 @@
import { Router } from 'express';
import auth from '../middlewares/auth.js';
import ProductController from '../controllers/product.js'
import existance from '../middlewares/existance.js';
const ProductRouter = new Router();
ProductRouter.post('/create', auth.authenticate, existance.groupExists, auth.userIsInGroup, ProductController.create);
ProductRouter.post('/update', auth.authenticate, existance.groupExists, auth.userIsInGroup, existance.productExists, ProductController.update)
export default ProductRouter;

View File

@ -7,5 +7,6 @@ const UserRouter = new Router();
UserRouter.post('/register', auth.requireUsername, auth.requirePassword, existance.usernameDoesntExist, UserController.register); UserRouter.post('/register', auth.requireUsername, auth.requirePassword, existance.usernameDoesntExist, UserController.register);
UserRouter.post('/login', auth.requireUsername, auth.requirePassword, existance.usernameExists, UserController.login); UserRouter.post('/login', auth.requireUsername, auth.requirePassword, existance.usernameExists, UserController.login);
UserRouter.get('/synchronize/:groupId', auth.authenticate, existance.groupExists, auth.userIsInGroup, UserController.synchronize);
export default UserRouter; export default UserRouter;

View File

@ -1,9 +1,67 @@
import db from '../db.js'; import db from '../db.js';
import statuses from '../utils/status.js';
import errorHandler from '../utils/pgerrorhandler.js';
class AbstractProductService { class AbstractProductService {
async create (groupid, barcode, name, net_weight, image_filename, category, unit) { async create(groupid, localid, barcode, name, net_weight, image_filename, category, unit) {
await db.query("INSERT INTO abstract_products (group_id, barcode, name, net_weight, image_filename, category, unit) VALUES ($1, $2, $3, $4, $5, $6, $7)", [groupid, barcode, name, net_weight, image_filename, category, unit]); await db.query("INSERT INTO abstract_products (group_id, local_id, barcode, name, net_weight, image_filename, category, unit) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)", [groupid, localid, barcode, name, net_weight, image_filename, category, unit])
.catch((e) => {
errorHandler(e, "abstract product")
});
}
async updateBarcode(groupId, localId, barcode) {
await db.query("UPDATE abstract_products SET barcode = $1 WHERE group_id = $2 AND local_id = $3", [barcode, groupId, localId])
.catch((e) => {
errorHandler(e, "barcode")
});
}
async updateName(groupId, localId, name) {
await db.query("UPDATE abstract_products SET name = $1 WHERE group_id = $2 AND local_id = $3", [name, groupId, localId])
.catch((e) => {
errorHandler(e, "name")
});
}
async updateNetWeight(groupId, localId, net_weight) {
await db.query("UPDATE abstract_products SET net_weight = $1 WHERE group_id = $2 AND local_id = $3", [net_weight, groupId, localId]
.catch((e) => {
errorHandler(e, "net weight")
}));
}
async updateImageFilename(groupId, localId, image_filename) {
await db.query("UPDATE abstract_products SET image_filename = $1 WHERE group_id = $2 AND local_id = $3", [image_filename, groupId, localId])
.catch((e) => {
errorHandler(e, "image filename")
});
}
async updateCategory(groupId, localId, category) {
await db.query("UPDATE abstract_products SET category = $1 WHERE group_id = $2 AND local_id = $3", [category, groupId, localId])
.catch((e) => {
errorHandler(e, "category")
});
}
async updateUnit(groupId, localId, unit) {
await db.query("UPDATE abstract_products SET unit = $1 WHERE group_id = $2 AND local_id = $3", [unit, groupId, localId])
.catch((e) => {
errorHandler(e, "unit")
});
}
async getAll(groupId) {
let result = (await db.query("SELECT local_id, barcode, name, net_weight, image_filename, category, unit FROM abstract_products WHERE group_id = $1", [groupId])).rows
if (!result) return statuses.not_found;
return result
}
async exists(groupId, localId) {
let result = (await db.query("SELECT * FROM abstract_products WHERE group_id = $1 AND local_id = $2", [groupId, localId])).rowCount;
if (!result) return false;
return true;
} }
}; };

View File

@ -1,13 +1,10 @@
import db from '../db.js'; import db from '../db.js';
import errorHandler from '../utils/pgerrorhandler.js';
import status from '../utils/status.js'; import status from '../utils/status.js';
class GroupService { class GroupService {
async create(name, creatorId) { async create(name, creatorId) {
let res = await db.query("INSERT INTO groups (name, admin_id) VALUES ($1, $2) RETURNING ID", [name, creatorId]).catch (e => { let res = await db.query("INSERT INTO groups (name, admin_id) VALUES ($1, $2) RETURNING ID", [name, creatorId]).catch(errorHandler)
if (e.code == 23505) { // already exists
return status.duplicate;
}
})
return res.rows[0]; return res.rows[0];
} }

55
src/services/product.js Normal file
View File

@ -0,0 +1,55 @@
import db from '../db.js';
import statuses from '../utils/status.js';
import errorHandler from '../utils/pgerrorhandler.js';
class ProductService {
async create(groupid, localid, abstract_product_id, amount, date_of_production, expiry_date) {
await db.query("INSERT INTO products (group_id, local_id, abstract_product_id, amount, date_of_production, expiry_date) VALUES ($1, $2, $3, $4, $5, $6)", [groupid, localid, abstract_product_id, amount, date_of_production, expiry_date])
.catch((e) => {
errorHandler(e, "Abstract Product")
})
}
async updateAbstractProductId(groupId, localId, abstract_product_id) {
await db.query("UPDATE products SET abstract_product_id = $1 WHERE group_id = $2 AND local_id = $3", [abstract_product_id, groupId, localId])
.catch((e) => {
errorHandler(e, "abstract product id")
});
}
async updateAmount(groupId, localId, amount) {
await db.query("UPDATE products SET amount = $1 WHERE group_id = $2 AND local_id = $3", [amount, groupId, localId])
.catch((e) => {
errorHandler(e, "amount")
});
}
async updateDateOfProduction(groupId, localId, date_of_production) {
await db.query("UPDATE products SET date_of_production = $1 WHERE group_id = $2 AND local_id = $3", [date_of_production, groupId, localId])
.catch((e) => {
errorHandler(e, "date of production")
})
}
async updateExpiryDate(groupId, localId, expiry_date) {
await db.query("UPDATE products SET expiry_date = $1 WHERE group_id = $2 AND local_id = $3", [expiry_date, groupId, localId])
.catch((e) => {
errorHandler(e, "expiry date")
})
}
async getAll(groupId) {
let result = (await db.query("SELECT local_id, abstract_product_id, amount, date_of_production, expiry_date FROM products WHERE group_id = $1", [groupId])).rows
if (!result) return statuses.not_found;
return result
}
async exists(groupId, localId) {
let result = (await db.query("SELECT * FROM products WHERE group_id = $1 AND local_id = $2", [groupId, localId])).rowCount;
if (!result) return false;
return true;
}
};
export default new ProductService();

View File

@ -3,11 +3,9 @@ import statuses from '../utils/status.js';
import bcrypt from 'bcrypt'; import bcrypt from 'bcrypt';
class UserService { class UserService {
async create (username, password) { async create(username, password) {
await db.query("INSERT INTO users (username, password) VALUES ($1, $2)", [username, bcrypt.hashSync(password, 12)]).catch (e => { await db.query("INSERT INTO users (username, password) VALUES ($1, $2)", [username, bcrypt.hashSync(password, 12)]).catch((e) => {
if (e.code == 23505) { // already exists errorHandler(e, "user")
return statuses.duplicate
}
}) })
return statuses.ok return statuses.ok
} }

View File

@ -1,11 +0,0 @@
import { createHash } from 'node:crypto'
const hashAbstractProduct = (barcode, name, net_weight, image_filename, category, unit) => {
return createHash('md5').update(`${barcode}${name}${net_weight}${image_filename}${category}${unit}`).digest('hex');
}
const hashProduct = (abstract_product_id, amount, date_of_production, expiry_date) => {
return createHash('md5').update(`${abstract_product_id}${amount}${date_of_production}${expiry_date}`).digest('hex');
}
export default { hashAbstractProduct, hashProduct };

View File

@ -3,7 +3,7 @@ import config from '../../config.json' with {type: "json"};
const genToken = (login) => { const genToken = (login) => {
const payload = { login }; const payload = { login };
return jwt.sign(payload, config.secret, {expiresIn: "7d"}); return jwt.sign(payload, config.secret, { expiresIn: "7d" });
}; };
export default genToken; export default genToken;

View File

@ -0,0 +1,29 @@
import statuses from "./status.js"
const errorHandler = (e, obj) => {
switch (e.code) {
case '23505':
throw {
status: statuses.duplicate,
message: `Such ${obj} already exists`
}
case '22007':
throw {
status: statuses.invalid_syntax,
message: `Invalid syntax in ${obj}`
}
case '22001':
throw {
status: statuses.invalid_syntax,
message: `Value too long (${obj})`
}
default:
throw {
status: statuses.unknown,
message: `Unknown error. Please, report to the developer`,
original: e
}
}
};
export default errorHandler;

View File

@ -1,7 +1,9 @@
const statuses = { const statuses = {
ok: "ok", ok: "ok",
duplicate: "duplicate", duplicate: "duplicate",
not_found: "not found" not_found: "not found",
invalid_syntax: "invalid syntax",
unknown: "unknown"
} }
export default statuses export default statuses