Changed database tables

main
Filip Borum Poulsen 3 years ago
parent 10c2b6b0b8
commit 17f98a2928

@ -1,17 +1,17 @@
<mxfile host="65bd71144e">
<mxfile host="Electron" modified="2023-04-16T16:47:21.807Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.1.2 Chrome/106.0.5249.199 Electron/21.4.3 Safari/537.36" version="21.1.2" etag="Q3gk7VdNL8tA41-1b-5R" type="device">
<diagram id="R2lEEEUBdFMjLlhIrx00" name="Page-1">
<mxGraphModel dx="739" dy="1961" 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" extFonts="Permanent Marker^https://fonts.googleapis.com/css?family=Permanent+Marker">
<mxGraphModel dx="1434" dy="2013" 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" extFonts="Permanent Marker^https://fonts.googleapis.com/css?family=Permanent+Marker">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="C-vyLk0tnHw3VtMMgP7b-1" value="" style="edgeStyle=entityRelationEdgeStyle;endArrow=ERzeroToMany;startArrow=ERone;endFill=1;startFill=0;" parent="1" source="44" target="C-vyLk0tnHw3VtMMgP7b-6" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="340" y="720" as="sourcePoint"/>
<mxPoint x="440" y="620" as="targetPoint"/>
<mxPoint x="340" y="830" as="sourcePoint" />
<mxPoint x="440" y="730" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="C-vyLk0tnHw3VtMMgP7b-2" value="orders" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" parent="1" vertex="1">
<mxGeometry x="577" y="550" width="250" height="220" as="geometry"/>
<mxGeometry x="560" y="200" width="250" height="220" as="geometry" />
</mxCell>
<mxCell id="C-vyLk0tnHw3VtMMgP7b-3" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="C-vyLk0tnHw3VtMMgP7b-2" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" />
@ -52,47 +52,47 @@
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-10" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-2" vertex="1">
<mxCell id="91" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-2" vertex="1">
<mxGeometry y="120" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-11" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="VXEZj9PDGR0_IzT7xE4M-10" vertex="1">
<mxCell id="92" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="91" vertex="1">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-12" value="time timestamp" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="VXEZj9PDGR0_IzT7xE4M-10" vertex="1">
<mxCell id="93" value="order_status OrderStatus" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="91" vertex="1">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-15" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-2" vertex="1">
<mxCell id="104" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-2" vertex="1">
<mxGeometry y="150" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-16" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="VXEZj9PDGR0_IzT7xE4M-15" vertex="1">
<mxCell id="105" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="104" vertex="1">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-17" value="duration interval" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="VXEZj9PDGR0_IzT7xE4M-15" vertex="1">
<mxCell id="106" value="price int" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="104" vertex="1">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="91" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-2" vertex="1">
<mxCell id="axY-a4Oc4OsDCfNMIFES-106" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="C-vyLk0tnHw3VtMMgP7b-2">
<mxGeometry y="180" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="92" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="91" vertex="1">
<mxCell id="axY-a4Oc4OsDCfNMIFES-107" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" vertex="1" parent="axY-a4Oc4OsDCfNMIFES-106">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="93" value="order_status OrderStatus" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="91" vertex="1">
<mxCell id="axY-a4Oc4OsDCfNMIFES-108" value="created_at timestamp" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" vertex="1" parent="axY-a4Oc4OsDCfNMIFES-106">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="C-vyLk0tnHw3VtMMgP7b-23" value="users" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" parent="1" vertex="1">
<mxGeometry x="150" y="400" width="250" height="220" as="geometry"/>
<mxGeometry x="130" y="200" width="250" height="220" as="geometry" />
</mxCell>
<mxCell id="C-vyLk0tnHw3VtMMgP7b-24" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="C-vyLk0tnHw3VtMMgP7b-23" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" />
@ -115,46 +115,46 @@
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="C-vyLk0tnHw3VtMMgP7b-29" value="name text" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="C-vyLk0tnHw3VtMMgP7b-27" vertex="1">
<mxCell id="C-vyLk0tnHw3VtMMgP7b-29" value="first_name text" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="C-vyLk0tnHw3VtMMgP7b-27" vertex="1">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-1" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-23" vertex="1">
<mxCell id="axY-a4Oc4OsDCfNMIFES-109" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="C-vyLk0tnHw3VtMMgP7b-23">
<mxGeometry y="90" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-2" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="VXEZj9PDGR0_IzT7xE4M-1" vertex="1">
<mxCell id="axY-a4Oc4OsDCfNMIFES-110" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" vertex="1" parent="axY-a4Oc4OsDCfNMIFES-109">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-3" value="email text" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="VXEZj9PDGR0_IzT7xE4M-1" vertex="1">
<mxCell id="axY-a4Oc4OsDCfNMIFES-111" value="last_name text" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" vertex="1" parent="axY-a4Oc4OsDCfNMIFES-109">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-4" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-23" vertex="1">
<mxCell id="VXEZj9PDGR0_IzT7xE4M-1" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-23" vertex="1">
<mxGeometry y="120" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-5" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="VXEZj9PDGR0_IzT7xE4M-4" vertex="1">
<mxCell id="VXEZj9PDGR0_IzT7xE4M-2" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="VXEZj9PDGR0_IzT7xE4M-1" vertex="1">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-6" value="password_hash text" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="VXEZj9PDGR0_IzT7xE4M-4" vertex="1">
<mxCell id="VXEZj9PDGR0_IzT7xE4M-3" value="email text" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="VXEZj9PDGR0_IzT7xE4M-1" vertex="1">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-7" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-23" vertex="1">
<mxCell id="VXEZj9PDGR0_IzT7xE4M-4" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-23" vertex="1">
<mxGeometry y="150" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-8" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="VXEZj9PDGR0_IzT7xE4M-7" vertex="1">
<mxCell id="VXEZj9PDGR0_IzT7xE4M-5" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="VXEZj9PDGR0_IzT7xE4M-4" vertex="1">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="VXEZj9PDGR0_IzT7xE4M-9" value="user_type UserType" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="VXEZj9PDGR0_IzT7xE4M-7" vertex="1">
<mxCell id="VXEZj9PDGR0_IzT7xE4M-6" value="password_hash text" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="VXEZj9PDGR0_IzT7xE4M-4" vertex="1">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
@ -179,7 +179,7 @@
</mxGeometry>
</mxCell>
<mxCell id="2" value="trainers" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" parent="1" vertex="1">
<mxGeometry x="560" y="90" width="250" height="160" as="geometry"/>
<mxGeometry x="560" y="670" width="250" height="160" as="geometry" />
</mxCell>
<mxCell id="3" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="2" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" />
@ -240,7 +240,7 @@
</mxGeometry>
</mxCell>
<mxCell id="19" value="centers" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" parent="1" vertex="1">
<mxGeometry x="150" y="90" width="250" height="190" as="geometry"/>
<mxGeometry x="130" y="670" width="250" height="190" as="geometry" />
</mxCell>
<mxCell id="20" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="19" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" />
@ -314,7 +314,7 @@
</mxGeometry>
</mxCell>
<mxCell id="43" value="reserved_timeslots" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" parent="1" vertex="1">
<mxGeometry x="570" y="340" width="250" height="190" as="geometry"/>
<mxGeometry x="560" y="460" width="250" height="160" as="geometry" />
</mxCell>
<mxCell id="44" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="43" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" />
@ -342,21 +342,8 @@
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="62" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="43" vertex="1">
<mxGeometry y="90" width="250" height="30" as="geometry"/>
</mxCell>
<mxCell id="63" value="FK" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="62" vertex="1">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="64" value="user_id int" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="62" vertex="1">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="50" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="43" vertex="1">
<mxGeometry y="120" width="250" height="30" as="geometry"/>
<mxGeometry y="90" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="51" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="50" vertex="1">
<mxGeometry width="30" height="30" as="geometry">
@ -369,7 +356,7 @@
</mxGeometry>
</mxCell>
<mxCell id="53" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="43" vertex="1">
<mxGeometry y="150" width="250" height="30" as="geometry"/>
<mxGeometry y="120" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="54" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="53" vertex="1">
<mxGeometry width="30" height="30" as="geometry">
@ -381,14 +368,8 @@
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="66" value="" style="edgeStyle=entityRelationEdgeStyle;endArrow=ERzeroToMany;startArrow=ERone;endFill=1;startFill=0;" parent="1" source="C-vyLk0tnHw3VtMMgP7b-24" target="62" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="780" y="335" as="sourcePoint"/>
<mxPoint x="780" y="634.9999999999998" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="67" value="blocked_timeslots" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" parent="1" vertex="1">
<mxGeometry x="960" y="60" width="250" height="160" as="geometry"/>
<mxCell id="67" value="weekly_timeslots" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" parent="1" vertex="1">
<mxGeometry x="920" y="640" width="250" height="190" as="geometry" />
</mxCell>
<mxCell id="68" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="67" vertex="1">
<mxGeometry y="30" width="250" height="30" as="geometry" />
@ -424,7 +405,7 @@
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="79" value="start_time timestamp" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="77" vertex="1">
<mxCell id="79" value="day_of_week int" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="77" vertex="1">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
@ -437,37 +418,38 @@
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="82" value="end_time timestamp" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="80" vertex="1">
<mxCell id="82" value="start_time time" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="80" vertex="1">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="101" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="67" vertex="1">
<mxGeometry y="150" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="102" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="101" vertex="1">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="103" value="end_time time" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="101" vertex="1">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="83" value="" style="edgeStyle=entityRelationEdgeStyle;endArrow=ERzeroToMany;startArrow=ERone;endFill=1;startFill=0;" parent="1" source="3" target="71" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="780" y="335" as="sourcePoint"/>
<mxPoint x="780" y="635" as="targetPoint"/>
<mxPoint x="780" y="455" as="sourcePoint" />
<mxPoint x="780" y="755" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="65" value="" style="edgeStyle=entityRelationEdgeStyle;endArrow=ERzeroToMany;startArrow=ERone;endFill=1;startFill=0;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=middle;" parent="1" source="3" target="47" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="290" y="674.41" as="sourcePoint"/>
<mxPoint x="430" y="674.41" as="targetPoint"/>
<mxPoint x="290" y="1044.4099999999999" as="sourcePoint" />
<mxPoint x="430" y="1044.4099999999999" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="87" value="UserType" 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="1" vertex="1">
<mxGeometry x="150" y="-150" width="140" height="120" as="geometry"/>
</mxCell>
<mxCell id="88" value="User" 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="87" vertex="1">
<mxGeometry y="30" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="89" value="Trainer" 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="87" vertex="1">
<mxGeometry y="60" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="90" value="Admin" 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="87" vertex="1">
<mxGeometry y="90" width="140" height="30" as="geometry"/>
</mxCell>
<mxCell id="94" value="OrderStatus" 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="1" vertex="1">
<mxGeometry x="310" y="-150" width="140" height="120" as="geometry"/>
<mxGeometry x="130" y="-140" width="140" height="120" as="geometry" />
</mxCell>
<mxCell id="95" value="Processing" 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="94" vertex="1">
<mxGeometry y="30" width="140" height="30" as="geometry" />
@ -478,6 +460,28 @@
<mxCell id="97" value="Cancelled" 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="94" vertex="1">
<mxGeometry y="90" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="axY-a4Oc4OsDCfNMIFES-133" value="admins" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" vertex="1" parent="1">
<mxGeometry x="130" y="460" width="250" height="70" as="geometry" />
</mxCell>
<mxCell id="axY-a4Oc4OsDCfNMIFES-134" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" vertex="1" parent="axY-a4Oc4OsDCfNMIFES-133">
<mxGeometry y="30" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="axY-a4Oc4OsDCfNMIFES-135" value="PK" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;fontStyle=1;" vertex="1" parent="axY-a4Oc4OsDCfNMIFES-134">
<mxGeometry width="30" height="30" as="geometry">
<mxRectangle width="30" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="axY-a4Oc4OsDCfNMIFES-136" value="user_id serial" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;fontStyle=1;" vertex="1" parent="axY-a4Oc4OsDCfNMIFES-134">
<mxGeometry x="30" width="220" height="30" as="geometry">
<mxRectangle width="220" height="30" as="alternateBounds" />
</mxGeometry>
</mxCell>
<mxCell id="axY-a4Oc4OsDCfNMIFES-155" value="" style="edgeStyle=entityRelationEdgeStyle;endArrow=ERzeroToMany;startArrow=ERone;endFill=1;startFill=0;" edge="1" parent="1" source="C-vyLk0tnHw3VtMMgP7b-24" target="axY-a4Oc4OsDCfNMIFES-134">
<mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="390" y="255" as="sourcePoint" />
<mxPoint x="570" y="835" as="targetPoint" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>

@ -4,16 +4,20 @@ dotenv.config();
import { client } from "../db";
client.query(`
DROP TABLE IF EXISTS public.orders;
DROP TABLE IF EXISTS public.reserved_timeslots;
DROP TABLE IF EXISTS public.weekly_timeslots;
DROP TABLE IF EXISTS public.trainers;
DROP TABLE IF EXISTS public.centers;
DROP TABLE IF EXISTS public.admins;
DROP TABLE IF EXISTS public.users;
DROP TYPE IF EXISTS public."UserType";
DROP TYPE IF EXISTS public."OrderStatus";
CREATE TYPE public."UserType" AS ENUM
CREATE TYPE public."OrderStatus" AS ENUM
(
'User',
'Trainer',
'Admin'
'Processing',
'Payed',
'Cancelled'
);
CREATE TABLE public.users
@ -23,10 +27,14 @@ CREATE TABLE public.users
last_name text NOT NULL,
email text NOT NULL UNIQUE,
password_hash text NOT NULL,
user_type "UserType" NOT NULL DEFAULT 'User',
email_verified boolean NOT NULL DEFAULT false
);
CREATE TABLE public.admins
(
user_id int REFERENCES users(id) NOT NULL PRIMARY KEY
);
CREATE TABLE public.centers
(
id serial NOT NULL PRIMARY KEY,
@ -43,6 +51,33 @@ CREATE TABLE public.trainers
center_id int REFERENCES centers(id) NOT NULL,
hourly_price int NOT NULL
);
CREATE TABLE public.weekly_timeslots
(
id serial NOT NULL PRIMARY KEY,
trainer_id int REFERENCES trainers(id) NOT NULL,
day_of_week int NOT NULL,
start_time time NOT NULL,
end_time time NOT NULL
);
CREATE TABLE public.reserved_timeslots
(
id serial NOT NULL PRIMARY KEY,
trainer_id int REFERENCES trainers(id) NOT NULL,
start_time timestamp NOT NULL,
end_time timestamp NOT NULL
);
CREATE TABLE public.orders
(
id serial NOT NULL PRIMARY KEY,
timeslot_id int REFERENCES reserved_timeslots(id) NOT NULL,
user_id int REFERENCES users(id) NOT NULL,
order_status "OrderStatus" NOT NULL DEFAULT 'Processing',
price int NOT NULL,
create_at timestamp NOT NULL DEFAULT NOW()
);
`)
.then(()=>{
return client.end();

@ -7,16 +7,26 @@ async function main() {
const users = await client.query(`
INSERT INTO users (first_name, last_name, email, password_hash, user_type) VALUES
('Filip', 'B P', 'fbp@example.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', 'Admin'),
('User1', 'Lastname', 'u1@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', 'User'),
('User2', 'Lastname', 'u2@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', 'User'),
('Trainer1', 'Lastname', 't1@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', 'Trainer'),
('Trainer2', 'Lastname', 't2@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', 'Trainer'),
('Admin1', 'Lastname', 'a1@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', 'Admin')
INSERT INTO users (first_name, last_name, email, password_hash, email_verified) VALUES
('Filip', 'B P', 'fbp@example.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', true),
('User1', 'Lastname', 'u1@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', true),
('User2', 'Lastname', 'u2@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', true),
('User3', 'Lastname', 'u3@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', true),
('Trainer1', 'Lastname', 't1@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', true),
('Trainer2', 'Lastname', 't2@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', true),
('Admin1', 'Lastname', 'a1@test.com', '$2b$10$zxqwqZXo3DrLVTFx.hkQQ.uKeqhHMnok.G/4.Ivq1g647RaqYtgKC', true)
RETURNING id, email;
`);
const admins = await client.query(`
INSERT INTO admins (user_id) VALUES
($1),
($2);
`, [
users.rows.find(user => user.email === "a1@test.com").id,
users.rows.find(user => user.email === "fbp@example.com").id
]);
const centers = await client.query(`
INSERT INTO centers (name, city, zip_code, address) VALUES
('Herning Fitness', 'Herning', '7400', 'Vej 123'),
@ -36,6 +46,51 @@ RETURNING id, user_id;
centers.rows[1].id,
]);
const weekly_timeslots = await client.query(`
INSERT INTO weekly_timeslots (trainer_id, day_of_week, start_time, end_time) VALUES
($1, 0, '11:00:00', '12:00:00'),
($1, 1, '10:00:00', '13:00:00'),
($1, 2, '10:00:00', '15:00:00'),
($2, 0, '10:00:00', '11:00:00'),
($2, 0, '11:00:00', '12:00:00'),
($2, 0, '12:00:00', '13:00:00')
RETURNING id;
`, [
trainers.rows[0].id,
trainers.rows[1].id
]);
const reserved_timeslots = await client.query(`
INSERT INTO reserved_timeslots (trainer_id, start_time, end_time) VALUES
($1, '2023-04-17 11:00:00+2', '2023-04-17 12:00:00+2'),
($1, '2023-04-18 12:00:00+2', '2023-04-17 13:00:00+2'),
($1, '2023-04-24 11:00:00+2', '2023-04-24 12:00:00+2'),
($2, '2023-04-17 11:00:00+2', '2023-04-17 12:00:00+2'),
($2, '2023-04-10 12:00:00+2', '2023-04-10 13:00:00+2')
RETURNING id, trainer_id;
`, [
trainers.rows[0].id,
trainers.rows[1].id
]);
const orders = await client.query(`
INSERT INTO orders (timeslot_id, user_id, order_status, price) VALUES
($3, $1, 'Cancelled', 10000),
($4, $1, 'Payed', 20000),
($5, $2, 'Processing', 20000),
($6, $1, 'Payed', 20000),
($7, $1, 'Payed', 20000)
RETURNING id;
`, [
users.rows.find(user => user.email === "u1@test.com").id,
users.rows.find(user => user.email === "u2@test.com").id,
reserved_timeslots.rows[0].id,
reserved_timeslots.rows[1].id,
reserved_timeslots.rows[2].id,
reserved_timeslots.rows[3].id,
reserved_timeslots.rows[4].id,
]);
client.end();
}

Loading…
Cancel
Save