Merge branch 'development'
This commit is contained in:
commit
20a483387c
37 changed files with 3266 additions and 1578 deletions
|
|
@ -1,159 +1,533 @@
|
|||
<mxfile host="app.diagrams.net" modified="2023-12-06T08:01:38.095Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" etag="_eur9a1JThKBMt8wZCV-" version="22.1.5" type="github">
|
||||
<mxfile host="app.diagrams.net" modified="2023-12-12T08:59:32.621Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" etag="Rt5DGkw0iecB_gEU8z7a" version="22.1.7" type="github">
|
||||
<diagram name="Page-1" id="3qw3VTkeZNw5AftXRyRj">
|
||||
<mxGraphModel dx="875" dy="484" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<mxGraphModel dx="3500" dy="1937" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-2" value="0" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="305" y="70" width="190" height="80" as="geometry" />
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-2" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;" edge="1" parent="1" target="xbmnrQQS6JrEWtYlrJAK-1">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="399.5" y="110" as="sourcePoint" />
|
||||
<mxPoint x="398.9999999999999" y="60" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="400" y="90" />
|
||||
<mxPoint x="399" y="90" />
|
||||
</Array>
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-4" value="EDM" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="caRcK8bNx-rz16oAYpbI-2">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-2" value="0" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" parent="1" vertex="1">
|
||||
<mxGeometry x="305.5" y="110" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-4" value="EDM" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="caRcK8bNx-rz16oAYpbI-2" vertex="1">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-3" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="631" y="105" width="160" height="30" as="geometry" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-3" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" parent="1" vertex="1">
|
||||
<mxGeometry x="631.5" y="145" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-6" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="36" y="95" width="100" height="50" as="geometry" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-6" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" parent="1" vertex="1">
|
||||
<mxGeometry x="36.5" y="135" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-7" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">file" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-7" value="title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">file" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" parent="1" edge="1">
|
||||
<mxGeometry x="-0.1243" y="45" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="136" y="105" as="sourcePoint" />
|
||||
<mxPoint x="305" y="105" as="targetPoint" />
|
||||
<mxPoint x="136.5" y="145" as="sourcePoint" />
|
||||
<mxPoint x="305.5" y="145" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-11" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" edge="1" parent="1">
|
||||
<mxGeometry x="-0.1243" y="-60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="136" y="130" as="sourcePoint" />
|
||||
<mxPoint x="305" y="130" as="targetPoint" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-11" value="pathname<br>path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" parent="1" edge="1">
|
||||
<mxGeometry x="-0.1302" y="-70" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="136.5" y="170" as="sourcePoint" />
|
||||
<mxPoint x="305.5" y="170" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-12" value="User" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="351" y="270" width="100" height="50" as="geometry" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-12" value="User" style="html=1;dashed=0;whiteSpace=wrap;" parent="1" vertex="1">
|
||||
<mxGeometry x="351.5" y="310" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-15" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">file" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="-0.0424" y="50" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="495" y="110.14" as="sourcePoint" />
|
||||
<mxPoint x="631" y="109.83" as="targetPoint" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-15" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" parent="1" edge="1">
|
||||
<mxGeometry x="0.0979" y="70" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="495.5" y="150.14" as="sourcePoint" />
|
||||
<mxPoint x="631.5" y="149.82999999999998" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-16" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" edge="1" parent="1">
|
||||
<mxGeometry x="0.1009" y="-60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="495" y="130.31" as="sourcePoint" />
|
||||
<mxPoint x="631" y="130" as="targetPoint" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-16" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" parent="1" edge="1">
|
||||
<mxGeometry x="0.0932" y="-70" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="495.5" y="170.31" as="sourcePoint" />
|
||||
<mxPoint x="631.5" y="170" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-17" value="search term" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-17" value="search term" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" parent="1" edge="1">
|
||||
<mxGeometry x="0.0059" y="40" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="391.6871428571429" y="270" as="sourcePoint" />
|
||||
<mxPoint x="391.00142857142856" y="150" as="targetPoint" />
|
||||
<mxPoint x="392.1871428571429" y="310" as="sourcePoint" />
|
||||
<mxPoint x="391.50142857142856" y="190" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-18" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;labelBackgroundColor=none;startArrow=classic;startFill=1;endFill=0;" edge="1" parent="1">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-18" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;labelBackgroundColor=none;startArrow=classic;startFill=1;endFill=0;" parent="1" edge="1">
|
||||
<mxGeometry y="-40" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="411.6871428571429" y="270" as="sourcePoint" />
|
||||
<mxPoint x="411.00142857142856" y="150" as="targetPoint" />
|
||||
<mxPoint x="412.1871428571429" y="310" as="sourcePoint" />
|
||||
<mxPoint x="411.50142857142856" y="190" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-19" value="1" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="319" y="440" width="190" height="80" as="geometry" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-19" value="1" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" parent="1" vertex="1">
|
||||
<mxGeometry x="319" y="520" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-20" value="Manage" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="caRcK8bNx-rz16oAYpbI-19">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-20" value="Manage" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="caRcK8bNx-rz16oAYpbI-19" vertex="1">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-21" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="631" y="465" width="160" height="30" as="geometry" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-21" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" parent="1" vertex="1">
|
||||
<mxGeometry x="631" y="545" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-22" value="pathname<br>title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" edge="1" parent="1">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-22" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" parent="1" edge="1">
|
||||
<mxGeometry x="0.0057" y="-60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="509" y="490.31" as="sourcePoint" />
|
||||
<mxPoint x="630" y="490" as="targetPoint" />
|
||||
<mxPoint x="509" y="570.31" as="sourcePoint" />
|
||||
<mxPoint x="630" y="570" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-23" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">file" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="0.0022" y="50" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="510" y="470.31" as="sourcePoint" />
|
||||
<mxPoint x="630" y="470" as="targetPoint" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-23" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" parent="1" edge="1">
|
||||
<mxGeometry x="0.0026" y="60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="510" y="550.31" as="sourcePoint" />
|
||||
<mxPoint x="630" y="550" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-25" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="50" y="455" width="100" height="50" as="geometry" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-25" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" parent="1" vertex="1">
|
||||
<mxGeometry x="50" y="535" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-26" value="pathname<br>title<br>description<br>keyword<br>category<br>path<br>file" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-26" value="pathname<br>title<br>description<br>keyword<br>category<br>path<br>file" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" parent="1" edge="1">
|
||||
<mxGeometry x="-0.0533" y="49" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="150" y="469.17" as="sourcePoint" />
|
||||
<mxPoint x="319" y="469.17" as="targetPoint" />
|
||||
<mxPoint x="150" y="549.1700000000001" as="sourcePoint" />
|
||||
<mxPoint x="319" y="549.1700000000001" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-27" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" edge="1" parent="1">
|
||||
<mxGeometry x="-0.0533" y="-56" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="150" y="494.17" as="sourcePoint" />
|
||||
<mxPoint x="319" y="494.17" as="targetPoint" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-27" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" parent="1" edge="1">
|
||||
<mxGeometry x="-0.0533" y="-66" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="150" y="574.1700000000001" as="sourcePoint" />
|
||||
<mxPoint x="319" y="574.1700000000001" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-30" value="2" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="319" y="610" width="190" height="80" as="geometry" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-30" value="2" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" parent="1" vertex="1">
|
||||
<mxGeometry x="319" y="690" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-31" value="Search" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="caRcK8bNx-rz16oAYpbI-30">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-31" value="Search" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="caRcK8bNx-rz16oAYpbI-30" vertex="1">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-32" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="caRcK8bNx-rz16oAYpbI-31" target="caRcK8bNx-rz16oAYpbI-21">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-32" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;edgeStyle=orthogonalEdgeStyle;" parent="1" source="caRcK8bNx-rz16oAYpbI-31" target="caRcK8bNx-rz16oAYpbI-21" edge="1">
|
||||
<mxGeometry x="0.59" y="-29" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="510" y="660.31" as="sourcePoint" />
|
||||
<mxPoint x="631" y="660" as="targetPoint" />
|
||||
<mxPoint x="510" y="740.31" as="sourcePoint" />
|
||||
<mxPoint x="631" y="740" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="710" y="660" />
|
||||
<mxPoint x="710" y="740" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-33" value="User" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="364" y="810" width="100" height="50" as="geometry" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-33" value="User" style="html=1;dashed=0;whiteSpace=wrap;" parent="1" vertex="1">
|
||||
<mxGeometry x="364" y="890" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-34" value="search term" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="caRcK8bNx-rz16oAYpbI-25">
|
||||
<mxGeometry x="0.1497" y="10" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="100" y="510" as="sourcePoint" />
|
||||
<mxPoint x="319" y="635" as="targetPoint" />
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-34" value="search term" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;edgeStyle=orthogonalEdgeStyle;" parent="1" source="caRcK8bNx-rz16oAYpbI-25" edge="1">
|
||||
<mxGeometry x="0.0334" y="5" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="100" y="590" as="sourcePoint" />
|
||||
<mxPoint x="319" y="715" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="120" y="635" />
|
||||
<mxPoint x="120" y="715" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-37" value="search term" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-37" value="search term" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" parent="1" edge="1">
|
||||
<mxGeometry x="0.0059" y="40" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="399.71" y="810" as="sourcePoint" />
|
||||
<mxPoint x="399.71" y="690" as="targetPoint" />
|
||||
<mxPoint x="399.71" y="890" as="sourcePoint" />
|
||||
<mxPoint x="399.71" y="770" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-38" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" edge="1" parent="1">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-38" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;" parent="1" edge="1">
|
||||
<mxGeometry y="-29" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="430" y="810" as="sourcePoint" />
|
||||
<mxPoint x="430" y="690" as="targetPoint" />
|
||||
<mxPoint x="430" y="890" as="sourcePoint" />
|
||||
<mxPoint x="430" y="770" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-39" value="pathname<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="caRcK8bNx-rz16oAYpbI-25" target="caRcK8bNx-rz16oAYpbI-31">
|
||||
<mxCell id="caRcK8bNx-rz16oAYpbI-39" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;edgeStyle=orthogonalEdgeStyle;" parent="1" source="caRcK8bNx-rz16oAYpbI-25" target="caRcK8bNx-rz16oAYpbI-31" edge="1">
|
||||
<mxGeometry x="-0.5455" y="-30" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="120" y="690" as="sourcePoint" />
|
||||
<mxPoint x="450" y="700" as="targetPoint" />
|
||||
<mxPoint x="120" y="770" as="sourcePoint" />
|
||||
<mxPoint x="450" y="780" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="100" y="660" />
|
||||
<mxPoint x="100" y="740" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-1" value="&nbsp;D2<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>Storage" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="319" y="20" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-3" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;" edge="1" parent="1" target="xbmnrQQS6JrEWtYlrJAK-4">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="414.5" y="520" as="sourcePoint" />
|
||||
<mxPoint x="413.9999999999999" y="470" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="415" y="500" />
|
||||
<mxPoint x="414" y="500" />
|
||||
</Array>
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-4" value="&nbsp;D2<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>Storage" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="334" y="430" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-5" value="1.2" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1139" y="330" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-6" value="Read" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-5">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-7" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="1451" y="355" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-9" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;labelBackgroundColor=none;startArrow=classic;startFill=1;endFill=0;" edge="1" parent="1">
|
||||
<mxGeometry x="0.0026" y="60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1329" y="369.87999999999994" as="sourcePoint" />
|
||||
<mxPoint x="1449" y="369.57" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-10" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="870" y="345" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-11" value="title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">file" style="endArrow=none;html=1;rounded=0;labelBackgroundColor=none;startArrow=classic;startFill=1;endFill=0;" edge="1" parent="1">
|
||||
<mxGeometry x="-0.0533" y="49" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="970" y="370.0000000000001" as="sourcePoint" />
|
||||
<mxPoint x="1139" y="370.0000000000001" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-15" value="1.3" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1139" y="610" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-16" value="Update" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-15">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-17" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="1451" y="635" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-19" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="0.0026" y="60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1331" y="649.8799999999999" as="sourcePoint" />
|
||||
<mxPoint x="1451" y="649.5699999999999" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-20" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="870" y="625" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-21" value="title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">file" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="-0.0533" y="49" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="970" y="649.57" as="sourcePoint" />
|
||||
<mxPoint x="1139" y="649.57" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-23" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;" edge="1" parent="1" target="xbmnrQQS6JrEWtYlrJAK-24">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="1234.5" y="610" as="sourcePoint" />
|
||||
<mxPoint x="1234" y="560" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="1235" y="590" />
|
||||
<mxPoint x="1234" y="590" />
|
||||
</Array>
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-24" value="&nbsp;D2<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>Storage" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="1154" y="520" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-25" value="1.4" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1139" y="870" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-26" value="Delete" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-25">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-27" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="1451" y="895" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-29" value="pathname" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="0.0004" y="10" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1331" y="910.02" as="sourcePoint" />
|
||||
<mxPoint x="1451" y="909.71" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-30" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="870" y="885" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-31" value="pathname" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="-0.0533" y="9" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="970" y="909.71" as="sourcePoint" />
|
||||
<mxPoint x="1139" y="909.71" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-33" value="pathname" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry y="30" relative="1" as="geometry">
|
||||
<mxPoint x="1220" y="870" as="sourcePoint" />
|
||||
<mxPoint x="1220" y="810" as="targetPoint" />
|
||||
<Array as="points" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-34" value="&nbsp;D2<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>Storage" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="1154" y="780" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-35" value="pathname" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry y="30" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1241" y="810" as="sourcePoint" />
|
||||
<mxPoint x="1241" y="870" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-37" value="1.1.1" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1966" y="150" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-38" value="Request Create" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-37">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-39" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="2278" y="175" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-40" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-61" target="xbmnrQQS6JrEWtYlrJAK-39">
|
||||
<mxGeometry x="0.3252" y="40" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="2170" y="480" as="sourcePoint" />
|
||||
<mxPoint x="2328.1578947368425" y="205" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="2350" y="510" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-41" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;edgeStyle=orthogonalEdgeStyle;startArrow=classic;startFill=1;" edge="1" parent="1">
|
||||
<mxGeometry x="0.0692" y="60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="2156" y="189.94999999999993" as="sourcePoint" />
|
||||
<mxPoint x="2276" y="189.64" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="2217" y="190" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-42" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="1697" y="165" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-43" value="title<br>description<br>keyword<br>category<br>path" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="-0.0178" y="40" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1797" y="170.00000000000009" as="sourcePoint" />
|
||||
<mxPoint x="1966" y="170.00000000000009" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-45" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;" edge="1" parent="1" target="xbmnrQQS6JrEWtYlrJAK-46" source="xbmnrQQS6JrEWtYlrJAK-56">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="2090" y="20" as="sourcePoint" />
|
||||
<mxPoint x="2061" y="10" as="targetPoint" />
|
||||
<Array as="points" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-46" value="&nbsp;D2<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>Storage" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="1981" y="410" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-47" value="1.1" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1139" y="105" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-48" value="Create" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-47">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-49" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="1451" y="130" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-50" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="0.0026" y="60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1329" y="144.87999999999994" as="sourcePoint" />
|
||||
<mxPoint x="1449" y="144.57" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-51" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="870" y="120" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-52" value="title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">file" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="-0.0533" y="49" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="970" y="145.0000000000001" as="sourcePoint" />
|
||||
<mxPoint x="1139" y="145.0000000000001" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-53" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;" edge="1" parent="1" target="xbmnrQQS6JrEWtYlrJAK-54">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="1234.5" y="105" as="sourcePoint" />
|
||||
<mxPoint x="1234" y="55" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="1235" y="85" />
|
||||
<mxPoint x="1234" y="85" />
|
||||
</Array>
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-54" value="&nbsp;D2<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>Storage" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="1154" y="15" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-56" value="1.1.2" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1966" y="280" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-57" value="Upload File" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-56">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-60" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;endArrow=none;endFill=0;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-57" target="xbmnrQQS6JrEWtYlrJAK-42">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="2071" y="360" as="sourcePoint" />
|
||||
<mxPoint x="2071" y="425" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="1747" y="330" />
|
||||
</Array>
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-61" value="1.1.3" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1966" y="480" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-62" value="Process File" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-61">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-67" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-46" target="xbmnrQQS6JrEWtYlrJAK-61">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="2071" y="360" as="sourcePoint" />
|
||||
<mxPoint x="2071" y="410" as="targetPoint" />
|
||||
<Array as="points" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-70" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize<br>file" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-39" target="xbmnrQQS6JrEWtYlrJAK-62">
|
||||
<mxGeometry x="-0.3878" y="30" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="2390" y="280" as="sourcePoint" />
|
||||
<mxPoint x="2060" y="570" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="2370" y="530" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-71" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize<br>uploadUrl" style="endArrow=none;html=1;rounded=0;labelBackgroundColor=none;edgeStyle=orthogonalEdgeStyle;startArrow=classic;startFill=1;endFill=0;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-42" target="xbmnrQQS6JrEWtYlrJAK-37">
|
||||
<mxGeometry x="-0.0178" y="-60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1797" y="205.30999999999995" as="sourcePoint" />
|
||||
<mxPoint x="1917" y="205" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-72" value="1.1.1" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1969" y="650" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-73" value="Update" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-72">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-74" value="&nbsp;D1<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>File" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="2281" y="675" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-75" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-84" target="xbmnrQQS6JrEWtYlrJAK-74">
|
||||
<mxGeometry x="0.3252" y="40" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="2173" y="980" as="sourcePoint" />
|
||||
<mxPoint x="2331.1578947368425" y="705" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="2353" y="1010" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-76" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;edgeStyle=orthogonalEdgeStyle;startArrow=classic;startFill=1;" edge="1" parent="1">
|
||||
<mxGeometry x="0.0692" y="60" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="2159" y="689.9499999999999" as="sourcePoint" />
|
||||
<mxPoint x="2279" y="689.64" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="2220" y="690" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-77" value="Admin" style="html=1;dashed=0;whiteSpace=wrap;" vertex="1" parent="1">
|
||||
<mxGeometry x="1700" y="665" width="100" height="50" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-78" value="pathname<br>title<br>description<br>keyword<br>category<br>path" style="endArrow=classic;html=1;rounded=0;labelBackgroundColor=none;" edge="1" parent="1">
|
||||
<mxGeometry x="-0.0178" y="40" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1800" y="670.0000000000001" as="sourcePoint" />
|
||||
<mxPoint x="1969" y="670.0000000000001" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-79" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-81" target="xbmnrQQS6JrEWtYlrJAK-80">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="2093" y="520" as="sourcePoint" />
|
||||
<mxPoint x="2064" y="510" as="targetPoint" />
|
||||
<Array as="points" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-80" value="&nbsp;D2<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>Storage" style="html=1;dashed=0;whiteSpace=wrap;shape=mxgraph.dfd.dataStoreID;align=left;spacingLeft=3;points=[[0,0],[0.5,0],[1,0],[0,0.5],[1,0.5],[0,1],[0.5,1],[1,1]];" vertex="1" parent="1">
|
||||
<mxGeometry x="1984" y="900" width="160" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-81" value="1.1.2" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1969" y="780" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-82" value="Upload File" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-81">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-83" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;endArrow=none;endFill=0;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-82" target="xbmnrQQS6JrEWtYlrJAK-77">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="2074" y="860" as="sourcePoint" />
|
||||
<mxPoint x="2074" y="925" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="1750" y="830" />
|
||||
</Array>
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-84" value="1.1.3" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=20;fillColor=#ffffff;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;swimlaneFillColor=#ffffff;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="1969" y="980" width="190" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-85" value="Process File" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="xbmnrQQS6JrEWtYlrJAK-84">
|
||||
<mxGeometry y="20" width="190" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-86" value="file" style="rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;startFill=0;edgeStyle=orthogonalEdgeStyle;labelBackgroundColor=none;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-80" target="xbmnrQQS6JrEWtYlrJAK-84">
|
||||
<mxGeometry y="-11" relative="1" as="geometry">
|
||||
<mxPoint x="2074" y="860" as="sourcePoint" />
|
||||
<mxPoint x="2074" y="910" as="targetPoint" />
|
||||
<Array as="points" />
|
||||
<mxPoint as="offset" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-87" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize<br>file" style="endArrow=none;html=1;rounded=0;startArrow=classic;startFill=1;labelBackgroundColor=none;endFill=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-74" target="xbmnrQQS6JrEWtYlrJAK-85">
|
||||
<mxGeometry x="-0.3878" y="30" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="2393" y="780" as="sourcePoint" />
|
||||
<mxPoint x="2063" y="1070" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="2373" y="1030" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="xbmnrQQS6JrEWtYlrJAK-88" value="pathname<br style="border-color: var(--border-color);">path<br style="border-color: var(--border-color);">title<br style="border-color: var(--border-color);">description<br style="border-color: var(--border-color);">keyword<br style="border-color: var(--border-color);">category<br style="border-color: var(--border-color);">fileName<br style="border-color: var(--border-color);">fileType<br style="border-color: var(--border-color);">fileSize<br>uploadUrl" style="endArrow=none;html=1;rounded=0;labelBackgroundColor=none;edgeStyle=orthogonalEdgeStyle;startArrow=classic;startFill=1;endFill=0;" edge="1" parent="1" source="xbmnrQQS6JrEWtYlrJAK-77" target="xbmnrQQS6JrEWtYlrJAK-72">
|
||||
<mxGeometry x="0.0651" y="-70" width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="1800" y="705.31" as="sourcePoint" />
|
||||
<mxPoint x="1920" y="705" as="targetPoint" />
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<link rel="icon" href="src/assets/logo-edm.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>ระบบทรัพยากรบุคคล</title>
|
||||
</head>
|
||||
|
|
|
|||
BIN
Services/client/src/assets/profile.png
Normal file
BIN
Services/client/src/assets/profile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
136
Services/client/src/components/FileFormWrapper.vue
Normal file
136
Services/client/src/components/FileFormWrapper.vue
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import useStorage from '@/stores/storage'
|
||||
import FileForm from './FileForm.vue'
|
||||
import UploadExistDialog from './UploadExistDialog.vue'
|
||||
|
||||
const storageStore = useStorage()
|
||||
const { file, currentInfo } = storeToRefs(storageStore)
|
||||
const { createFile, updateFile } = storageStore
|
||||
|
||||
const fileFormState = ref<boolean>(false)
|
||||
const fileFormPath = ref<string>('')
|
||||
const fileFormData = ref<{
|
||||
file?: File
|
||||
title?: string
|
||||
description?: string
|
||||
keyword?: string[]
|
||||
category?: string[]
|
||||
}>({})
|
||||
const fileFormType = ref<'edit' | 'create'>('create')
|
||||
const fileFormError = ref<{ fileExist?: boolean; fileName2Long?: boolean }>({})
|
||||
const fileExistNotification = ref<boolean>(false)
|
||||
const fileFormComponent = ref<InstanceType<typeof FileForm>>()
|
||||
|
||||
function triggerFileCreate() {
|
||||
fileFormType.value = 'create'
|
||||
fileFormData.value = {}
|
||||
fileFormState.value = !fileFormState.value
|
||||
}
|
||||
|
||||
function triggerFileEdit(
|
||||
value: {
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
pathname: string,
|
||||
) {
|
||||
fileFormState.value = true
|
||||
fileFormType.value = 'edit'
|
||||
fileFormPath.value = pathname
|
||||
fileFormData.value = {
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
triggerFileCreate,
|
||||
triggerFileEdit,
|
||||
})
|
||||
|
||||
const currentParam = ref<Parameters<typeof submitFileForm>[0]>()
|
||||
|
||||
function checkFileExist(name: string) {
|
||||
return Boolean(
|
||||
file.value[currentInfo.value.path].find((v) => v.fileName === name),
|
||||
)
|
||||
}
|
||||
|
||||
async function submitFileForm(
|
||||
value: {
|
||||
mode: 'create' | 'edit'
|
||||
file?: File
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
force = false,
|
||||
) {
|
||||
currentParam.value = value
|
||||
|
||||
if (
|
||||
value.file &&
|
||||
file.value[currentInfo.value.path].find(
|
||||
(v) => v.fileName === value.file?.name,
|
||||
) &&
|
||||
!force
|
||||
) {
|
||||
fileExistNotification.value = true
|
||||
return
|
||||
}
|
||||
|
||||
if (value.mode === 'create' && value.file) {
|
||||
await createFile(value.file, {
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
})
|
||||
} else {
|
||||
await updateFile(
|
||||
fileFormPath.value,
|
||||
{
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
},
|
||||
value.file,
|
||||
)
|
||||
}
|
||||
fileFormData.value = {}
|
||||
fileFormState.value = false
|
||||
currentParam.value = undefined
|
||||
fileFormComponent.value?.reset()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<file-form
|
||||
ref="fileFormComponent"
|
||||
:mode="fileFormType"
|
||||
:error="fileFormError"
|
||||
v-model:open="fileFormState"
|
||||
v-model:title="fileFormData.title"
|
||||
v-model:description="fileFormData.description"
|
||||
v-model:keyword="fileFormData.keyword"
|
||||
v-model:category="fileFormData.category"
|
||||
@reset="() => (fileFormError = {})"
|
||||
@filechange="
|
||||
(name: string) => (fileFormError.fileExist = checkFileExist(name))
|
||||
"
|
||||
@submit="submitFileForm"
|
||||
/>
|
||||
<upload-exist-dialog
|
||||
v-model:notification="fileExistNotification"
|
||||
@confirm="() => currentParam && submitFileForm(currentParam, true)"
|
||||
@cancel="() => (currentParam = undefined)"
|
||||
/>
|
||||
</template>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
import mime from 'mime'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
|
||||
const { mimeFileMapping } = useFileInfoStore()
|
||||
|
||||
|
|
@ -11,44 +11,33 @@ defineProps<{
|
|||
}>()
|
||||
|
||||
function getIcon(mimeType: string | undefined, fileName: string | undefined) {
|
||||
if (mimeType === undefined) {
|
||||
return 'mdi-file-question-outline'
|
||||
}
|
||||
if (!mimeType) return 'mdi-file-question-outline'
|
||||
|
||||
const extension = mime.getExtension(mimeType)
|
||||
|
||||
if (extension) return mimeFileMapping[mimeType].icon
|
||||
if (fileName && fileName.includes('.')) return 'mdi-file-outline'
|
||||
|
||||
const extFomMime = mime.getExtension(mimeType)
|
||||
if (extFomMime) {
|
||||
return mimeFileMapping[mimeType].icon
|
||||
}
|
||||
if (fileName && fileName.includes('.')) {
|
||||
return 'mdi-file-outline'
|
||||
}
|
||||
return 'mdi-file-question-outline'
|
||||
}
|
||||
|
||||
function getColor(mimeType: string | undefined, fileName: string | undefined) {
|
||||
if (mimeType === undefined) {
|
||||
return 'grey-5'
|
||||
}
|
||||
if (mimeType === undefined) return 'grey-5'
|
||||
|
||||
const extension = mime.getExtension(mimeType)
|
||||
|
||||
if (extension) return mimeFileMapping[mimeType].color
|
||||
if (fileName && fileName.includes('.')) return 'blue-11'
|
||||
|
||||
const extFomMime = mime.getExtension(mimeType)
|
||||
if (extFomMime) {
|
||||
return mimeFileMapping[mimeType].color
|
||||
}
|
||||
if (fileName && fileName.includes('.')) {
|
||||
return 'blue-11'
|
||||
}
|
||||
return 'grey-5'
|
||||
}
|
||||
|
||||
function getIconSize(s: string) {
|
||||
type SizeMapping = {
|
||||
[key: string]: string
|
||||
}
|
||||
const sizeMapping: SizeMapping = {
|
||||
function getIconSize(size: string) {
|
||||
const sizeMapping = {
|
||||
preview: '6em',
|
||||
list: '2em',
|
||||
}
|
||||
return sizeMapping[s]
|
||||
return sizeMapping[size as keyof typeof sizeMapping]
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,233 +2,109 @@
|
|||
import { computed, ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
import FileIcon from '@/components/FileIcon.vue'
|
||||
import FileItemAction from '@/components/FileItemAction.vue'
|
||||
import DialogDelete from '@/components/DialogDelete.vue'
|
||||
import FileForm from './FileForm.vue'
|
||||
import FolderForm from './FolderForm.vue'
|
||||
import UploadExistDialog from './UploadExistDialog.vue'
|
||||
import { useTreeDataStore } from '@/stores/tree-data'
|
||||
import FileIcon from './FileIcon.vue'
|
||||
import FileItemAction from './FileItemAction.vue'
|
||||
import DialogDelete from './DialogDelete.vue'
|
||||
import FileFormWrapper from './FileFormWrapper.vue'
|
||||
import FolderFormWrapper from './FolderFormWrapper.vue'
|
||||
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
import useStorage from '@/stores/storage'
|
||||
|
||||
const TREE_LEVEL_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{ action: boolean; viewMode: 'view_list' | 'view_module' }>(),
|
||||
{
|
||||
action: false,
|
||||
},
|
||||
{ action: false },
|
||||
)
|
||||
const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const
|
||||
const { getFileInfo } = useFileInfoStore()
|
||||
const { currentFolder, currentFile, currentDept, currentPath } =
|
||||
storeToRefs(useTreeDataStore())
|
||||
const {
|
||||
createFolder,
|
||||
editFolder,
|
||||
getFolder,
|
||||
deleteFolder,
|
||||
uploadFile,
|
||||
updateFile,
|
||||
deleteFile,
|
||||
checkFile,
|
||||
checkFileName,
|
||||
refaceFile,
|
||||
} = useTreeDataStore()
|
||||
|
||||
const storageStore = useStorage()
|
||||
const { folder, file, currentInfo } = storeToRefs(storageStore)
|
||||
const { goto, deleteFolder, deleteFile } = storageStore
|
||||
|
||||
const fileFormComponent = ref<InstanceType<typeof FileFormWrapper>>()
|
||||
const folderFormComponent = ref<InstanceType<typeof FolderFormWrapper>>()
|
||||
|
||||
const deleteState = ref<boolean>(false)
|
||||
const deletePath = ref<string>('')
|
||||
const deleteTarget = ref<'deleteFolder' | 'deleteFile'>()
|
||||
const deleteMap = { deleteFolder, deleteFile }
|
||||
|
||||
const currentIcon = computed(() =>
|
||||
currentDept.value === 0
|
||||
currentInfo.value.dept === 0
|
||||
? 'mdi-file-cabinet'
|
||||
: currentDept.value === 1
|
||||
: currentInfo.value.dept === 1
|
||||
? 'o_inbox'
|
||||
: 'o_folder_open',
|
||||
)
|
||||
|
||||
const dialogDeleteState = ref<boolean>(false)
|
||||
const deleteFormPath = ref<string>('')
|
||||
const deleteFormType = ref<'deleteFolder' | 'deleteFile'>()
|
||||
|
||||
const folderFormState = ref<boolean>(false)
|
||||
const folderFormPath = ref<string>('')
|
||||
const folderFormData = ref<{
|
||||
name?: string
|
||||
}>({})
|
||||
const folderFormType = ref<'edit' | 'create'>('create')
|
||||
const fileFormState = ref<boolean>(false)
|
||||
const fileFormPath = ref<string>('')
|
||||
const fileFormData = ref<{
|
||||
file?: File
|
||||
title?: string
|
||||
description?: string
|
||||
keyword?: string[]
|
||||
category?: string[]
|
||||
}>({})
|
||||
const fileFormType = ref<'edit' | 'create'>('create')
|
||||
const fileFormError = ref<{ fileExist?: boolean; fileName2Long?: boolean }>({})
|
||||
const fileExistNotification = ref<boolean>(false)
|
||||
const fileFormComponent = ref<InstanceType<typeof FileForm>>()
|
||||
|
||||
function triggerFolderDelete(pathname: string) {
|
||||
deleteFormType.value = 'deleteFolder'
|
||||
deleteFormPath.value = pathname
|
||||
dialogDeleteState.value = !dialogDeleteState.value
|
||||
deleteTarget.value = 'deleteFolder'
|
||||
deletePath.value = pathname
|
||||
deleteState.value = !deleteState.value
|
||||
}
|
||||
|
||||
function triggerFileDelete(pathname: string) {
|
||||
deleteFormType.value = 'deleteFile'
|
||||
deleteFormPath.value = pathname
|
||||
dialogDeleteState.value = !dialogDeleteState.value
|
||||
}
|
||||
|
||||
function triggerFolderCreate() {
|
||||
folderFormType.value = 'create'
|
||||
folderFormData.value = {}
|
||||
folderFormState.value = !folderFormState.value
|
||||
}
|
||||
|
||||
function triggerFolderEdit(name: string, pathname: string) {
|
||||
folderFormType.value = 'edit'
|
||||
folderFormPath.value = pathname
|
||||
folderFormData.value.name = name
|
||||
folderFormState.value = true
|
||||
}
|
||||
|
||||
async function submitFolderForm(value: {
|
||||
mode: 'create' | 'edit'
|
||||
name: string
|
||||
}) {
|
||||
if (value.mode === 'create') {
|
||||
await createFolder(value.name)
|
||||
} else {
|
||||
await editFolder(value.name, folderFormPath.value)
|
||||
}
|
||||
}
|
||||
|
||||
function triggerFileCreate() {
|
||||
fileFormType.value = 'create'
|
||||
fileFormData.value = {}
|
||||
fileFormState.value = !fileFormState.value
|
||||
}
|
||||
|
||||
function triggerFileEdit(
|
||||
value: {
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
pathname: string,
|
||||
) {
|
||||
fileFormState.value = true
|
||||
fileFormType.value = 'edit'
|
||||
fileFormPath.value = pathname
|
||||
fileFormData.value = {
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
}
|
||||
}
|
||||
|
||||
const currentParam = ref<Parameters<typeof submitFileForm>[0]>()
|
||||
|
||||
async function submitFileForm(
|
||||
value: {
|
||||
mode: 'create' | 'edit'
|
||||
file?: File
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
force = false,
|
||||
) {
|
||||
currentParam.value = value
|
||||
|
||||
if (value.file && checkFile(value.file.name) && !force) {
|
||||
fileExistNotification.value = true
|
||||
return
|
||||
}
|
||||
|
||||
if (value.mode === 'create' && value.file) {
|
||||
await uploadFile(currentPath.value, value.file, {
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
})
|
||||
setTimeout(() => {
|
||||
refaceFile(currentPath.value)
|
||||
}, 3000)
|
||||
|
||||
setTimeout(() => {
|
||||
refaceFile(currentPath.value)
|
||||
}, 10000)
|
||||
} else {
|
||||
await updateFile(
|
||||
fileFormPath.value,
|
||||
{
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
},
|
||||
value.file,
|
||||
)
|
||||
setTimeout(() => {
|
||||
refaceFile(currentPath.value)
|
||||
}, 3000)
|
||||
|
||||
setTimeout(() => {
|
||||
refaceFile(currentPath.value)
|
||||
}, 10000)
|
||||
}
|
||||
fileFormData.value = {}
|
||||
fileFormState.value = false
|
||||
currentParam.value = undefined
|
||||
fileFormComponent.value?.reset()
|
||||
deleteTarget.value = 'deleteFile'
|
||||
deletePath.value = pathname
|
||||
deleteState.value = !deleteState.value
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="text-h6 q-mt-md" v-if="currentDept > 2">
|
||||
<file-form-wrapper ref="fileFormComponent" />
|
||||
<folder-form-wrapper ref="folderFormComponent" />
|
||||
<dialog-delete
|
||||
v-model:open="deleteState"
|
||||
@confirm="() => deleteTarget && deleteMap[deleteTarget](deletePath)"
|
||||
/>
|
||||
|
||||
<div
|
||||
class="text-h6 q-mt-md"
|
||||
v-if="currentInfo.dept > 2 && currentInfo.dept < 4"
|
||||
>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ DEPT_NAME[currentDept] }}</div>
|
||||
<div>{{ TREE_LEVEL_NAME[currentInfo.dept] }}</div>
|
||||
<q-btn
|
||||
v-if="currentDept != 4 && action"
|
||||
outline
|
||||
push
|
||||
dense
|
||||
id="listViewFolderCreate"
|
||||
class="q-px-md q-ml-md"
|
||||
:label="'สร้าง' + DEPT_NAME[currentDept]"
|
||||
type="submit"
|
||||
color="primary"
|
||||
dense
|
||||
icon="add"
|
||||
@click.stop="() => triggerFolderCreate()"
|
||||
id="listViewFolderCreate"
|
||||
v-if="action"
|
||||
:label="'สร้าง' + TREE_LEVEL_NAME[currentInfo.dept]"
|
||||
@click.stop="() => folderFormComponent?.triggerFolderCreate()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid q-mt-md">
|
||||
<div v-for="value in currentFolder" :data-pathname="value.pathname">
|
||||
<div
|
||||
class="grid q-mt-md"
|
||||
v-if="currentInfo.dept < 4 && folder[currentInfo.path]"
|
||||
>
|
||||
<div
|
||||
v-for="value in folder[currentInfo.path]"
|
||||
:data-pathname="value.pathname"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
:style="{
|
||||
position: 'relative',
|
||||
display: 'flex',
|
||||
gap: '0.5rem',
|
||||
flexDirection: currentDept > 2 ? 'row' : 'column',
|
||||
alignItems: 'center',
|
||||
padding: currentDept > 2 ? '.5rem 0' : '.5rem',
|
||||
flexDirection: currentInfo.dept > 2 ? 'row' : 'column',
|
||||
padding: currentInfo.dept > 2 ? '.5rem 0' : '.5rem',
|
||||
}"
|
||||
class="box"
|
||||
@click="
|
||||
() => {
|
||||
;(folderFormState = false), getFolder(value.pathname)
|
||||
}
|
||||
"
|
||||
@click="() => goto(value.pathname)"
|
||||
>
|
||||
<div class="q-px-md flex items-center justify-center">
|
||||
<q-icon
|
||||
:name="currentIcon"
|
||||
:size="currentDept > 2 ? '3em' : '6em'"
|
||||
:size="currentInfo.dept > 2 ? '3em' : '6em'"
|
||||
color="primary"
|
||||
class="col"
|
||||
/>
|
||||
|
|
@ -236,40 +112,46 @@ async function submitFileForm(
|
|||
<div
|
||||
class="absolute flex items-center justify-center"
|
||||
style="top: 0.5rem; right: 0.5rem"
|
||||
:style="{ bottom: currentDept > 2 ? '0.5rem' : 'unset' }"
|
||||
v-if="props.action"
|
||||
:style="{ bottom: currentInfo.dept > 2 ? '0.5rem' : 'unset' }"
|
||||
>
|
||||
<file-item-action
|
||||
:nameId="value.pathname"
|
||||
@delete="() => triggerFolderDelete(value.pathname)"
|
||||
@edit="() => triggerFolderEdit(value.name, value.pathname)"
|
||||
@edit="
|
||||
() =>
|
||||
folderFormComponent?.triggerFolderEdit(
|
||||
value.name,
|
||||
value.pathname,
|
||||
)
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="text-overflow-handle block text-center"
|
||||
:class="{
|
||||
'q-px-md': currentDept < 3,
|
||||
'q-pr-xl': currentDept > 2,
|
||||
}"
|
||||
style="max-width: 100%"
|
||||
:class="{
|
||||
'q-px-md': currentInfo.dept < 3,
|
||||
'q-pr-xl': currentInfo.dept > 2,
|
||||
}"
|
||||
>
|
||||
{{ value.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="props.action && currentDept < 4">
|
||||
<div v-if="props.action && currentInfo.dept < 4">
|
||||
<div
|
||||
id="triggerFolderCreateFileItem"
|
||||
class="dashed"
|
||||
:style="{
|
||||
position: 'relative',
|
||||
display: 'flex',
|
||||
gap: '0.5rem',
|
||||
flexDirection: currentDept > 2 ? 'row' : 'column',
|
||||
alignItems: 'center',
|
||||
padding: currentDept > 2 ? '.5rem 0' : '.5rem',
|
||||
flexDirection: currentInfo.dept > 2 ? 'row' : 'column',
|
||||
padding: currentInfo.dept > 2 ? '.5rem 0' : '.5rem',
|
||||
}"
|
||||
@click.stop="() => triggerFolderCreate()"
|
||||
id="triggerFolderCreateFileItem"
|
||||
@click.stop="() => folderFormComponent?.triggerFolderCreate()"
|
||||
>
|
||||
<div
|
||||
class="q-px-md flex items-center justify-center"
|
||||
|
|
@ -277,17 +159,17 @@ async function submitFileForm(
|
|||
>
|
||||
<q-icon
|
||||
:name="currentIcon"
|
||||
:size="currentDept > 2 ? '3em' : '6em'"
|
||||
:size="currentInfo.dept > 2 ? '3em' : '6em'"
|
||||
color="primary"
|
||||
class="col"
|
||||
/>
|
||||
<q-btn
|
||||
round
|
||||
:dense="currentDept > 2"
|
||||
color="white"
|
||||
size="10px"
|
||||
style="position: absolute; bottom: 0"
|
||||
:style="{ right: currentDept > 2 ? '.5rem' : '1rem' }"
|
||||
:dense="currentInfo.dept > 2"
|
||||
:style="{ right: currentInfo.dept > 2 ? '.5rem' : '1rem' }"
|
||||
>
|
||||
<q-icon name="add" color="primary" size="1.5rem" />
|
||||
</q-btn>
|
||||
|
|
@ -295,60 +177,58 @@ async function submitFileForm(
|
|||
<div
|
||||
class="text-overflow-handle block text-center"
|
||||
:class="{
|
||||
'q-px-md': currentDept < 3,
|
||||
'q-pr-xl': currentDept > 2,
|
||||
'q-px-md': currentInfo.dept < 3,
|
||||
'q-pr-xl': currentInfo.dept > 2,
|
||||
}"
|
||||
style="max-width: 100%"
|
||||
>
|
||||
สร้าง{{ DEPT_NAME[currentDept] }}
|
||||
สร้าง{{ TREE_LEVEL_NAME[currentInfo.dept] }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="grid-column: 1 / span 5" class="q-mt-md" v-if="currentDept > 2">
|
||||
<div
|
||||
style="grid-column: 1 / span 5"
|
||||
class="q-mt-md"
|
||||
v-if="currentInfo.dept > 2 && file[currentInfo.path]"
|
||||
>
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<span class="text-h6 q-mr-md">เอกสาร</span>
|
||||
<span class="text-body text-grey"
|
||||
>จำนวน {{ currentFile.length }} รายการ</span
|
||||
>จำนวน {{ file[currentInfo.path].length }} รายการ</span
|
||||
>
|
||||
</div>
|
||||
<q-btn
|
||||
outline
|
||||
push
|
||||
v-if="action"
|
||||
dense
|
||||
id="listViewFileCreate"
|
||||
class="q-px-md q-ml-md"
|
||||
label="สร้างเอกสาร"
|
||||
type="submit"
|
||||
color="primary"
|
||||
dense
|
||||
icon="add"
|
||||
@click.stop="() => triggerFileCreate()"
|
||||
id="listViewFileCreate"
|
||||
v-if="action"
|
||||
@click.stop="() => fileFormComponent?.triggerFileCreate()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid q-mt-md">
|
||||
<div v-for="(value, index) in currentFile" :data-pathname="value.pathname">
|
||||
<div
|
||||
v-for="(value, index) in file[currentInfo.path]"
|
||||
:data-pathname="value.pathname"
|
||||
>
|
||||
<div
|
||||
:style="{
|
||||
position: 'relative',
|
||||
display: 'flex',
|
||||
gap: '0.5rem',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
padding: '1rem',
|
||||
maxWidth: '100%',
|
||||
}"
|
||||
class="box"
|
||||
@click="() => getFileInfo(value)"
|
||||
:id="`getFileInfoFileItem${index}`"
|
||||
@click="() => getFileInfo(value)"
|
||||
>
|
||||
<div class="q-px-md flex items-center justify-center">
|
||||
<file-icon
|
||||
size="preview"
|
||||
:fileMimeType="value.fileType ? value.fileType : 'unknow'"
|
||||
:fileName="value.fileName ? value.fileName : 'unknow'"
|
||||
:fileMimeType="value.fileType ? value.fileType : '-'"
|
||||
:fileName="value.fileName ? value.fileName : '-'"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
|
|
@ -360,7 +240,7 @@ async function submitFileForm(
|
|||
:nameId="value.pathname"
|
||||
@edit="
|
||||
() =>
|
||||
triggerFileEdit(
|
||||
fileFormComponent?.triggerFileEdit(
|
||||
{
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
|
|
@ -381,8 +261,10 @@ async function submitFileForm(
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="props.action && currentDept > 2">
|
||||
<div v-if="props.action && currentInfo.dept > 2">
|
||||
<div
|
||||
id="triggerFileCreateFileItem"
|
||||
class="dashed"
|
||||
:style="{
|
||||
display: 'flex',
|
||||
gap: '0.5rem',
|
||||
|
|
@ -391,9 +273,7 @@ async function submitFileForm(
|
|||
padding: '1rem',
|
||||
maxWidth: '100%',
|
||||
}"
|
||||
class="dashed"
|
||||
@click.stop="() => triggerFileCreate()"
|
||||
id="triggerFileCreateFileItem"
|
||||
@click.stop="() => fileFormComponent?.triggerFileCreate()"
|
||||
>
|
||||
<div
|
||||
class="q-px-md flex items-center justify-center"
|
||||
|
|
@ -418,55 +298,19 @@ async function submitFileForm(
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<file-form
|
||||
ref="fileFormComponent"
|
||||
:mode="fileFormType"
|
||||
:error="fileFormError"
|
||||
v-model:open="fileFormState"
|
||||
v-model:title="fileFormData.title"
|
||||
v-model:description="fileFormData.description"
|
||||
v-model:keyword="fileFormData.keyword"
|
||||
v-model:category="fileFormData.category"
|
||||
@reset="() => (fileFormError = {})"
|
||||
@filechange="
|
||||
(name: string) => (
|
||||
(fileFormError.fileExist = checkFile(name)),
|
||||
(fileFormError.fileName2Long = checkFileName(name))
|
||||
)
|
||||
"
|
||||
@submit="submitFileForm"
|
||||
/>
|
||||
|
||||
<folder-form
|
||||
:mode="folderFormType"
|
||||
:tree="DEPT_NAME[currentDept]"
|
||||
v-if="currentDept < 4"
|
||||
v-model:open="folderFormState"
|
||||
v-model:name="folderFormData.name"
|
||||
@submit="submitFolderForm"
|
||||
/>
|
||||
|
||||
<upload-exist-dialog
|
||||
v-model:notification="fileExistNotification"
|
||||
@confirm="() => currentParam && submitFileForm(currentParam, true)"
|
||||
@cancel="() => (currentParam = undefined)"
|
||||
/>
|
||||
|
||||
<dialog-delete
|
||||
v-model:open="dialogDeleteState"
|
||||
@confirm="
|
||||
() =>
|
||||
deleteFormType &&
|
||||
{ deleteFolder, deleteFile }[deleteFormType](deleteFormPath)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
border: 2px solid $separator-color;
|
||||
border-radius: 8px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
max-width: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
|
@ -483,20 +327,6 @@ async function submitFileForm(
|
|||
margin: auto auto;
|
||||
}
|
||||
|
||||
.add-button {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 30%;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.add-button-folder-level {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
top: 22px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.text-overflow-handle {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
<script setup lang="ts">
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSearchDataStore } from '@/stores/searched-data'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
import { useTreeDataStore } from '@/stores/tree-data'
|
||||
|
||||
import DialogDelete from './DialogDelete.vue'
|
||||
import UploadExistDialog from './UploadExistDialog.vue'
|
||||
import FileForm from './FileForm.vue'
|
||||
import FileItemAction from '@/components/FileItemAction.vue'
|
||||
import FileIcon from '@/components/FileIcon.vue'
|
||||
|
||||
import type { QTableProps } from 'quasar'
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
import { useSearchDataStore } from '@/stores/searched-data'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
import useStorage from '@/stores/storage'
|
||||
|
||||
import DialogDelete from './DialogDelete.vue'
|
||||
import FileFormWrapper from './FileFormWrapper.vue'
|
||||
import FileItemAction from '@/components/FileItemAction.vue'
|
||||
import FileIcon from '@/components/FileIcon.vue'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
|
|
@ -24,30 +23,22 @@ const props = withDefaults(
|
|||
)
|
||||
const { foundFile, isActFoundFile } = storeToRefs(useSearchDataStore())
|
||||
const { getFileInfo, getSize, getType } = useFileInfoStore()
|
||||
const { updateFile, deleteFile, checkFile } = useTreeDataStore()
|
||||
|
||||
const storageStore = useStorage()
|
||||
const { deleteFile } = storageStore
|
||||
|
||||
const fileFormComponent = ref<InstanceType<typeof FileFormWrapper>>()
|
||||
|
||||
const keywordList = ref<string[]>([])
|
||||
const categoryList = ref<string[]>([])
|
||||
const selectKeyword = ref<string[]>([])
|
||||
const selectCategory = ref<string[]>([])
|
||||
const filterFoundFile = ref<any>()
|
||||
|
||||
const fileExistNotification = ref<boolean>(false)
|
||||
const fileFormError = ref<{ fileExist?: boolean }>({})
|
||||
const deleteFormType = ref<'deleteFile'>('deleteFile')
|
||||
const dialogDeleteState = ref<boolean>(false)
|
||||
const deleteFormPath = ref<string>('')
|
||||
|
||||
const fileFormType = ref<'edit'>('edit')
|
||||
const fileFormState = ref<boolean>(false)
|
||||
const fileFormPath = ref<string>('')
|
||||
const fileFormData = ref<{
|
||||
file?: File
|
||||
title?: string
|
||||
description?: string
|
||||
keyword?: string[]
|
||||
category?: string[]
|
||||
}>({})
|
||||
|
||||
const columns: QTableProps['columns'] = [
|
||||
{
|
||||
name: 'name',
|
||||
|
|
@ -84,66 +75,6 @@ const columns: QTableProps['columns'] = [
|
|||
},
|
||||
]
|
||||
|
||||
const currentParam = ref<Parameters<typeof submitFileForm>[0]>()
|
||||
|
||||
async function submitFileForm(
|
||||
value: {
|
||||
mode: 'create' | 'edit'
|
||||
file?: File
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
force = false,
|
||||
) {
|
||||
currentParam.value = value
|
||||
if (value.file && checkFile(value.file.name) && !force) {
|
||||
fileExistNotification.value = true
|
||||
return
|
||||
}
|
||||
|
||||
if (value.mode === 'edit') {
|
||||
await updateFile(
|
||||
fileFormPath.value,
|
||||
{
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
},
|
||||
value.file,
|
||||
)
|
||||
setTimeout(() => {
|
||||
isActFoundFile.value = true
|
||||
}, 400)
|
||||
}
|
||||
|
||||
fileFormData.value = {}
|
||||
fileFormState.value = false
|
||||
currentParam.value = undefined
|
||||
}
|
||||
|
||||
function triggerFileEdit(
|
||||
value: {
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
pathname: string,
|
||||
) {
|
||||
fileFormState.value = true
|
||||
fileFormType.value = 'edit'
|
||||
fileFormPath.value = pathname
|
||||
fileFormData.value = {
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
}
|
||||
}
|
||||
|
||||
function triggerFileDelete(pathname: string) {
|
||||
deleteFormType.value = 'deleteFile'
|
||||
deleteFormPath.value = pathname
|
||||
|
|
@ -161,36 +92,30 @@ function confirmDelete() {
|
|||
}
|
||||
|
||||
function filterSearch() {
|
||||
function updateList() {
|
||||
keywordList.value = []
|
||||
categoryList.value = []
|
||||
foundFile.value.forEach((obj) => {
|
||||
obj.keyword.forEach((keyword) => {
|
||||
if (!keywordList.value.includes(keyword)) {
|
||||
keywordList.value.push(keyword)
|
||||
}
|
||||
})
|
||||
obj.category.forEach((category) => {
|
||||
if (!categoryList.value.includes(category)) {
|
||||
categoryList.value.push(category)
|
||||
}
|
||||
})
|
||||
keywordList.value = []
|
||||
categoryList.value = []
|
||||
foundFile.value.forEach((obj) => {
|
||||
obj.keyword.forEach((keyword) => {
|
||||
if (!keywordList.value.includes(keyword)) {
|
||||
keywordList.value.push(keyword)
|
||||
}
|
||||
})
|
||||
}
|
||||
obj.category.forEach((category) => {
|
||||
if (!categoryList.value.includes(category)) {
|
||||
categoryList.value.push(category)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function filterArray() {
|
||||
if (!(selectKeyword.value.length || selectCategory.value.length)) {
|
||||
filterFoundFile.value = foundFile.value
|
||||
} else {
|
||||
filterFoundFile.value = foundFile.value.filter(
|
||||
(entry) =>
|
||||
entry.keyword.some((kw) => selectKeyword.value.includes(kw)) ||
|
||||
entry.category.some((kw) => selectCategory.value.includes(kw)),
|
||||
)
|
||||
}
|
||||
if (!(selectKeyword.value.length || selectCategory.value.length)) {
|
||||
filterFoundFile.value = foundFile.value
|
||||
} else {
|
||||
filterFoundFile.value = foundFile.value.filter(
|
||||
(entry) =>
|
||||
entry.keyword.some((kw) => selectKeyword.value.includes(kw)) ||
|
||||
entry.category.some((kw) => selectCategory.value.includes(kw)),
|
||||
)
|
||||
}
|
||||
updateList()
|
||||
filterArray()
|
||||
}
|
||||
|
||||
watch(
|
||||
|
|
@ -208,6 +133,9 @@ onMounted(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<file-form-wrapper ref="fileFormComponent" />
|
||||
<dialog-delete v-model:open="dialogDeleteState" @confirm="confirmDelete" />
|
||||
|
||||
<div class="row grid q-py-md q-gutter-sm">
|
||||
<q-select
|
||||
outlined
|
||||
|
|
@ -265,7 +193,7 @@ onMounted(() => {
|
|||
:nameId="value.pathname"
|
||||
@edit="
|
||||
() =>
|
||||
triggerFileEdit(
|
||||
fileFormComponent?.triggerFileEdit(
|
||||
{
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
|
|
@ -344,7 +272,11 @@ onMounted(() => {
|
|||
dense
|
||||
icon="o_edit"
|
||||
@click="
|
||||
() => triggerFileEdit(actionData.row, actionData.row.pathname)
|
||||
() =>
|
||||
fileFormComponent?.triggerFileEdit(
|
||||
actionData.row,
|
||||
actionData.row.pathname,
|
||||
)
|
||||
"
|
||||
id="listViewFileEdit"
|
||||
/>
|
||||
|
|
@ -365,26 +297,6 @@ onMounted(() => {
|
|||
<div class="q-mt-md" v-if="foundFile.length == 0">
|
||||
<span>ไม่พบรายการที่ค้นหา</span>
|
||||
</div>
|
||||
|
||||
<file-form
|
||||
:mode="fileFormType"
|
||||
:error="fileFormError"
|
||||
v-model:open="fileFormState"
|
||||
v-model:title="fileFormData.title"
|
||||
v-model:description="fileFormData.description"
|
||||
v-model:keyword="fileFormData.keyword"
|
||||
v-model:category="fileFormData.category"
|
||||
@filechange="(name: string) => (fileFormError.fileExist = checkFile(name))"
|
||||
@submit="submitFileForm"
|
||||
/>
|
||||
|
||||
<upload-exist-dialog
|
||||
v-model:notification="fileExistNotification"
|
||||
@confirm="() => currentParam && submitFileForm(currentParam, true)"
|
||||
@cancel="() => (currentParam = undefined)"
|
||||
/>
|
||||
|
||||
<dialog-delete v-model:open="dialogDeleteState" @confirm="confirmDelete" />
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
|||
59
Services/client/src/components/FolderFormWrapper.vue
Normal file
59
Services/client/src/components/FolderFormWrapper.vue
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import useStorage from '@/stores/storage'
|
||||
import FolderForm from './FolderForm.vue'
|
||||
|
||||
const storageStore = useStorage()
|
||||
const { file, currentInfo } = storeToRefs(storageStore)
|
||||
const { createFolder, editFolder } = storageStore
|
||||
|
||||
const folderFormState = ref<boolean>(false)
|
||||
const folderFormPath = ref<string>('')
|
||||
const folderFormData = ref<{
|
||||
name?: string
|
||||
}>({})
|
||||
const folderFormType = ref<'edit' | 'create'>('create')
|
||||
|
||||
function triggerFolderCreate() {
|
||||
folderFormType.value = 'create'
|
||||
folderFormData.value = {}
|
||||
folderFormState.value = !folderFormState.value
|
||||
}
|
||||
|
||||
function triggerFolderEdit(name: string, pathname: string) {
|
||||
folderFormType.value = 'edit'
|
||||
folderFormPath.value = pathname
|
||||
folderFormData.value.name = name
|
||||
folderFormState.value = true
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
triggerFolderCreate,
|
||||
triggerFolderEdit,
|
||||
})
|
||||
|
||||
async function submitFolderForm(value: {
|
||||
mode: 'create' | 'edit'
|
||||
name: string
|
||||
}) {
|
||||
if (value.mode === 'create') {
|
||||
await createFolder(value.name)
|
||||
} else {
|
||||
await editFolder(value.name, folderFormPath.value)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<folder-form
|
||||
:mode="folderFormType"
|
||||
:tree="
|
||||
(['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const)[currentInfo.dept]
|
||||
"
|
||||
v-if="currentInfo.dept < 4"
|
||||
v-model:open="folderFormState"
|
||||
v-model:name="folderFormData.name"
|
||||
@submit="submitFolderForm"
|
||||
/>
|
||||
</template>
|
||||
|
|
@ -1,22 +1,20 @@
|
|||
<script setup lang="ts">
|
||||
import { watch, ref } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
visibility: Boolean,
|
||||
})
|
||||
const props = defineProps({ visibility: Boolean })
|
||||
const visible = ref<boolean>(props.visibility)
|
||||
|
||||
const loaderVisibility = ref<boolean>(props.visibility)
|
||||
|
||||
watch(props, () => (loaderVisibility.value = props.visibility))
|
||||
watch(props, () => (visible.value = props.visibility))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-inner-loading :showing="loaderVisibility" class="loader">
|
||||
<q-inner-loading :showing="visible" class="loader">
|
||||
<q-spinner-cube size="80px" color="primary" />
|
||||
</q-inner-loading>
|
||||
</template>
|
||||
|
||||
<style lang="sass">
|
||||
.loader
|
||||
z-index: 1000
|
||||
<style lang="scss">
|
||||
.loader {
|
||||
z-index: 1000;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,340 +1,188 @@
|
|||
<script lang="ts" setup>
|
||||
import type { QTableProps } from 'quasar'
|
||||
import { computed, ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import type { QTableProps } from 'quasar'
|
||||
import { useTreeDataStore, type TreeDataFolder } from '@/stores/tree-data'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
|
||||
import FileIcon from '@/components/FileIcon.vue'
|
||||
import DialogDelete from '@/components/DialogDelete.vue'
|
||||
import UploadExistDialog from './UploadExistDialog.vue'
|
||||
import FileForm from './FileForm.vue'
|
||||
import FolderForm from './FolderForm.vue'
|
||||
import FileFormWrapper from './FileFormWrapper.vue'
|
||||
import FolderFormWrapper from './FolderFormWrapper.vue'
|
||||
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
import useStorage from '@/stores/storage'
|
||||
|
||||
const storageStore = useStorage()
|
||||
const { folder, file, currentInfo } = storeToRefs(storageStore)
|
||||
const { goto, deleteFolder, deleteFile } = storageStore
|
||||
|
||||
const { getFormatDate, getSize, getType, getFileInfo } = useFileInfoStore()
|
||||
const { listDataFile, listDataFolder, currentDept, currentPath } =
|
||||
storeToRefs(useTreeDataStore())
|
||||
const {
|
||||
createFolder,
|
||||
editFolder,
|
||||
getFolder,
|
||||
deleteFolder,
|
||||
uploadFile,
|
||||
updateFile,
|
||||
deleteFile,
|
||||
checkFile,
|
||||
refaceFile,
|
||||
} = useTreeDataStore()
|
||||
|
||||
const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const
|
||||
const fileFormComponent = ref<InstanceType<typeof FileFormWrapper>>()
|
||||
const folderFormComponent = ref<InstanceType<typeof FolderFormWrapper>>()
|
||||
|
||||
const currentIcon = computed(() =>
|
||||
currentInfo.value.dept === 0
|
||||
? 'mdi-file-cabinet'
|
||||
: currentInfo.value.dept === 1
|
||||
? 'inbox'
|
||||
: 'o_folder_open',
|
||||
)
|
||||
const TREE_LEVEL_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const
|
||||
|
||||
const props = defineProps<{
|
||||
mode: 'admin' | 'user'
|
||||
}>()
|
||||
|
||||
const currentLevel = computed(() =>
|
||||
currentDept.value === 0
|
||||
? 'ตู้จัดเก็บเอกสาร'
|
||||
: currentDept.value === 1
|
||||
? 'ลิ้นชัก'
|
||||
: currentDept.value === 2
|
||||
? 'แฟ้ม'
|
||||
: 'แฟ้มย่อย',
|
||||
)
|
||||
|
||||
const currentIcon = computed(() =>
|
||||
currentDept.value === 0
|
||||
? 'mdi-file-cabinet'
|
||||
: currentDept.value === 1
|
||||
? 'inbox'
|
||||
: 'o_folder_open',
|
||||
)
|
||||
|
||||
const folderFormState = ref<boolean>(false)
|
||||
const folderFormPath = ref<string>('')
|
||||
const folderFormData = ref<{
|
||||
name?: string
|
||||
}>({})
|
||||
const folderFormType = ref<'edit' | 'create'>('create')
|
||||
const fileFormError = ref<{ fileExist?: boolean }>({})
|
||||
const fileExistNotification = ref<boolean>(false)
|
||||
|
||||
const fileFormState = ref<boolean>(false)
|
||||
const fileFormPath = ref<string>('')
|
||||
const fileFormData = ref<{
|
||||
file?: File
|
||||
title?: string
|
||||
description?: string
|
||||
keyword?: string[]
|
||||
category?: string[]
|
||||
}>({})
|
||||
const fileFormType = ref<'edit' | 'create'>('create')
|
||||
const fileFormComponent = ref<InstanceType<typeof FileForm>>()
|
||||
|
||||
const dialogDeleteState = ref<boolean>(false)
|
||||
const deleteFormPath = ref<string>('')
|
||||
const deleteFormType = ref<'deleteFolder' | 'deleteFile'>()
|
||||
const deleteState = ref<boolean>(false)
|
||||
const deletePath = ref<string>('')
|
||||
const deleteTarget = ref<'deleteFolder' | 'deleteFile'>()
|
||||
const deleteMap = { deleteFolder, deleteFile }
|
||||
|
||||
function triggerFolderDelete(pathname: string) {
|
||||
deleteFormType.value = 'deleteFolder'
|
||||
deleteFormPath.value = pathname
|
||||
dialogDeleteState.value = !dialogDeleteState.value
|
||||
deleteTarget.value = 'deleteFolder'
|
||||
deletePath.value = pathname
|
||||
deleteState.value = !deleteState.value
|
||||
}
|
||||
|
||||
function triggerFileDelete(pathname: string) {
|
||||
deleteFormType.value = 'deleteFile'
|
||||
deleteFormPath.value = pathname
|
||||
dialogDeleteState.value = !dialogDeleteState.value
|
||||
deleteTarget.value = 'deleteFile'
|
||||
deletePath.value = pathname
|
||||
deleteState.value = !deleteState.value
|
||||
}
|
||||
|
||||
function triggerFolderCreate() {
|
||||
folderFormType.value = 'create'
|
||||
folderFormData.value = {}
|
||||
folderFormState.value = !folderFormState.value
|
||||
}
|
||||
|
||||
function triggerFolderEdit(name: string, pathname: string) {
|
||||
folderFormType.value = 'edit'
|
||||
folderFormPath.value = pathname
|
||||
folderFormData.value.name = name
|
||||
folderFormState.value = true
|
||||
}
|
||||
|
||||
async function submitFolderForm(value: {
|
||||
mode: 'create' | 'edit'
|
||||
name: string
|
||||
}) {
|
||||
if (value.mode === 'create') {
|
||||
await createFolder(value.name)
|
||||
} else {
|
||||
await editFolder(value.name, folderFormPath.value)
|
||||
}
|
||||
}
|
||||
|
||||
function triggerFileCreate() {
|
||||
fileFormType.value = 'create'
|
||||
fileFormData.value = {}
|
||||
fileFormState.value = !fileFormState.value
|
||||
}
|
||||
|
||||
function triggerFileEdit(
|
||||
value: {
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
pathname: string,
|
||||
) {
|
||||
fileFormState.value = true
|
||||
fileFormType.value = 'edit'
|
||||
fileFormPath.value = pathname
|
||||
fileFormData.value = {
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
}
|
||||
}
|
||||
|
||||
const currentParam = ref<Parameters<typeof submitFileForm>[0]>()
|
||||
|
||||
async function submitFileForm(
|
||||
value: {
|
||||
mode: 'create' | 'edit'
|
||||
file?: File
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
force = false,
|
||||
) {
|
||||
currentParam.value = value
|
||||
|
||||
if (value.file && checkFile(value.file.name) && !force) {
|
||||
fileExistNotification.value = true
|
||||
return
|
||||
}
|
||||
|
||||
if (value.mode === 'create' && value.file) {
|
||||
await uploadFile(currentPath.value, value.file, {
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
refaceFile(currentPath.value)
|
||||
}, 3000)
|
||||
|
||||
setTimeout(() => {
|
||||
refaceFile(currentPath.value)
|
||||
}, 10000)
|
||||
} else {
|
||||
await updateFile(
|
||||
fileFormPath.value,
|
||||
{
|
||||
title: value.title,
|
||||
description: value.description,
|
||||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
},
|
||||
value.file,
|
||||
)
|
||||
|
||||
setTimeout(() => {
|
||||
refaceFile(currentPath.value)
|
||||
}, 3000)
|
||||
|
||||
setTimeout(() => {
|
||||
refaceFile(currentPath.value)
|
||||
}, 10000)
|
||||
}
|
||||
fileFormData.value = {}
|
||||
fileFormState.value = false
|
||||
currentParam.value = undefined
|
||||
fileFormComponent.value?.reset()
|
||||
}
|
||||
|
||||
const columnsFolder: QTableProps['columns'] = [
|
||||
const colFolder = [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
label: 'ชื่อ',
|
||||
align: 'left',
|
||||
field: (row) => row.name,
|
||||
format: (val) => `${val}`,
|
||||
field: 'name',
|
||||
sortable: true,
|
||||
style: 'width: 1000px',
|
||||
},
|
||||
{
|
||||
name: 'createdBy',
|
||||
align: 'center',
|
||||
label: 'สร้างโดย',
|
||||
align: 'center',
|
||||
field: 'createdBy',
|
||||
style: 'width: 20px',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'createdAt',
|
||||
align: 'center',
|
||||
label: 'วันที่สร้าง',
|
||||
align: 'center',
|
||||
field: 'createdAt',
|
||||
sortable: true,
|
||||
style: 'width: 20px',
|
||||
},
|
||||
{
|
||||
name: 'actions',
|
||||
align: 'center',
|
||||
label: '',
|
||||
field: '',
|
||||
style: 'width: 5px',
|
||||
},
|
||||
]
|
||||
] satisfies QTableProps['columns']
|
||||
|
||||
const columnsFile: QTableProps['columns'] = [
|
||||
const colFile = [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
label: 'ชื่อไฟล์',
|
||||
align: 'left',
|
||||
field: (row) => row.fileName,
|
||||
format: (val) => `${val}`,
|
||||
field: 'fileName',
|
||||
sortable: true,
|
||||
style: 'width: 200px',
|
||||
},
|
||||
{
|
||||
name: 'title',
|
||||
align: 'center',
|
||||
label: 'ชื่อเรื่อง',
|
||||
align: 'center',
|
||||
field: 'title',
|
||||
style: 'width: 200px',
|
||||
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'fileType',
|
||||
align: 'center',
|
||||
label: 'ประเภทของไฟล์',
|
||||
align: 'center',
|
||||
field: 'fileType',
|
||||
sortable: true,
|
||||
style: 'width: 200px',
|
||||
},
|
||||
{
|
||||
name: 'actions',
|
||||
align: 'center',
|
||||
label: '',
|
||||
field: '',
|
||||
style: 'width: 20px',
|
||||
},
|
||||
]
|
||||
] satisfies QTableProps['columns']
|
||||
|
||||
const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
||||
getFolder(row.pathname)
|
||||
}
|
||||
const onRowClick = ((_, row) => {
|
||||
goto(row.pathname)
|
||||
}) satisfies QTableProps['onRowClick']
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<file-form-wrapper ref="fileFormComponent" />
|
||||
<folder-form-wrapper ref="folderFormComponent" />
|
||||
<dialog-delete
|
||||
v-model:open="deleteState"
|
||||
@confirm="() => deleteTarget && deleteMap[deleteTarget](deletePath)"
|
||||
/>
|
||||
<div class="q-mt-md">
|
||||
<div class="q-gutter-sm">
|
||||
<div
|
||||
class="flex flex-break d justify-between space-between"
|
||||
v-if="currentDept >= 1 && props.mode == 'admin' && currentDept != 4"
|
||||
v-if="
|
||||
currentInfo.dept >= 1 &&
|
||||
currentInfo.dept < 4 &&
|
||||
props.mode === 'admin'
|
||||
"
|
||||
>
|
||||
<div>
|
||||
<span class="text-h6">{{ currentLevel }}</span>
|
||||
<span class="text-h6">{{ TREE_LEVEL_NAME[currentInfo.dept] }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<q-btn
|
||||
outline
|
||||
push
|
||||
dense
|
||||
class="q-px-md q-ml-md"
|
||||
:label="'สร้าง' + currentLevel"
|
||||
type="submit"
|
||||
color="primary"
|
||||
dense
|
||||
icon="add"
|
||||
@click.stop="() => triggerFolderCreate()"
|
||||
id="listViewFolderCreate"
|
||||
:label="'สร้าง' + TREE_LEVEL_NAME[currentInfo.dept]"
|
||||
@click.stop="() => folderFormComponent?.triggerFolderCreate()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<q-table
|
||||
flat
|
||||
bordered
|
||||
:rows="listDataFolder"
|
||||
:columns="columnsFolder"
|
||||
:pagination="{
|
||||
rowsPerPage: 20,
|
||||
}"
|
||||
@row-click="onRowClick"
|
||||
row-key="name"
|
||||
class="cursor"
|
||||
v-if="currentDept != 4"
|
||||
v-if="currentInfo.dept !== 4"
|
||||
:pagination="{ rowsPerPage: 20 }"
|
||||
:rows="folder[currentInfo.path]"
|
||||
:columns="colFolder"
|
||||
@row-click="onRowClick"
|
||||
>
|
||||
<template v-slot:body-cell-name="nameRow">
|
||||
<q-td style="width: 50%">
|
||||
<template v-slot:body-cell-name="data">
|
||||
<q-td>
|
||||
<q-icon :name="currentIcon" size="2em" color="primary" />
|
||||
{{ nameRow.row.name }}
|
||||
{{ data.row.name }}
|
||||
</q-td>
|
||||
</template>
|
||||
<template v-slot:body-cell-createdBy="createdByRow">
|
||||
<q-td>
|
||||
<div class="justify-center center-content">
|
||||
{{ createdByRow.row.createdBy }}
|
||||
</div>
|
||||
<template v-slot:body-cell-createdBy="data">
|
||||
<q-td class="text-center">
|
||||
<span class="sort-icon-offset-margin">
|
||||
{{ data.row.createdBy }}
|
||||
</span>
|
||||
</q-td>
|
||||
</template>
|
||||
<template v-slot:body-cell-createdAt="createdAtRow">
|
||||
<q-td>
|
||||
<div class="justify-center">
|
||||
{{ getFormatDate(createdAtRow.row.createdAt) }}
|
||||
</div>
|
||||
<template v-slot:body-cell-createdAt="data">
|
||||
<q-td class="text-center">
|
||||
<span class="sort-icon-offset-margin">
|
||||
{{ getFormatDate(data.row.createdAt) }}
|
||||
</span>
|
||||
</q-td>
|
||||
</template>
|
||||
<template v-slot:body-cell-actions="actionsRow">
|
||||
<template v-slot:body-cell-actions="data">
|
||||
<q-td class="justify-center">
|
||||
<div>
|
||||
<q-icon
|
||||
|
|
@ -349,32 +197,31 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
|||
self="center right"
|
||||
:offset="[5, 1]"
|
||||
>
|
||||
{{ actionsRow.row.name }}
|
||||
{{ data.row.name }}
|
||||
</q-tooltip>
|
||||
</div>
|
||||
<div v-if="props.mode === 'admin'">
|
||||
<q-btn
|
||||
flat
|
||||
color="positive"
|
||||
dense
|
||||
id="listViewFolderEdit"
|
||||
icon="o_edit"
|
||||
color="positive"
|
||||
@click.stop="
|
||||
triggerFolderEdit(
|
||||
actionsRow.row.name,
|
||||
actionsRow.row.pathname,
|
||||
folderFormComponent?.triggerFolderEdit(
|
||||
data.row.name,
|
||||
data.row.pathname,
|
||||
)
|
||||
"
|
||||
id="listViewFolderEdit"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
flat
|
||||
color="negative"
|
||||
dense
|
||||
:data-testid="actionsRow.row.name"
|
||||
icon="mdi-trash-can-outline"
|
||||
@click.stop="triggerFolderDelete(actionsRow.row.pathname)"
|
||||
id="listViewFolderDelete"
|
||||
color="negative"
|
||||
icon="mdi-trash-can-outline"
|
||||
:data-testid="data.row.name"
|
||||
@click.stop="triggerFolderDelete(data.row.pathname)"
|
||||
/>
|
||||
</div>
|
||||
</q-td>
|
||||
|
|
@ -382,74 +229,62 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
|||
</q-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="q-mt-md" v-if="currentDept >= 3">
|
||||
<div class="q-mt-md" v-if="currentInfo.dept >= 3">
|
||||
<div class="q-gutter-sm">
|
||||
<div class="flex flex-break d justify-between space-between">
|
||||
<div>
|
||||
<span class="text-h6">เอกสาร</span>
|
||||
</div>
|
||||
<div class="flex flex-break justify-between space-between">
|
||||
<div><span class="text-h6">เอกสาร</span></div>
|
||||
<div>
|
||||
<q-btn
|
||||
v-if="props.mode == 'admin'"
|
||||
outline
|
||||
push
|
||||
dense
|
||||
id="listViewFileCreate"
|
||||
class="q-px-md q-ml-md"
|
||||
label="สร้างเอกสาร"
|
||||
type="submit"
|
||||
color="primary"
|
||||
dense
|
||||
icon="add"
|
||||
@click.stop="() => triggerFileCreate()"
|
||||
id="listViewFileCreate"
|
||||
v-if="props.mode == 'admin'"
|
||||
@click.stop="() => fileFormComponent?.triggerFileCreate()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<q-table
|
||||
flat
|
||||
bordered
|
||||
:rows="listDataFile"
|
||||
:columns="columnsFile"
|
||||
row-key="name"
|
||||
:pagination="{
|
||||
rowsPerPage: 20,
|
||||
}"
|
||||
class="cursor"
|
||||
row-key="name"
|
||||
:rows="file[currentInfo.path]"
|
||||
:columns="colFile"
|
||||
:pagination="{ rowsPerPage: 20 }"
|
||||
>
|
||||
<template v-slot:body-cell-name="nameRow">
|
||||
<template v-slot:body-cell-name="data">
|
||||
<q-td
|
||||
style="width: 50%"
|
||||
@click="
|
||||
() => {
|
||||
currentDept >= 3
|
||||
? getFileInfo(nameRow.row)
|
||||
: getFolder(nameRow.row.pathname)
|
||||
}
|
||||
"
|
||||
id="listViewGetFileInfo"
|
||||
style="width: 50%"
|
||||
@click="() => getFileInfo(data.row)"
|
||||
>
|
||||
<file-icon
|
||||
size="list"
|
||||
:fileMimeType="
|
||||
nameRow.row.fileType ? nameRow.row.fileType : 'unknown'
|
||||
"
|
||||
:fileName="
|
||||
nameRow.row.fileName ? nameRow.row.fileName : 'unknown'
|
||||
"
|
||||
:fileMimeType="data.row.fileType || '-'"
|
||||
:fileName="data.row.fileName || '-'"
|
||||
/>
|
||||
{{ nameRow.row.fileName }}
|
||||
{{ data.row.fileName }}
|
||||
</q-td>
|
||||
</template>
|
||||
|
||||
<template v-slot:body-cell-fileType="fileTypeRow">
|
||||
<q-td>
|
||||
<div class="justify-center">
|
||||
{{ getType(fileTypeRow.row.fileType, fileTypeRow.row.fileName) }}
|
||||
</div>
|
||||
<template v-slot:body-cell-title="data">
|
||||
<q-td class="text-center">
|
||||
<span class="sort-icon-offset-margin">{{ data.row.title }}</span>
|
||||
</q-td>
|
||||
</template>
|
||||
|
||||
<template v-slot:body-cell-actions="actionsRow">
|
||||
<template v-slot:body-cell-fileType="data">
|
||||
<q-td class="text-center">
|
||||
<span class="sort-icon-offset-margin">
|
||||
{{ getType(data.row.fileType, data.row.fileName) }}
|
||||
</span>
|
||||
</q-td>
|
||||
</template>
|
||||
<template v-slot:body-cell-actions="data">
|
||||
<q-td class="justify-center">
|
||||
<div>
|
||||
<q-icon
|
||||
|
|
@ -463,7 +298,7 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
|||
self="center right"
|
||||
:offset="[5, 1]"
|
||||
>
|
||||
{{ getSize(actionsRow.row.fileSize) }}
|
||||
{{ getSize(data.row.fileSize) }}
|
||||
</q-tooltip>
|
||||
</div>
|
||||
<div v-if="props.mode === 'admin'">
|
||||
|
|
@ -473,17 +308,21 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
|||
dense
|
||||
icon="o_edit"
|
||||
@click.stop="
|
||||
() => triggerFileEdit(actionsRow.row, actionsRow.row.pathname)
|
||||
() =>
|
||||
fileFormComponent?.triggerFileEdit(
|
||||
data.row,
|
||||
data.row.pathname,
|
||||
)
|
||||
"
|
||||
id="listViewFileEdit"
|
||||
/>
|
||||
<q-btn
|
||||
flat
|
||||
color="negative"
|
||||
dense
|
||||
icon="mdi-trash-can-outline"
|
||||
@click.stop="() => triggerFileDelete(actionsRow.row.pathname)"
|
||||
id="listViewFileDelete"
|
||||
color="negative"
|
||||
icon="mdi-trash-can-outline"
|
||||
@click.stop="() => triggerFileDelete(data.row.pathname)"
|
||||
/>
|
||||
</div>
|
||||
</q-td>
|
||||
|
|
@ -491,44 +330,6 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
|||
</q-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<file-form
|
||||
ref="fileFormComponent"
|
||||
:mode="fileFormType"
|
||||
:error="fileFormError"
|
||||
v-model:open="fileFormState"
|
||||
v-model:title="fileFormData.title"
|
||||
v-model:description="fileFormData.description"
|
||||
v-model:keyword="fileFormData.keyword"
|
||||
v-model:category="fileFormData.category"
|
||||
@reset="() => (fileFormError = {})"
|
||||
@filechange="(name: string) => (fileFormError.fileExist = checkFile(name))"
|
||||
@submit="submitFileForm"
|
||||
/>
|
||||
|
||||
<folder-form
|
||||
:mode="folderFormType"
|
||||
:tree="DEPT_NAME[currentDept]"
|
||||
v-if="currentDept < 4"
|
||||
v-model:open="folderFormState"
|
||||
v-model:name="folderFormData.name"
|
||||
@submit="submitFolderForm"
|
||||
/>
|
||||
|
||||
<upload-exist-dialog
|
||||
v-model:notification="fileExistNotification"
|
||||
@confirm="() => currentParam && submitFileForm(currentParam, true)"
|
||||
@cancel="() => (currentParam = undefined)"
|
||||
/>
|
||||
|
||||
<dialog-delete
|
||||
v-model:open="dialogDeleteState"
|
||||
@confirm="
|
||||
() =>
|
||||
deleteFormType &&
|
||||
(deleteFolder(deleteFormPath), deleteFile(deleteFormPath))
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
@ -538,7 +339,7 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.center-content {
|
||||
.sort-icon-offset-margin {
|
||||
margin-right: 18px;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useTreeDataStore } from '@/stores/tree-data'
|
||||
import { useSearchDataStore } from '@/stores/searched-data'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
|
||||
|
|
@ -9,54 +8,32 @@ import FileItem from './FileItem.vue'
|
|||
import TreeExplorer from './TreeExplorer.vue'
|
||||
import FileSearched from './FileSearched.vue'
|
||||
import ListView from './ListView.vue'
|
||||
import FolderForm from './FolderForm.vue'
|
||||
import FolderFormWrapper from './FolderFormWrapper.vue'
|
||||
import GlobalErrorDialog from './GlobalErrorDialog.vue'
|
||||
|
||||
import SearchBar from '@/modules/01_user/components/SearchBar.vue'
|
||||
import FileDownload from '@/modules/01_user/components/FileDownload.vue'
|
||||
import useStorage from '@/stores/storage'
|
||||
|
||||
const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const
|
||||
|
||||
const { isFilePreview } = storeToRefs(useFileInfoStore())
|
||||
const { isSearch } = storeToRefs(useSearchDataStore())
|
||||
const { data, currentDept, currentPath } = storeToRefs(useTreeDataStore())
|
||||
const { createFolder, getCabinet, gotoParent, getFolder } = useTreeDataStore()
|
||||
|
||||
const viewMode = ref<'view_list' | 'view_module'>('view_list')
|
||||
const props = defineProps<{
|
||||
mode: 'admin' | 'user'
|
||||
}>()
|
||||
|
||||
const folderFormState = ref<boolean>(false)
|
||||
const folderFormType = ref<'edit' | 'create'>('create')
|
||||
const folderFormData = ref<{
|
||||
name?: string
|
||||
}>({})
|
||||
const { isFilePreview } = storeToRefs(useFileInfoStore())
|
||||
const { isSearch } = storeToRefs(useSearchDataStore())
|
||||
|
||||
function triggerFolderCreate() {
|
||||
folderFormType.value = 'create'
|
||||
folderFormData.value = {}
|
||||
folderFormState.value = !folderFormState.value
|
||||
}
|
||||
const storageStore = useStorage()
|
||||
const { tree, currentInfo } = storeToRefs(storageStore)
|
||||
const { goto, gotoParent } = storageStore
|
||||
|
||||
async function submitFolderForm(value: {
|
||||
mode: 'create' | 'edit'
|
||||
name: string
|
||||
}) {
|
||||
if (value.mode === 'create') {
|
||||
await createFolder(value.name)
|
||||
}
|
||||
}
|
||||
const viewMode = ref<'view_list' | 'view_module'>('view_list')
|
||||
|
||||
onMounted(async () => {
|
||||
await getCabinet()
|
||||
|
||||
const sessionCurrentPath = sessionStorage.getItem('currentPath')
|
||||
|
||||
if (sessionCurrentPath) await getFolder(sessionCurrentPath)
|
||||
})
|
||||
const folderFormComponent = ref<InstanceType<typeof FolderFormWrapper>>()
|
||||
</script>
|
||||
<template>
|
||||
<folder-form-wrapper ref="folderFormComponent" />
|
||||
<global-error-dialog />
|
||||
|
||||
<section id="header" class="q-px-md q-pt-md q-pb-none">
|
||||
<div class="q-my-md row items-center">
|
||||
<div class="col">
|
||||
|
|
@ -81,8 +58,7 @@ onMounted(async () => {
|
|||
class="block q-my-sm text-weight-bold pointer"
|
||||
@click="
|
||||
() => {
|
||||
currentPath = ''
|
||||
getFolder(currentPath)
|
||||
goto()
|
||||
isSearch = false
|
||||
isFilePreview = false
|
||||
}
|
||||
|
|
@ -95,13 +71,13 @@ onMounted(async () => {
|
|||
flat
|
||||
color="primary"
|
||||
icon="add"
|
||||
@click.stop="() => triggerFolderCreate()"
|
||||
data-testid="createFolder"
|
||||
@click.stop="() => folderFormComponent?.triggerFolderCreate()"
|
||||
/>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div class="q-pa-md">
|
||||
<tree-explorer :data="data" :level="1" />
|
||||
<tree-explorer :data="tree" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -120,54 +96,57 @@ onMounted(async () => {
|
|||
flat
|
||||
dense
|
||||
class="q-mr-sm q-px-sm"
|
||||
v-if="isSearch == true || currentDept > 0"
|
||||
v-if="isSearch || currentInfo.dept > 0"
|
||||
@click="
|
||||
() => {
|
||||
isSearch
|
||||
? (isSearch = false)
|
||||
: ((folderFormState = false), gotoParent())
|
||||
isSearch ? (isSearch = false) : gotoParent()
|
||||
}
|
||||
"
|
||||
>
|
||||
<q-icon name="arrow_back" size="1rem" color="primary" />
|
||||
</q-btn>
|
||||
<span v-if="isSearch === true">ผลการค้นหา</span>
|
||||
<q-breadcrumbs v-if="isSearch === false" active-color="primary">
|
||||
<span v-if="isSearch">ผลการค้นหา</span>
|
||||
<q-breadcrumbs
|
||||
v-if="!isSearch"
|
||||
active-color="grey"
|
||||
separator-color="grey"
|
||||
>
|
||||
<q-breadcrumbs-el
|
||||
v-if="currentPath === '/' || !currentPath"
|
||||
v-if="currentInfo.path === '/' || !currentInfo.path"
|
||||
label="ตู้เอกสารทั้งหมด"
|
||||
/>
|
||||
<q-btn
|
||||
v-if="
|
||||
mode === 'admin' &&
|
||||
viewMode === 'view_module' &&
|
||||
currentDept === 0
|
||||
"
|
||||
dense
|
||||
id="createFolder"
|
||||
class="q-px-md q-ml-md al"
|
||||
label="สร้างตู้เก็บเอกสาร"
|
||||
type="submit"
|
||||
color="primary"
|
||||
dense
|
||||
icon="add"
|
||||
@click.stop="() => triggerFolderCreate()"
|
||||
id="createFolder"
|
||||
v-if="
|
||||
mode === 'admin' &&
|
||||
viewMode === 'view_module' &&
|
||||
currentInfo.dept === 0
|
||||
"
|
||||
@click.stop="
|
||||
() => folderFormComponent?.triggerFolderCreate()
|
||||
"
|
||||
/>
|
||||
<q-breadcrumbs-el
|
||||
class="text-primary pointer"
|
||||
v-for="(fragments, index) in currentPath
|
||||
class="pointer"
|
||||
v-for="(fragments, index) in currentInfo.path
|
||||
.split('/')
|
||||
.filter(Boolean)"
|
||||
:label="fragments"
|
||||
@click="
|
||||
() => {
|
||||
currentPath =
|
||||
currentPath
|
||||
goto(
|
||||
currentInfo.path
|
||||
.split('/')
|
||||
.filter(Boolean)
|
||||
.slice(0, index + 1)
|
||||
.join('/') + '/'
|
||||
|
||||
getFolder(currentPath)
|
||||
.join('/') + '/',
|
||||
)
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
|
@ -178,15 +157,16 @@ onMounted(async () => {
|
|||
<q-btn
|
||||
flat
|
||||
dense
|
||||
id="getFolder"
|
||||
color="blue-grey-2"
|
||||
icon="refresh"
|
||||
class="q-mr-sm"
|
||||
@click="() => getFolder(currentPath)"
|
||||
id="getFolder"
|
||||
@click="() => goto(currentInfo.path, true)"
|
||||
/>
|
||||
<q-btn
|
||||
flat
|
||||
dense
|
||||
id="viewMode"
|
||||
color="blue-grey-2"
|
||||
:icon="viewMode"
|
||||
@click="
|
||||
|
|
@ -195,7 +175,6 @@ onMounted(async () => {
|
|||
viewMode === 'view_list' ? 'view_module' : 'view_list'
|
||||
}
|
||||
"
|
||||
id="viewMode"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -203,15 +182,15 @@ onMounted(async () => {
|
|||
<file-searched
|
||||
:viewMode="viewMode"
|
||||
:action="props.mode === 'admin'"
|
||||
v-if="isSearch === true"
|
||||
v-if="isSearch"
|
||||
/>
|
||||
<file-item
|
||||
:viewMode="viewMode"
|
||||
:action="props.mode === 'admin'"
|
||||
v-if="isSearch === false && viewMode === 'view_list'"
|
||||
v-if="!isSearch && viewMode === 'view_list'"
|
||||
/>
|
||||
<list-view
|
||||
v-if="isSearch === false && viewMode === 'view_module'"
|
||||
v-if="!isSearch && viewMode === 'view_module'"
|
||||
:mode="mode"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -219,17 +198,6 @@ onMounted(async () => {
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<folder-form
|
||||
:mode="folderFormType"
|
||||
:tree="DEPT_NAME[currentDept]"
|
||||
v-if="currentDept < 4"
|
||||
v-model:open="folderFormState"
|
||||
v-model:name="folderFormData.name"
|
||||
@submit="submitFolderForm"
|
||||
/>
|
||||
|
||||
<global-error-dialog />
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -1,38 +1,46 @@
|
|||
<script setup lang="ts">
|
||||
import { getUsername, logout } from '@/services/KeyCloakService'
|
||||
import { ref } from 'vue'
|
||||
const dropdownOpen = ref<boolean>(false)
|
||||
const accountName = ref<string>(getUsername())
|
||||
const dropdown = ref<boolean>(false)
|
||||
const name = ref<string>(getUsername())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
@click="() => (dropdownOpen = !dropdownOpen)"
|
||||
@click="() => (dropdown = !dropdown)"
|
||||
class="row q-px-xs cursor"
|
||||
id="app-toolbar-title"
|
||||
>
|
||||
<div class="col">
|
||||
<q-avatar>
|
||||
<img :src="`https://cdn.quasar.dev/img/avatar1.jpg`" />
|
||||
<q-avatar class="q-mt-xs hideprofile">
|
||||
<img src="../assets/profile.png" />
|
||||
</q-avatar>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="row q-pl-sm">
|
||||
<span class="text-body1" style="font-size:13px">
|
||||
{{ accountName }}
|
||||
<span class="text-body1" style="font-size: 13px">
|
||||
{{ name }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="row q-pl-sm">
|
||||
<span class="text-caption text-grey" style="font-size:10px"> เจ้าหน้าที่ </span>
|
||||
<span class="text-caption text-grey" style="font-size: 10px">
|
||||
เจ้าหน้าที่
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<q-btn-dropdown stretch flat v-model="dropdownOpen">
|
||||
<q-btn-dropdown stretch flat v-model="dropdown">
|
||||
<q-list>
|
||||
<q-item clickable v-close-popup tabindex="0" @click="() => logout()">
|
||||
<q-item-section avatar>
|
||||
<q-avatar icon="logout" color="primary" text-color="white" caption>
|
||||
<q-avatar
|
||||
caption
|
||||
icon="logout"
|
||||
color="primary"
|
||||
text-color="white"
|
||||
size="1.5rem"
|
||||
>
|
||||
</q-avatar>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
|
|
@ -44,6 +52,12 @@ const accountName = ref<string>(getUsername())
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@media only screen and (max-width: 450px) {
|
||||
.hideprofile {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.cursor {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
<script setup lang="ts">
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useTreeDataStore, type TreeDataFolder } from '@/stores/tree-data'
|
||||
import { useSearchDataStore } from '@/stores/searched-data'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
import useStorage from '@/stores/storage'
|
||||
|
||||
const { isSearch } = storeToRefs(useSearchDataStore())
|
||||
const { isFilePreview } = storeToRefs(useFileInfoStore())
|
||||
const { getFolder } = useTreeDataStore()
|
||||
const store = useStorage()
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
data: TreeDataFolder[]
|
||||
level: number
|
||||
data: typeof store.tree
|
||||
level?: number
|
||||
}>(),
|
||||
{
|
||||
level: 0,
|
||||
level: 1,
|
||||
},
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<q-list v-for="folder in data" class="rounded-borders">
|
||||
<q-list v-for="v in data" class="rounded-borders">
|
||||
<q-expansion-item
|
||||
@click="
|
||||
() => {
|
||||
getFolder(folder.pathname, false)
|
||||
store.goto(v.pathname)
|
||||
isSearch = false
|
||||
isFilePreview = false
|
||||
}
|
||||
|
|
@ -40,13 +40,12 @@ const props = withDefaults(
|
|||
? 'inbox'
|
||||
: 'o_folder_open'
|
||||
"
|
||||
:label="folder.name"
|
||||
class="text-overflow-handle"
|
||||
v-model="folder.status"
|
||||
:label="v.name"
|
||||
class="text-overflow-handle active"
|
||||
>
|
||||
<tree-explorer
|
||||
v-if="folder.folder"
|
||||
:data="folder.folder"
|
||||
v-if="v.folder"
|
||||
:data="v.folder"
|
||||
:level="props.level + 1"
|
||||
/>
|
||||
</q-expansion-item>
|
||||
|
|
@ -55,7 +54,7 @@ const props = withDefaults(
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.q-item[aria-expanded='true']) {
|
||||
.active :deep(.q-item[aria-expanded='true']) {
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ const optionsOp = [
|
|||
{ label: 'หรือ', value: 'OR' },
|
||||
]
|
||||
const props = defineProps<{
|
||||
searchSubmit: Function
|
||||
submitSearch: Function
|
||||
submitSearchData: {
|
||||
AND: {
|
||||
field: string
|
||||
|
|
@ -132,7 +132,7 @@ function clearAdvSearchData() {
|
|||
outlined
|
||||
v-model="item.value"
|
||||
placeholder="เอกสาร"
|
||||
@keydown.enter.prevent="searchSubmit()"
|
||||
@keydown.enter.prevent="submitSearch()"
|
||||
><template v-slot:append>
|
||||
<q-icon
|
||||
v-if="item.value"
|
||||
|
|
@ -180,7 +180,7 @@ function clearAdvSearchData() {
|
|||
id="advSearchDes"
|
||||
dense
|
||||
outlined
|
||||
@keydown.enter.prevent="searchSubmit()"
|
||||
@keydown.enter.prevent="submitSearch()"
|
||||
v-model="advSearchDataField.description"
|
||||
><template v-slot:prepend
|
||||
><span class="text-subtitle2">รายละเอียด:</span></template
|
||||
|
|
@ -203,8 +203,8 @@ function clearAdvSearchData() {
|
|||
color="primary"
|
||||
label="ค้นหา"
|
||||
icon="mdi-magnify"
|
||||
@click="() => props.searchSubmit()"
|
||||
id="advSearchSubmit"
|
||||
@click="() => props.submitSearch()"
|
||||
id="advSubmitSearch"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import axios from 'axios'
|
|||
import { storeToRefs } from 'pinia'
|
||||
import axiosClient from '@/services/HttpService'
|
||||
|
||||
import type { EhrFile } from '@/stores/tree-data'
|
||||
import type { StorageFile } from '@/stores/storage'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
|
||||
import FileIcon from '@/components/FileIcon.vue'
|
||||
|
|
@ -25,7 +25,7 @@ async function downloadSubmit(path: string | undefined) {
|
|||
formatPath = `cabinet/${cabinet}/drawer/${drawer}/folder/${folder}/subfolder/${subfolder}/file/${file}`
|
||||
}
|
||||
|
||||
const res = await axiosClient.get<EhrFile & { download: string }>(
|
||||
const res = await axiosClient.get<StorageFile & { download: string }>(
|
||||
`${import.meta.env.VITE_API_ENDPOINT}${formatPath}`,
|
||||
)
|
||||
await axios
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ import { storeToRefs } from 'pinia'
|
|||
import axiosClient from '@/services/HttpService'
|
||||
import mime from 'mime'
|
||||
|
||||
import type { EhrFile } from '@/stores/tree-data'
|
||||
import type { StorageFile } from '@/stores/storage'
|
||||
import { useSearchDataStore } from '@/stores/searched-data'
|
||||
import { useLoader } from '@/stores/loader'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
|
||||
import AdvancedSearch from '@/modules/01_user/components/AdvancedSearch.vue'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
|
||||
const loaderStore = useLoader()
|
||||
const { isFilePreview } = storeToRefs(useFileInfoStore())
|
||||
|
|
@ -39,7 +39,7 @@ const props = defineProps<{
|
|||
mode: 'admin' | 'user'
|
||||
}>()
|
||||
|
||||
async function searchSubmit() {
|
||||
async function submitSearch() {
|
||||
isFilePreview.value = false
|
||||
if (searchData.value.value.trim() !== '') {
|
||||
submitSearchData.value = { AND: [], OR: [] }
|
||||
|
|
@ -92,7 +92,7 @@ async function searchSubmit() {
|
|||
|
||||
try {
|
||||
loaderStore.show()
|
||||
const res = await axiosClient.post<EhrFile[]>(
|
||||
const res = await axiosClient.post<StorageFile[]>(
|
||||
`${import.meta.env.VITE_API_ENDPOINT}/search`,
|
||||
submitSearchData.value,
|
||||
)
|
||||
|
|
@ -110,7 +110,7 @@ watch(
|
|||
() => isActFoundFile.value,
|
||||
(edited) => {
|
||||
if (edited === true) {
|
||||
searchSubmit()
|
||||
submitSearch()
|
||||
setTimeout(() => {
|
||||
isActFoundFile.value = false
|
||||
}, 300)
|
||||
|
|
@ -139,13 +139,13 @@ watch(
|
|||
bg-color="white"
|
||||
v-model="searchData.value"
|
||||
id="inputSearch"
|
||||
@update:model-value="searchSubmit"
|
||||
@keydown.enter.prevent="searchSubmit"
|
||||
@update:model-value="submitSearch"
|
||||
@keydown.enter.prevent="submitSearch"
|
||||
data-testid="searchAdmin"
|
||||
>
|
||||
<template v-slot:prepend />
|
||||
<template v-slot:append
|
||||
><q-icon name="search" class="pointer" @click="searchSubmit"
|
||||
><q-icon name="search" class="pointer" @click="submitSearch"
|
||||
/></template>
|
||||
</q-input>
|
||||
</div>
|
||||
|
|
@ -173,7 +173,7 @@ watch(
|
|||
outlined
|
||||
v-model="searchData.value"
|
||||
placeholder="เอกสาร"
|
||||
@keydown.enter.prevent="searchSubmit"
|
||||
@keydown.enter.prevent="submitSearch"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon
|
||||
|
|
@ -192,7 +192,7 @@ watch(
|
|||
<div class="row items-center justify-between q-gutter-y-md q-pt-sm">
|
||||
<div class="column col-grow">
|
||||
<advanced-search
|
||||
:searchSubmit="searchSubmit"
|
||||
:submitSearch="submitSearch"
|
||||
:submit-search-data="submitSearchData"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -202,8 +202,8 @@ watch(
|
|||
color="primary"
|
||||
label="ค้นหา"
|
||||
icon="mdi-magnify"
|
||||
@click="searchSubmit"
|
||||
id="searchSubmit"
|
||||
@click="submitSearch"
|
||||
id="submitSearch"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import axios from 'axios'
|
|||
import { getToken } from './KeyCloakService'
|
||||
import { useErrorStore } from '@/stores/error'
|
||||
|
||||
const error = useErrorStore()
|
||||
|
||||
const instance = axios.create()
|
||||
|
||||
instance.interceptors.request.use(async (config) => {
|
||||
|
|
@ -14,6 +12,7 @@ instance.interceptors.request.use(async (config) => {
|
|||
instance.interceptors.response.use(
|
||||
(res) => res,
|
||||
(err) => {
|
||||
const error = useErrorStore()
|
||||
const status = err.response.status
|
||||
const data = err.response.data
|
||||
|
||||
|
|
|
|||
|
|
@ -2,15 +2,20 @@ import Keycloak from 'keycloak-js'
|
|||
|
||||
const keycloak = new Keycloak('/keycloak.json')
|
||||
|
||||
export async function login(cb?: (...args: any[]) => void) {
|
||||
const auth = await keycloak
|
||||
.init({
|
||||
onLoad: 'login-required',
|
||||
responseMode: 'query',
|
||||
checkLoginIframe: false,
|
||||
})
|
||||
.catch((e) => console.dir(e))
|
||||
let init = false
|
||||
|
||||
export async function login(cb?: (...args: any[]) => void) {
|
||||
const auth = !init
|
||||
? await keycloak
|
||||
.init({
|
||||
onLoad: 'login-required',
|
||||
responseMode: 'query',
|
||||
checkLoginIframe: false,
|
||||
})
|
||||
.catch((e) => console.dir(e))
|
||||
: await keycloak.login().catch((e) => console.dir(e))
|
||||
|
||||
if (auth) init = true
|
||||
if (auth && cb) cb()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@ import { ref } from 'vue'
|
|||
import { defineStore } from 'pinia'
|
||||
import mime from 'mime'
|
||||
|
||||
import type { EhrFile } from '@/stores/tree-data'
|
||||
import type { StorageFile } from '@/stores/storage'
|
||||
|
||||
export interface MimeMap {
|
||||
[key: string]: { icon: string; color: string }
|
||||
}
|
||||
export interface TypeSetting {
|
||||
export interface IconMap {
|
||||
[key: string]: { icon: string; color: string }
|
||||
}
|
||||
|
||||
export const useFileInfoStore = defineStore('info', () => {
|
||||
const fileInfo = ref<EhrFile>()
|
||||
const isFilePreview = ref<Boolean>(false)
|
||||
const fileIcon: TypeSetting = {
|
||||
const fileInfo = ref<StorageFile>()
|
||||
const fileIcon: IconMap = {
|
||||
word: { icon: 'mdi-file-word-outline', color: 'blue-11' },
|
||||
excel: { icon: 'mdi-file-excel-outline', color: 'green-4' },
|
||||
powerpoint: { icon: 'mdi-file-powerpoint-outline', color: 'orange-4' },
|
||||
|
|
@ -23,103 +23,55 @@ export const useFileInfoStore = defineStore('info', () => {
|
|||
image: { icon: 'mdi-file-image-outline', color: 'blue-11' },
|
||||
}
|
||||
const mimeFileMapping: MimeMap = {
|
||||
'application/msword': {
|
||||
...fileIcon.word,
|
||||
},
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': {
|
||||
...fileIcon.word,
|
||||
},
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.template': {
|
||||
...fileIcon.word,
|
||||
},
|
||||
'application/vnd.ms-word.document.macroEnabled.12': {
|
||||
...fileIcon.word,
|
||||
},
|
||||
'application/vnd.ms-word.template.macroEnabled.12': {
|
||||
...fileIcon.word,
|
||||
},
|
||||
|
||||
'application/vnd.ms-excel': {
|
||||
...fileIcon.excel,
|
||||
},
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {
|
||||
...fileIcon.excel,
|
||||
},
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.template': {
|
||||
...fileIcon.excel,
|
||||
},
|
||||
'application/vnd.ms-excel.sheet.macroEnabled.12': {
|
||||
...fileIcon.excel,
|
||||
},
|
||||
'application/vnd.ms-excel.template.macroEnabled.12': {
|
||||
...fileIcon.excel,
|
||||
},
|
||||
'application/vnd.ms-excel.addin.macroEnabled.12': {
|
||||
...fileIcon.excel,
|
||||
},
|
||||
'application/vnd.ms-excel.sheet.binary.macroEnabled.12': {
|
||||
...fileIcon.excel,
|
||||
},
|
||||
|
||||
'application/vnd.ms-powerpoint': {
|
||||
...fileIcon.powerpoint,
|
||||
},
|
||||
'application/msword': fileIcon.word,
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
||||
fileIcon.word,
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.template':
|
||||
fileIcon.word,
|
||||
'application/vnd.ms-word.document.macroEnabled.12': fileIcon.word,
|
||||
'application/vnd.ms-word.template.macroEnabled.12': fileIcon.word,
|
||||
'application/vnd.ms-excel': fileIcon.excel,
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
||||
fileIcon.excel,
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.template':
|
||||
fileIcon.excel,
|
||||
'application/vnd.ms-excel.sheet.macroEnabled.12': fileIcon.excel,
|
||||
'application/vnd.ms-excel.template.macroEnabled.12': fileIcon.excel,
|
||||
'application/vnd.ms-excel.addin.macroEnabled.12': fileIcon.excel,
|
||||
'application/vnd.ms-excel.sheet.binary.macroEnabled.12': fileIcon.excel,
|
||||
'application/vnd.ms-powerpoint': fileIcon.powerpoint,
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
||||
{
|
||||
...fileIcon.powerpoint,
|
||||
},
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.template': {
|
||||
...fileIcon.powerpoint,
|
||||
},
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.slideshow': {
|
||||
...fileIcon.powerpoint,
|
||||
},
|
||||
'application/vnd.ms-powerpoint.addin.macroEnabled.12': {
|
||||
...fileIcon.powerpoint,
|
||||
},
|
||||
'application/vnd.ms-powerpoint.presentation.macroEnabled.12': {
|
||||
...fileIcon.powerpoint,
|
||||
},
|
||||
'application/vnd.ms-powerpoint.template.macroEnabled.12': {
|
||||
...fileIcon.powerpoint,
|
||||
},
|
||||
'application/vnd.ms-powerpoint.slideshow.macroEnabled.12': {
|
||||
...fileIcon.powerpoint,
|
||||
},
|
||||
|
||||
'application/pdf': {
|
||||
...fileIcon.pdf,
|
||||
},
|
||||
|
||||
'text/plain': {
|
||||
...fileIcon.txt,
|
||||
},
|
||||
|
||||
'image/png': {
|
||||
...fileIcon.image,
|
||||
},
|
||||
'image/jpeg': {
|
||||
...fileIcon.image,
|
||||
},
|
||||
fileIcon.powerpoint,
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.template':
|
||||
fileIcon.powerpoint,
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.slideshow':
|
||||
fileIcon.powerpoint,
|
||||
'application/vnd.ms-powerpoint.addin.macroEnabled.12': fileIcon.powerpoint,
|
||||
'application/vnd.ms-powerpoint.presentation.macroEnabled.12':
|
||||
fileIcon.powerpoint,
|
||||
'application/vnd.ms-powerpoint.template.macroEnabled.12':
|
||||
fileIcon.powerpoint,
|
||||
'application/vnd.ms-powerpoint.slideshow.macroEnabled.12':
|
||||
fileIcon.powerpoint,
|
||||
'application/pdf': fileIcon.pdf,
|
||||
'text/plain': fileIcon.txt,
|
||||
'image/png': fileIcon.image,
|
||||
'image/jpeg': fileIcon.image,
|
||||
}
|
||||
|
||||
function getType(
|
||||
mimeType: string | undefined,
|
||||
fileName: string | undefined,
|
||||
): string {
|
||||
if (mimeType === undefined) {
|
||||
return 'ไม่ทราบประเภท'
|
||||
if (mimeType === undefined) return 'ไม่ทราบประเภท'
|
||||
|
||||
const extension = mime.getExtension(mimeType)
|
||||
|
||||
if (extension) return '.' + extension
|
||||
if (fileName && fileName.includes('.')) {
|
||||
return fileName.substring(fileName.lastIndexOf('.'))
|
||||
}
|
||||
|
||||
const extFomMime = mime.getExtension(mimeType)
|
||||
if (extFomMime) {
|
||||
return '.' + extFomMime
|
||||
}
|
||||
if (fileName && fileName.includes('.')) {
|
||||
const dotIndex = fileName.lastIndexOf('.')
|
||||
const extension = fileName.substring(dotIndex)
|
||||
return extension
|
||||
}
|
||||
return 'ไม่ทราบประเภท'
|
||||
}
|
||||
|
||||
|
|
@ -136,20 +88,19 @@ export const useFileInfoStore = defineStore('info', () => {
|
|||
}
|
||||
|
||||
function getSize(size: string | undefined): string {
|
||||
if (size === undefined) {
|
||||
return 'ไม่ทราบขนาด'
|
||||
}
|
||||
if (size === undefined) return 'ไม่ทราบขนาด'
|
||||
|
||||
const units = ['B', 'KB', 'MB', 'GB', 'TB']
|
||||
|
||||
let i = 0
|
||||
let sizeNumber = parseFloat(size)
|
||||
while (sizeNumber >= 1024 && i < units.length - 1) {
|
||||
while (sizeNumber >= 1024 && i++ < units.length - 1) {
|
||||
sizeNumber /= 1024
|
||||
i++
|
||||
}
|
||||
return sizeNumber.toFixed(2) + ' ' + units[i]
|
||||
}
|
||||
|
||||
function getFileInfo(data: EhrFile) {
|
||||
function getFileInfo(data: StorageFile) {
|
||||
isFilePreview.value = true
|
||||
fileInfo.value = data
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,45 +1,45 @@
|
|||
import { ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import type { EhrFile } from '@/stores/tree-data'
|
||||
import type { StorageFile } from '@/stores/storage'
|
||||
|
||||
export interface searchData {
|
||||
export interface Search {
|
||||
field: string
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface advSearchDataRow {
|
||||
export interface AdvancedSearch {
|
||||
op: 'AND' | 'OR'
|
||||
field: 'title' | 'keyword'
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface advSearchDataField {
|
||||
export interface AdvancedSearchFields {
|
||||
keyword: string[]
|
||||
description: string
|
||||
}
|
||||
|
||||
export const useSearchDataStore = defineStore('searched', () => {
|
||||
const foundFile = ref<EhrFile[]>([])
|
||||
const foundFile = ref<StorageFile[]>([])
|
||||
const isAdvSearchCall = ref<boolean>(false)
|
||||
const isSearch = ref<Boolean>(false)
|
||||
const isActFoundFile = ref<Boolean>(false)
|
||||
const searchData = ref<searchData>({
|
||||
const searchData = ref<Search>({
|
||||
field: 'title',
|
||||
value: '',
|
||||
})
|
||||
const advSearchDataRow = ref<advSearchDataRow[]>([
|
||||
const advSearchDataRow = ref<AdvancedSearch[]>([
|
||||
{
|
||||
op: 'AND',
|
||||
field: 'title',
|
||||
value: '',
|
||||
},
|
||||
])
|
||||
const advSearchDataField = ref<advSearchDataField>({
|
||||
const advSearchDataField = ref<AdvancedSearchFields>({
|
||||
keyword: [],
|
||||
description: '',
|
||||
})
|
||||
|
||||
async function getFoundFile(data: EhrFile[]) {
|
||||
async function getFoundFile(data: StorageFile[]) {
|
||||
foundFile.value = data
|
||||
}
|
||||
|
||||
|
|
|
|||
457
Services/client/src/stores/storage.ts
Normal file
457
Services/client/src/stores/storage.ts
Normal file
|
|
@ -0,0 +1,457 @@
|
|||
import { computed, reactive, ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { io } from 'socket.io-client'
|
||||
import axios from 'axios'
|
||||
import { useErrorStore } from '@/stores/error'
|
||||
|
||||
import api from '@/services/HttpService'
|
||||
|
||||
import { useLoader } from './loader'
|
||||
|
||||
type Path = string
|
||||
|
||||
export interface StorageFolder {
|
||||
pathname: string
|
||||
name: string
|
||||
createdAt: string
|
||||
createdBy: string
|
||||
}
|
||||
|
||||
export interface StorageFile {
|
||||
pathname: string
|
||||
path: string
|
||||
fileName: string
|
||||
fileSize: string
|
||||
fileType: string
|
||||
title: string
|
||||
description: string
|
||||
category: string[]
|
||||
keyword: string[]
|
||||
updatedAt: string
|
||||
updatedBy: string
|
||||
createdAt: string
|
||||
createdBy: string
|
||||
}
|
||||
|
||||
export interface Structure extends StorageFolder {
|
||||
folder: Structure[]
|
||||
file: StorageFile[]
|
||||
}
|
||||
|
||||
type Tree = Structure[]
|
||||
|
||||
function constructUrl(path: string | string[], append = true) {
|
||||
const arr = Array.isArray(path) ? path : path.split('/').filter(Boolean)
|
||||
const url =
|
||||
import.meta.env.VITE_API_ENDPOINT +
|
||||
arr.reduce<string>((a, v, i) => {
|
||||
switch (String(i)) {
|
||||
case '0':
|
||||
return `cabinet/${v}`
|
||||
case '1':
|
||||
return `${a}/drawer/${v}`
|
||||
case '2':
|
||||
return `${a}/folder/${v}`
|
||||
case '3':
|
||||
return `${a}/subfolder/${v}`
|
||||
default:
|
||||
return a
|
||||
}
|
||||
}, '')
|
||||
return append
|
||||
? url + ['cabinet', '/drawer', '/folder', '/subfolder'][arr.length]
|
||||
: url
|
||||
}
|
||||
|
||||
function consistantPath(path: string | string[]) {
|
||||
return Array.isArray(path)
|
||||
? path.join('/') + '/'
|
||||
: path.split('/').filter(Boolean).join('/') + '/'
|
||||
}
|
||||
|
||||
const useStorage = defineStore('storageStore', () => {
|
||||
const error = useErrorStore()
|
||||
const loader = useLoader()
|
||||
const init = ref<boolean>(false)
|
||||
const folder = ref<Record<Path, StorageFolder[]>>({})
|
||||
const file = ref<Record<Path, StorageFile[]>>({})
|
||||
const tree = computed(() => {
|
||||
let structure: Tree = []
|
||||
|
||||
// parse list of folder and list of file into tree
|
||||
Object.entries(folder.value).forEach(([key, value]) => {
|
||||
const arr = key.split('/').filter(Boolean)
|
||||
|
||||
// Once run then it is init
|
||||
if (!init.value) init.value = true
|
||||
|
||||
if (arr.length === 0) {
|
||||
structure = value.map((v) => ({
|
||||
pathname: v.pathname,
|
||||
name: v.name,
|
||||
createdAt: v.createdAt,
|
||||
createdBy: v.createdBy,
|
||||
folder: [],
|
||||
file: [],
|
||||
}))
|
||||
} else {
|
||||
let current: Structure | undefined
|
||||
|
||||
// traverse into tree
|
||||
arr.forEach((v, i) => {
|
||||
current =
|
||||
i === 0
|
||||
? structure.find((x) => x.name === v)
|
||||
: current?.folder.find((x) => x.name === v)
|
||||
})
|
||||
|
||||
// set data in tree (object is references to the same object)
|
||||
if (current) {
|
||||
current.folder = value.map((v) => ({
|
||||
pathname: v.pathname,
|
||||
name: v.name,
|
||||
createdAt: v.createdAt,
|
||||
createdBy: v.createdBy,
|
||||
folder: [],
|
||||
file: [],
|
||||
}))
|
||||
current.file = file.value[key] ?? []
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return structure
|
||||
})
|
||||
const currentInfo = reactive<{
|
||||
path: string
|
||||
dept: number
|
||||
}>({
|
||||
path: '',
|
||||
dept: 0,
|
||||
})
|
||||
|
||||
if (!init.value) goto(sessionStorage.getItem('path') || '')
|
||||
|
||||
async function getStorage(path: string = '') {
|
||||
const arr = path.split('/').filter(Boolean)
|
||||
|
||||
if (arr.length >= 4) return // this system does not have more than 4 level
|
||||
|
||||
const res = await api.get<(typeof folder.value)[string]>(constructUrl(arr))
|
||||
if (res.status === 200 && res.data && Array.isArray(res.data))
|
||||
folder.value[consistantPath(path)] = res.data.sort((a, b) =>
|
||||
a.pathname.localeCompare(b.pathname),
|
||||
)
|
||||
}
|
||||
|
||||
async function getStorageFile(path: string = '') {
|
||||
const arr = path.split('/').filter(Boolean)
|
||||
|
||||
if (arr.length < 3) return // file in this system only lives in level 3 and 4
|
||||
|
||||
const res = await api.get<(typeof file.value)[string]>(
|
||||
constructUrl(arr, false) + '/file',
|
||||
)
|
||||
if (res.status === 200 && res.data && Array.isArray(res.data))
|
||||
file.value[consistantPath(path)] = res.data.sort((a, b) =>
|
||||
a.pathname.localeCompare(b.pathname),
|
||||
)
|
||||
}
|
||||
|
||||
async function goto(path: string = '', force = false) {
|
||||
loader.show()
|
||||
const arr = path.split('/').filter(Boolean)
|
||||
|
||||
// get all parent to the root structure
|
||||
// this will also triggher init structure as it get root structure
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const current = consistantPath(arr.slice(0, i - arr.length))
|
||||
if (!folder.value[current] || force) await getStorage(current)
|
||||
}
|
||||
|
||||
path = consistantPath(path)
|
||||
|
||||
// only get this path once, after that will get from socket.io-client instead
|
||||
if (!folder.value[path] || force) await getStorage(path)
|
||||
if (!file.value[path] || force) await getStorageFile(path)
|
||||
|
||||
currentInfo.path = path
|
||||
currentInfo.dept = path.split('/').filter(Boolean).length
|
||||
sessionStorage.setItem('path', path)
|
||||
loader.hide()
|
||||
}
|
||||
|
||||
async function gotoParent() {
|
||||
const arr = currentInfo.path.split('/').filter(Boolean)
|
||||
await goto(consistantPath(arr.slice(0, -1)))
|
||||
}
|
||||
|
||||
// socket.io zone
|
||||
const socket = io('http://localhost:25565')
|
||||
|
||||
socket.on('connect', () => console.info('Socket.io connected.'))
|
||||
socket.on('disconnect', () => console.info('Socket.io disconnected.'))
|
||||
socket.on(
|
||||
'CreateFolder',
|
||||
(data: {
|
||||
pathname: string
|
||||
name: string
|
||||
createdAt: string
|
||||
createdBy: string
|
||||
}) => {
|
||||
const arr = data.pathname.split('/').filter(Boolean)
|
||||
const path = consistantPath(arr.slice(0, -1))
|
||||
|
||||
if (folder.value[path]) {
|
||||
const idx = folder.value[path].findIndex(
|
||||
(v) => v.pathname === data.pathname,
|
||||
)
|
||||
|
||||
if (idx === -1) {
|
||||
folder.value[path].push({
|
||||
pathname: data.pathname,
|
||||
name: data.name,
|
||||
createdAt: data.createdAt,
|
||||
createdBy: data.createdBy,
|
||||
})
|
||||
} else {
|
||||
error.title = 'ตั้งชื่อ Folder ซ้ำ'
|
||||
error.msg = ''
|
||||
error.show()
|
||||
}
|
||||
|
||||
folder.value[path].sort((a, b) => a.pathname.localeCompare(b.pathname))
|
||||
}
|
||||
},
|
||||
)
|
||||
// NOTE:
|
||||
// API planned to make new endpoint that can move and rename in one go.
|
||||
// Need to change if api handle move and rename file instead of just edit.
|
||||
socket.on('EditFolder', (data: { from: string; to: string }) => {
|
||||
const src = data.from.split('/').filter(Boolean)
|
||||
const dst = data.to.split('/').filter(Boolean)
|
||||
const path = consistantPath(src.slice(0, -1))
|
||||
|
||||
if (folder.value[path]) {
|
||||
const val = folder.value[path].find((v) => v.pathname === data.from)
|
||||
|
||||
if (val) {
|
||||
val.pathname = data.to
|
||||
val.name = dst[dst.length - 1]
|
||||
}
|
||||
}
|
||||
|
||||
const regex = new RegExp(`^${data.from}`)
|
||||
|
||||
for (let key in folder.value) {
|
||||
if (key.startsWith(data.from)) {
|
||||
folder.value[key.replace(regex, data.to)] = folder.value[key].map(
|
||||
(v) => {
|
||||
v.pathname = v.pathname.replace(regex, data.to)
|
||||
return v
|
||||
},
|
||||
)
|
||||
delete folder.value[key]
|
||||
}
|
||||
}
|
||||
for (let key in file.value) {
|
||||
if (key.startsWith(data.from)) {
|
||||
file.value[key.replace(regex, data.to)] = file.value[key].map((v) => {
|
||||
v.pathname = v.pathname.replace(regex, data.to)
|
||||
return v
|
||||
})
|
||||
delete file.value[key]
|
||||
}
|
||||
}
|
||||
})
|
||||
socket.on('DeleteFolder', (data: { pathname: string }) => {
|
||||
for (let key in folder.value) {
|
||||
if (key.startsWith(data.pathname)) {
|
||||
delete folder.value[key]
|
||||
}
|
||||
}
|
||||
for (let key in file.value) {
|
||||
if (key.startsWith(data.pathname)) {
|
||||
delete file.value[key]
|
||||
}
|
||||
}
|
||||
|
||||
const arr = data.pathname.split('/').filter(Boolean)
|
||||
const path = consistantPath(arr.slice(0, -1))
|
||||
|
||||
if (folder.value[path]) {
|
||||
folder.value[path] = folder.value[path].filter(
|
||||
(v) => v.pathname !== data.pathname,
|
||||
)
|
||||
}
|
||||
|
||||
if (currentInfo.path.includes(arr[arr.length - 1])) {
|
||||
error.title = 'ตำเเหน่งที่คุณอยู่ถูกลบ'
|
||||
error.msg = ''
|
||||
error.show()
|
||||
}
|
||||
})
|
||||
socket.on('FileUpload', (data: StorageFile) => {
|
||||
const arr = data.pathname.split('/').filter(Boolean)
|
||||
const path = consistantPath(arr.slice(0, -1))
|
||||
|
||||
if (file.value[path]) {
|
||||
const idx = file.value[path].findIndex(
|
||||
(v) => v.pathname === data.pathname,
|
||||
)
|
||||
if (idx !== -1) file.value[path][idx] = data
|
||||
else file.value[path].push(data)
|
||||
|
||||
file.value[path].sort((a, b) => a.pathname.localeCompare(b.pathname))
|
||||
}
|
||||
})
|
||||
socket.on('FileDelete', (data: { pathname: string }) => {
|
||||
const arr = data.pathname.split('/').filter(Boolean)
|
||||
const path = consistantPath(arr.slice(0, -1))
|
||||
|
||||
if (file.value[path]) {
|
||||
file.value[path] = file.value[path].filter(
|
||||
(v) => v.pathname !== data.pathname,
|
||||
)
|
||||
}
|
||||
})
|
||||
socket.on(
|
||||
'FileUpdateMove',
|
||||
(data: { from: StorageFile; to: StorageFile }) => {
|
||||
const arr = data.from.pathname.split('/').filter(Boolean)
|
||||
const path = consistantPath(arr.slice(0, -1))
|
||||
|
||||
if (file.value[path]) {
|
||||
const idx = file.value[path].findIndex(
|
||||
(v) => v.pathname === data.from.pathname,
|
||||
)
|
||||
if (idx !== -1) file.value[path][idx] = data.to
|
||||
}
|
||||
},
|
||||
)
|
||||
socket.on('FileUpdate', (data: StorageFile) => {
|
||||
const arr = data.pathname.split('/').filter(Boolean)
|
||||
const path = consistantPath(arr.slice(0, -1))
|
||||
|
||||
if (file.value[path]) {
|
||||
const idx = file.value[path].findIndex(
|
||||
(v) => v.pathname === data.pathname,
|
||||
)
|
||||
if (idx !== -1) file.value[path][idx] = data
|
||||
}
|
||||
})
|
||||
socket.on('FileUploadRequest', (data: StorageFile) => {
|
||||
const arr = data.pathname.split('/').filter(Boolean)
|
||||
const path = consistantPath(arr.slice(0, -1))
|
||||
|
||||
if (file.value[path]) {
|
||||
const idx = file.value[path].findIndex(
|
||||
(v) => v.pathname === data.pathname,
|
||||
)
|
||||
|
||||
if (idx !== -1) file.value[path][idx] = data
|
||||
else file.value[path].push(data)
|
||||
|
||||
file.value[path].sort((a, b) => a.pathname.localeCompare(b.pathname))
|
||||
}
|
||||
})
|
||||
|
||||
async function createFolder(name: string, path: string = currentInfo.path) {
|
||||
loader.show()
|
||||
await api.post(constructUrl(path, true), { name })
|
||||
loader.hide()
|
||||
}
|
||||
async function editFolder(name: string, path: string) {
|
||||
loader.show()
|
||||
await api.put(constructUrl(path, false), { name })
|
||||
loader.hide()
|
||||
}
|
||||
async function deleteFolder(path: string) {
|
||||
loader.show()
|
||||
await api.delete(constructUrl(path, false))
|
||||
loader.hide()
|
||||
}
|
||||
|
||||
type FileMetadata = {
|
||||
title?: string
|
||||
description?: string
|
||||
keyword?: string[]
|
||||
category?: string[]
|
||||
}
|
||||
async function createFile(
|
||||
file: File,
|
||||
data: FileMetadata,
|
||||
path: string = currentInfo.path,
|
||||
) {
|
||||
if (path.split('/').filter(Boolean).length < 3) return // the system only allow file to live in level 3 and 4
|
||||
|
||||
loader.show()
|
||||
const res = await api.post(constructUrl(path, false) + '/file', {
|
||||
file: file.name,
|
||||
...data,
|
||||
})
|
||||
if (res && res.status === 201 && res.data && res.data.upload) {
|
||||
await axios
|
||||
.put(res.data.upload, file, {
|
||||
headers: { 'Content-Type': file.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.catch((e) => console.error(e))
|
||||
}
|
||||
loader.hide()
|
||||
}
|
||||
async function updateFile(pathname: string, data: FileMetadata, file?: File) {
|
||||
const arr = pathname.split('/')
|
||||
|
||||
if (arr.length < 4) return // the system only allow file to live in level 3 and 4
|
||||
|
||||
loader.show()
|
||||
const res = await api.patch(
|
||||
constructUrl(arr.slice(0, -1), false) + `/file/${arr[arr.length - 1]}`,
|
||||
{ file: file?.name, ...data },
|
||||
)
|
||||
if (res && res.status === 201 && res.data && res.data.upload) {
|
||||
await axios
|
||||
.put(res.data.upload, file, {
|
||||
headers: { 'Content-Type': file?.type },
|
||||
onUploadProgress: (e) => console.log(e),
|
||||
})
|
||||
.catch((e) => console.error(e))
|
||||
}
|
||||
loader.hide()
|
||||
}
|
||||
async function deleteFile(pathname: string) {
|
||||
const arr = pathname.split('/')
|
||||
|
||||
if (arr.length < 4) return // the system only allow file to live in level 3 and 4
|
||||
|
||||
loader.show()
|
||||
await api.delete(
|
||||
constructUrl(arr.slice(0, -1), false) + `/file/${arr[arr.length - 1]}`,
|
||||
)
|
||||
loader.hide()
|
||||
}
|
||||
|
||||
return {
|
||||
// information
|
||||
currentInfo,
|
||||
folder,
|
||||
file,
|
||||
tree,
|
||||
// fetch
|
||||
getStorage,
|
||||
getStorageFile,
|
||||
// traverse
|
||||
goto,
|
||||
gotoParent,
|
||||
// operation
|
||||
createFolder,
|
||||
editFolder,
|
||||
deleteFolder,
|
||||
createFile,
|
||||
updateFile,
|
||||
deleteFile,
|
||||
}
|
||||
})
|
||||
|
||||
export default useStorage
|
||||
|
|
@ -1,409 +0,0 @@
|
|||
import { ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { useLoader } from '@/stores/loader'
|
||||
import axiosClient from '@/services/HttpService'
|
||||
|
||||
const apiEndpoint: string = import.meta.env.VITE_API_ENDPOINT
|
||||
|
||||
export interface EhrFolder {
|
||||
pathname: string
|
||||
name: string
|
||||
createdAt: string
|
||||
createdBy: string
|
||||
}
|
||||
|
||||
export interface EhrFile {
|
||||
pathname: string
|
||||
|
||||
fileName: string
|
||||
fileSize: string
|
||||
fileType: string
|
||||
|
||||
title: string
|
||||
description: string
|
||||
category: string[]
|
||||
keyword: string[]
|
||||
|
||||
updatedAt: string
|
||||
updatedBy: string
|
||||
createdAt: string
|
||||
createdBy: string
|
||||
}
|
||||
|
||||
export interface TreeDataFolder {
|
||||
pathname: string
|
||||
name: string
|
||||
status: boolean
|
||||
folder: TreeDataFolder[]
|
||||
file?: EhrFile[]
|
||||
}
|
||||
|
||||
export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||
const loader = useLoader()
|
||||
const data = ref<TreeDataFolder[]>([])
|
||||
const currentFolder = ref<TreeDataFolder[]>([])
|
||||
const currentFile = ref<EhrFile[]>([])
|
||||
const currentPath = ref<string>('')
|
||||
const currentDept = ref<number>(0)
|
||||
const listDataFolder = ref<TreeDataFolder[]>()
|
||||
const listDataFile = ref<EhrFile[]>()
|
||||
async function getCabinet() {
|
||||
const res = await axiosClient.get<EhrFolder[]>(`${apiEndpoint}cabinet`)
|
||||
|
||||
data.value = currentFolder.value = res.data.map((v) => ({
|
||||
...v,
|
||||
status: false,
|
||||
folder: [],
|
||||
}))
|
||||
|
||||
listDataFolder.value = data.value
|
||||
}
|
||||
|
||||
async function getFolder(pathname: string, updateStatus = true) {
|
||||
loader.show()
|
||||
|
||||
sessionStorage.setItem('currentPath', pathname)
|
||||
|
||||
const pathArray: string[] = pathname.split('/').filter(Boolean)
|
||||
|
||||
currentDept.value = pathArray.length
|
||||
if (pathArray.length >= 4) {
|
||||
currentFolder.value = []
|
||||
|
||||
await getFile(pathname)
|
||||
|
||||
let current: (typeof data.value)[number] | undefined
|
||||
current = data.value.find((v) => v.name === pathArray[0])
|
||||
|
||||
if (current && updateStatus) current.status = true
|
||||
current = current?.folder.find((v) => v.name === pathArray[1])
|
||||
if (current && updateStatus) current.status = true
|
||||
current = current?.folder.find((v) => v.name === pathArray[2])
|
||||
if (current && updateStatus) current.status = true
|
||||
current = current?.folder.find((v) => v.name === pathArray[3])
|
||||
if (current && updateStatus) current.status = true
|
||||
|
||||
currentPath.value = pathname
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
let requestPath = 'cabinet'
|
||||
if (pathArray.length >= 1) requestPath += `/${pathArray[0]}/drawer`
|
||||
if (pathArray.length >= 2) requestPath += `/${pathArray[1]}/folder`
|
||||
if (pathArray.length >= 3) requestPath += `/${pathArray[2]}/subfolder`
|
||||
|
||||
currentPath.value = pathname
|
||||
|
||||
const res = await axiosClient.get<EhrFolder[]>(
|
||||
`${apiEndpoint}${requestPath}`,
|
||||
)
|
||||
|
||||
const list = res.data.map((v) => ({
|
||||
...v,
|
||||
status: false,
|
||||
folder: [],
|
||||
}))
|
||||
|
||||
let current: (typeof data.value)[number] | undefined
|
||||
|
||||
if (pathArray.length >= 1) {
|
||||
current = data.value.find((v) => v.name === pathArray[0])
|
||||
if (current && updateStatus) {
|
||||
current.status = true
|
||||
}
|
||||
}
|
||||
|
||||
if (pathArray.length >= 2) {
|
||||
current = current?.folder.find((v) => v.name === pathArray[1])
|
||||
if (current && updateStatus) {
|
||||
current.status = true
|
||||
}
|
||||
}
|
||||
if (pathArray.length >= 3) {
|
||||
current = current?.folder.find((v) => v.name === pathArray[2])
|
||||
if (current && updateStatus) {
|
||||
current.status = true
|
||||
}
|
||||
}
|
||||
|
||||
if (current) current.folder = list
|
||||
|
||||
currentFolder.value = list
|
||||
|
||||
await getFile(pathname)
|
||||
|
||||
listDataFolder.value = currentFolder.value
|
||||
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
async function getFile(pathname: string) {
|
||||
loader.show()
|
||||
|
||||
const pathArray: string[] = pathname.split('/').filter(Boolean)
|
||||
|
||||
if (pathArray.length <= 2) {
|
||||
currentFile.value = []
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
let requestPath = `cabinet/${pathArray[0]}/drawer/${pathArray[1]}`
|
||||
if (pathArray.length >= 3) requestPath += `/folder/${pathArray[2]}`
|
||||
if (pathArray.length >= 4) requestPath += `/subfolder/${pathArray[3]}`
|
||||
requestPath += '/file'
|
||||
|
||||
const res = await axiosClient.get<EhrFile[]>(`${apiEndpoint}${requestPath}`)
|
||||
|
||||
currentFile.value = res.data
|
||||
|
||||
listDataFile.value = currentFile.value
|
||||
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
async function createFolder(name: string | undefined) {
|
||||
loader.show()
|
||||
|
||||
if (!name) return loader.hide()
|
||||
|
||||
const pathArray: string[] = currentPath.value.split('/').filter(Boolean)
|
||||
let requestPath = 'cabinet'
|
||||
if (pathArray.length >= 1) requestPath += `/${pathArray[0]}/drawer`
|
||||
if (pathArray.length >= 2) requestPath += `/${pathArray[1]}/folder`
|
||||
if (pathArray.length >= 3) requestPath += `/${pathArray[2]}/subfolder`
|
||||
|
||||
await axiosClient.post(`${apiEndpoint}${requestPath}`, {
|
||||
name,
|
||||
})
|
||||
|
||||
if (currentDept.value === 0) await getCabinet()
|
||||
else await getFolder(currentPath.value)
|
||||
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
async function editFolder(name: string | undefined, pathname: string) {
|
||||
loader.show()
|
||||
|
||||
if (!name) return loader.hide()
|
||||
|
||||
const pathArray: string[] = pathname.split('/').filter(Boolean)
|
||||
|
||||
let requestPath = 'cabinet'
|
||||
if (pathArray.length >= 1) requestPath += `/${pathArray[0]}`
|
||||
if (pathArray.length >= 2) requestPath += `/drawer/${pathArray[1]}`
|
||||
if (pathArray.length >= 3) requestPath += `/folder/${pathArray[2]}`
|
||||
if (pathArray.length >= 4) requestPath += `/subfolder/${pathArray[3]}`
|
||||
|
||||
await axiosClient.put(`${apiEndpoint}${requestPath}`, {
|
||||
name: name,
|
||||
})
|
||||
|
||||
if (currentDept.value === 0) await getCabinet()
|
||||
else await getFolder(currentPath.value)
|
||||
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
async function deleteFolder(pathname: string) {
|
||||
loader.show()
|
||||
|
||||
const pathArray: string[] = pathname.split('/').filter(Boolean)
|
||||
|
||||
let requestPath = 'cabinet'
|
||||
if (pathArray.length >= 1) requestPath += `/${pathArray[0]}`
|
||||
if (pathArray.length >= 2) requestPath += `/drawer/${pathArray[1]}`
|
||||
if (pathArray.length >= 3) requestPath += `/folder/${pathArray[2]}`
|
||||
if (pathArray.length >= 4) requestPath += `/subfolder/${pathArray[3]}`
|
||||
|
||||
await axiosClient.delete(`${apiEndpoint}${requestPath}`)
|
||||
|
||||
if (currentDept.value === 0) await getCabinet()
|
||||
else await getFolder(currentPath.value)
|
||||
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
async function gotoParent() {
|
||||
const pathname = currentPath.value.split('/').filter(Boolean)
|
||||
|
||||
pathname.pop()
|
||||
|
||||
if (pathname.length === 0) {
|
||||
const cabinet = currentFolder.value.find((v) => v.status === true)
|
||||
if (cabinet) {
|
||||
cabinet.status = false
|
||||
}
|
||||
}
|
||||
|
||||
await getFolder(pathname.join('/') + '/')
|
||||
}
|
||||
|
||||
async function uploadFile(
|
||||
pathname: string,
|
||||
file: File,
|
||||
metadata: {
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
) {
|
||||
loader.show()
|
||||
|
||||
const pathArray: string[] = pathname.split('/').filter(Boolean)
|
||||
|
||||
if (pathArray.length <= 2) return
|
||||
|
||||
let requestPath = 'cabinet'
|
||||
if (pathArray.length >= 1) requestPath += `/${pathArray[0]}`
|
||||
if (pathArray.length >= 2) requestPath += `/drawer/${pathArray[1]}`
|
||||
if (pathArray.length >= 3) requestPath += `/folder/${pathArray[2]}`
|
||||
if (pathArray.length >= 4) requestPath += `/subfolder/${pathArray[3]}`
|
||||
requestPath += '/file'
|
||||
|
||||
const res = await axiosClient.post<EhrFile & { upload: string }>(
|
||||
`${apiEndpoint}${requestPath}`,
|
||||
{
|
||||
file: file.name,
|
||||
...metadata,
|
||||
},
|
||||
)
|
||||
|
||||
if (res && res.data.upload) {
|
||||
await fetch(res.data.upload, {
|
||||
method: 'PUT',
|
||||
body: file,
|
||||
})
|
||||
|
||||
loader.hide()
|
||||
}
|
||||
|
||||
if (currentDept.value === 0) {
|
||||
await getCabinet()
|
||||
} else await getFolder(currentPath.value)
|
||||
|
||||
await getFile(currentPath.value)
|
||||
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
async function updateFile(
|
||||
pathname: string,
|
||||
metadata: {
|
||||
title: string
|
||||
description: string
|
||||
keyword: string[]
|
||||
category: string[]
|
||||
},
|
||||
file?: File,
|
||||
) {
|
||||
loader.show()
|
||||
|
||||
const pathArray: string[] = pathname.split('/').filter(Boolean)
|
||||
|
||||
if (pathArray.length < 4) return loader.hide()
|
||||
|
||||
let requestPath = `cabinet/${pathArray[0]}/drawer/${pathArray[1]}`
|
||||
if (pathArray.length >= 4) requestPath += `/folder/${pathArray[2]}`
|
||||
if (pathArray.length >= 5) requestPath += `/subfolder/${pathArray[3]}`
|
||||
requestPath += `/file/${pathArray.at(-1)}`
|
||||
|
||||
const res = await axiosClient.patch<{ upload: string }>(
|
||||
`${apiEndpoint}${requestPath}`,
|
||||
{ file: file?.name, ...metadata },
|
||||
)
|
||||
|
||||
if (res && res.data.upload) {
|
||||
await fetch(res.data.upload, {
|
||||
method: 'PUT',
|
||||
body: file,
|
||||
})
|
||||
|
||||
loader.hide()
|
||||
}
|
||||
|
||||
if (currentDept.value === 0) {
|
||||
await getCabinet()
|
||||
} else await getFolder(currentPath.value)
|
||||
|
||||
await getFile(currentPath.value)
|
||||
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
async function deleteFile(pathname: string) {
|
||||
loader.show()
|
||||
|
||||
const pathArray: string[] = pathname.split('/').filter(Boolean)
|
||||
|
||||
if (pathArray.length < 4) return loader.hide()
|
||||
|
||||
let requestPath = `cabinet/${pathArray[0]}/drawer/${pathArray[1]}`
|
||||
if (pathArray.length >= 4) requestPath += `/folder/${pathArray[2]}`
|
||||
if (pathArray.length >= 5) requestPath += `/subfolder/${pathArray[3]}`
|
||||
requestPath += `/file/${pathArray.at(-1)}`
|
||||
|
||||
await axiosClient.delete(`${apiEndpoint}${requestPath}`)
|
||||
|
||||
if (currentDept.value === 0) {
|
||||
await getCabinet()
|
||||
} else await getFolder(currentPath.value)
|
||||
|
||||
await getFile(currentPath.value)
|
||||
|
||||
currentFile.value = currentFile.value.filter((v) => v.pathname !== pathname)
|
||||
listDataFile.value = currentFile.value
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
function checkFile(fileName: string) {
|
||||
return currentFile.value.some((element) => element.fileName === fileName)
|
||||
}
|
||||
|
||||
function checkFileName(fileName: string) {
|
||||
return fileName.length >= 85
|
||||
}
|
||||
|
||||
async function refaceFile(pathname: string) {
|
||||
const pathArray: string[] = pathname.split('/').filter(Boolean)
|
||||
|
||||
if (pathArray.length <= 2) {
|
||||
currentFile.value = []
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
let requestPath = `cabinet/${pathArray[0]}/drawer/${pathArray[1]}`
|
||||
if (pathArray.length >= 3) requestPath += `/folder/${pathArray[2]}`
|
||||
if (pathArray.length >= 4) requestPath += `/subfolder/${pathArray[3]}`
|
||||
requestPath += '/file'
|
||||
|
||||
const res = await axiosClient.get<EhrFile[]>(`${apiEndpoint}${requestPath}`)
|
||||
|
||||
currentFile.value = res.data
|
||||
|
||||
listDataFile.value = currentFile.value
|
||||
}
|
||||
|
||||
return {
|
||||
data,
|
||||
currentFolder,
|
||||
currentFile,
|
||||
currentDept,
|
||||
currentPath,
|
||||
listDataFile,
|
||||
listDataFolder,
|
||||
getCabinet,
|
||||
getFolder,
|
||||
uploadFile,
|
||||
updateFile,
|
||||
deleteFile,
|
||||
gotoParent,
|
||||
createFolder,
|
||||
deleteFolder,
|
||||
editFolder,
|
||||
checkFile,
|
||||
checkFileName,
|
||||
refaceFile,
|
||||
}
|
||||
})
|
||||
|
|
@ -1,16 +1,17 @@
|
|||
<script setup lang="ts">
|
||||
import { useLoader } from '@/stores/loader'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
import { useLoader } from '@/stores/loader'
|
||||
import { useSearchDataStore } from '@/stores/searched-data'
|
||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||
import useStorage from '@/stores/storage'
|
||||
|
||||
import profile from '@/components/Profile.vue'
|
||||
import { useTreeDataStore } from '@/stores/tree-data'
|
||||
import { useSearchDataStore } from '@/stores/searched-data';
|
||||
import { useFileInfoStore } from '@/stores/file-info-data';
|
||||
const { currentPath } = storeToRefs(useTreeDataStore())
|
||||
|
||||
const { isFilePreview } = storeToRefs(useFileInfoStore())
|
||||
const { isSearch } = storeToRefs(useSearchDataStore())
|
||||
const { getFolder } = useTreeDataStore()
|
||||
const loaderStore = useLoader()
|
||||
const { loader } = storeToRefs(loaderStore)
|
||||
const { loader } = storeToRefs(useLoader())
|
||||
const { goto } = useStorage()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -22,20 +23,14 @@ const { loader } = storeToRefs(loaderStore)
|
|||
src="@/assets/logo-edm.png"
|
||||
spinner-color="white"
|
||||
style="height: 45px; max-width: 45px"
|
||||
@click="
|
||||
() => {
|
||||
currentPath = ''
|
||||
getFolder(currentPath)
|
||||
}
|
||||
"
|
||||
@click="() => goto()"
|
||||
/>
|
||||
<div
|
||||
class="column q-px-md pointer"
|
||||
id="app-toolbar-title"
|
||||
@click="
|
||||
() => {
|
||||
currentPath = ''
|
||||
getFolder(currentPath)
|
||||
goto()
|
||||
isSearch = false
|
||||
isFilePreview = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,25 @@
|
|||
PUBLIC_KEY=
|
||||
|
||||
MINIO_HOST=localhost
|
||||
MINIO_PORT=9000
|
||||
# Keycloak public key
|
||||
PUBLIC_KEY=keycloak.public.key
|
||||
REALM_URL=https://keycloak.local/realms/EDM
|
||||
PREFERRED_AUTH=online
|
||||
MANAGEMENT_ROLE=doc-management
|
||||
# App port
|
||||
PORT=25570
|
||||
# Real host name must be used.
|
||||
# Sdk will generate presigned url based on host name.
|
||||
MINIO_HOST=minio.local
|
||||
MINIO_PORT=443
|
||||
MINIO_SSL=true
|
||||
MINIO_ACCESS_KEY=
|
||||
MINIO_SECRET_KEY=
|
||||
|
||||
# Bucket notification event needed to be configured
|
||||
# Can use prepare script to create bucket
|
||||
MINIO_BUCKET=dev
|
||||
ELASTICSEARCH_PROTOCOL=http
|
||||
ELASTICSEARCH_HOST=localhost
|
||||
ELASTICSEARCH_PORT=9200
|
||||
ELASTICSEARCH_PORT=3001
|
||||
# Can use prepare script
|
||||
ELASTICSEARCH_INDEX=dev-index
|
||||
AMQ_URL=amqp://admin:1234@localhost:3002
|
||||
AMQ_QUEUE=queue-name
|
||||
|
||||
AMQ_URL=amqp://admin:1234@localhost:9999
|
||||
AMQ_QUEUE=queue
|
||||
|
||||
AUTH_BYPASS=false # MUST NOT TURN THIS ON IN PRODUCTION
|
||||
|
|
|
|||
|
|
@ -42,14 +42,8 @@ const io = new Server(server, {
|
|||
});
|
||||
|
||||
setInstance(io);
|
||||
|
||||
io.on("connection", (socket) => {
|
||||
console.log("User Connected");
|
||||
|
||||
socket.on("disconnected", () => {
|
||||
console.log("User Disconnected");
|
||||
});
|
||||
});
|
||||
io.on("connection", () => console.log("[Socket.IO] User connected."));
|
||||
io.on("disconnected", () => console.log("[Socket.IO] User disconnected."));
|
||||
|
||||
server.listen(PORT, "0.0.0.0", () =>
|
||||
console.log(`[APP] Application is running on http://localhost:${PORT}`),
|
||||
|
|
|
|||
|
|
@ -78,17 +78,23 @@ export class CabinetController extends Controller {
|
|||
name: string;
|
||||
},
|
||||
) {
|
||||
const meta = {
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
};
|
||||
|
||||
const created = await minioClient
|
||||
.putObject(DEFAULT_BUCKET!, `${replaceIllegalChars(body.name)}/.keep`, "", 0, {
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
})
|
||||
.putObject(DEFAULT_BUCKET!, `${replaceIllegalChars(body.name)}/.keep`, "", 0, meta)
|
||||
.catch((e) => console.error(e));
|
||||
|
||||
if (!created) throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์");
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("CreateFolder", { pathname: `${replaceIllegalChars(body.name)}/` });
|
||||
io?.emit("CreateFolder", {
|
||||
pathname: `${replaceIllegalChars(body.name)}/`,
|
||||
name: replaceIllegalChars(body.name),
|
||||
...meta,
|
||||
});
|
||||
|
||||
return this.setStatus(HttpStatusCode.CREATED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,17 +93,23 @@ export class DrawerController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบตำแหน่งที่ต้องการสร้างลิ้นชัก");
|
||||
}
|
||||
|
||||
const meta = {
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
};
|
||||
|
||||
const created = await minioClient
|
||||
.putObject(DEFAULT_BUCKET!, `${basePath}${replaceIllegalChars(body.name)}/.keep`, "", 0, {
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
})
|
||||
.putObject(DEFAULT_BUCKET!, `${basePath}${replaceIllegalChars(body.name)}/.keep`, "", 0, meta)
|
||||
.catch((e) => console.error(e));
|
||||
|
||||
if (!created) throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์");
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("CreateFolder", { pathname: `${basePath}${replaceIllegalChars(body.name)}/` });
|
||||
io?.emit("CreateFolder", {
|
||||
pathname: `${basePath}${replaceIllegalChars(body.name)}/`,
|
||||
name: replaceIllegalChars(body.name),
|
||||
...meta,
|
||||
});
|
||||
|
||||
return this.setStatus(HttpStatusCode.CREATED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import { StorageFile } from "../interfaces/storage-fs";
|
|||
import HttpError from "../interfaces/http-error";
|
||||
|
||||
import { copyCond, pathExist, replaceIllegalChars } from "../utils/minio";
|
||||
import { getInstance } from "../lib/websocket";
|
||||
|
||||
const DEFAULT_BUCKET = process.env.MINIO_BUCKET;
|
||||
const DEFAULT_INDEX = process.env.ELASTICSEARCH_INDEX;
|
||||
|
|
@ -200,6 +201,9 @@ export class FileController extends Controller {
|
|||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("FileUploadRequest", metadata);
|
||||
|
||||
return {
|
||||
...body,
|
||||
createdAt: metadata.createdAt,
|
||||
|
|
@ -288,6 +292,10 @@ export class FileController extends Controller {
|
|||
|
||||
if (search && search.hits.hits.length > 0 && search.hits.hits[0]._source) {
|
||||
const { _index: index, _id: id } = search.hits.hits[0];
|
||||
const meta = {
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
};
|
||||
await esClient
|
||||
.update({
|
||||
index,
|
||||
|
|
@ -297,12 +305,24 @@ export class FileController extends Controller {
|
|||
pathname: destination,
|
||||
path: basePath,
|
||||
fileName: replaceIllegalChars(file),
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
...meta,
|
||||
},
|
||||
refresh: "wait_for",
|
||||
})
|
||||
.then(() => minioClient.removeObject(DEFAULT_BUCKET!, pathname));
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("FileUpdateMove", {
|
||||
from: search.hits.hits[0]._source,
|
||||
to: {
|
||||
...search.hits.hits[0]._source,
|
||||
...metadata,
|
||||
pathname: destination,
|
||||
path: basePath,
|
||||
fileName: replaceIllegalChars(file),
|
||||
...meta,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
await minioClient.removeObject(DEFAULT_BUCKET!, pathname);
|
||||
}
|
||||
|
|
@ -317,16 +337,25 @@ export class FileController extends Controller {
|
|||
|
||||
if (search && search.hits.hits.length > 0 && search.hits.hits[0]._source) {
|
||||
const { _index: index, _id: id } = search.hits.hits[0];
|
||||
const meta = {
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
};
|
||||
await esClient.update({
|
||||
index,
|
||||
id,
|
||||
doc: {
|
||||
...metadata,
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
},
|
||||
doc: { ...metadata, ...meta },
|
||||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
const updated: StorageFile = {
|
||||
...search.hits.hits[0]._source,
|
||||
...metadata,
|
||||
...meta,
|
||||
};
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("FileUpdate", updated);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -360,6 +389,12 @@ export class FileController extends Controller {
|
|||
DEFAULT_BUCKET!,
|
||||
`${cabinetName}/${drawerName}/${folderName}/${fileName}`,
|
||||
);
|
||||
await esClient.deleteByQuery({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: {
|
||||
match: { pathname: `${cabinetName}/${drawerName}/${folderName}/${fileName}` },
|
||||
},
|
||||
});
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,17 +98,23 @@ export class FolderController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบตำแหน่งที่ต้องการสร้างลิ้นชัก");
|
||||
}
|
||||
|
||||
const meta = {
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
};
|
||||
|
||||
const created = await minioClient
|
||||
.putObject(DEFAULT_BUCKET!, `${basePath}${replaceIllegalChars(body.name)}/.keep`, "", 0, {
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
})
|
||||
.putObject(DEFAULT_BUCKET!, `${basePath}${replaceIllegalChars(body.name)}/.keep`, "", 0, meta)
|
||||
.catch((e) => console.error(e));
|
||||
|
||||
if (!created) throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์");
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("CreateFolder", { pathname: `${basePath}${replaceIllegalChars(body.name)}/` });
|
||||
io?.emit("CreateFolder", {
|
||||
pathname: `${basePath}${replaceIllegalChars(body.name)}/`,
|
||||
name: replaceIllegalChars(body.name),
|
||||
...meta,
|
||||
});
|
||||
|
||||
return this.setStatus(HttpStatusCode.CREATED);
|
||||
}
|
||||
|
|
@ -185,7 +191,7 @@ export class FolderController extends Controller {
|
|||
|
||||
const io = getInstance();
|
||||
io?.emit("EditFolder", {
|
||||
from: `${cabinetName}/${drawerName}/${folderName}`,
|
||||
from: `${cabinetName}/${drawerName}/${folderName}/`,
|
||||
to: `${cabinetName}/${drawerName}/${replaceIllegalChars(body.name)}/`,
|
||||
});
|
||||
|
||||
|
|
|
|||
614
Services/server/src/controllers/storageController.ts
Normal file
614
Services/server/src/controllers/storageController.ts
Normal file
|
|
@ -0,0 +1,614 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Example,
|
||||
Post,
|
||||
Put,
|
||||
Request,
|
||||
Route,
|
||||
Security,
|
||||
SuccessResponse,
|
||||
Tags,
|
||||
} from "tsoa";
|
||||
|
||||
import minioClient from "../minio";
|
||||
import esClient from "../elasticsearch";
|
||||
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import { StorageFile, StorageFolder } from "../interfaces/storage-fs";
|
||||
|
||||
import { copyCond } from "../utils/minio";
|
||||
|
||||
import * as io from "../lib/websocket";
|
||||
|
||||
if (!process.env.MINIO_BUCKET) throw Error("Default MinIO bucket must be specified.");
|
||||
if (!process.env.ELASTICSEARCH_INDEX) throw Error("Default ElasticSearch index must be specified.");
|
||||
|
||||
const DEFAULT_BUCKET = process.env.MINIO_BUCKET;
|
||||
const DEFAULT_INDEX = process.env.ELASTICSEARCH_INDEX;
|
||||
const MINIO_ERROR_MESSAGE = "เกิดข้อผิดพลาดกับระบบจัดการไฟล์";
|
||||
const PATH_NOT_FOUND_MESSAGE = "ไม่พบตำแหน่งที่ต้องการนำข้อมูลเข้า";
|
||||
const PATH_ALREADY_EXIST = "ตำแหน่งดังกล่าวมีในระบบแล้ว";
|
||||
|
||||
interface ListRequestBody {
|
||||
operation: "folder" | "file";
|
||||
path: string[];
|
||||
}
|
||||
|
||||
interface FolderBody {
|
||||
/** @example ["แฟ้ม 1", "แฟ้ม 2"] */
|
||||
path: string[];
|
||||
/** @example "แฟ้ม 3" */
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface PutFolderBody {
|
||||
from: {
|
||||
/** @example ["แฟ้ม 1", "แฟ้ม 2"] */
|
||||
path: string[];
|
||||
/** @example "แฟ้ม 3" */
|
||||
name: string;
|
||||
};
|
||||
to: {
|
||||
/** @example ["แฟ้ม 1", "แฟ้ม 2"] */
|
||||
path: string[];
|
||||
/** @example "แฟ้ม 3 แก้ไข" */
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface DeleteFolderBody {
|
||||
/** @example ["แฟ้ม 1", "แฟ้ม 2", "แฟ้ม 3 แก้ไข"] */
|
||||
path: string[];
|
||||
}
|
||||
|
||||
interface FileBody {
|
||||
/** @example ["แฟ้ม 1", "แฟ้ม 2", "แฟ้ม 3"] */
|
||||
path: string[];
|
||||
/** @example "ไฟล์ 1.xlsx" */
|
||||
file: string;
|
||||
/** @example "การเงิน" */
|
||||
title?: string;
|
||||
/** @example "การเงิน" */
|
||||
description?: string;
|
||||
/** @example ["การเงิน", "รายงาน"] */
|
||||
category?: string[];
|
||||
/** @example ["การเงิน", "รายรับ", "รายจ่าย"] */
|
||||
keyword?: string[];
|
||||
}
|
||||
|
||||
interface PutFileBody extends Omit<FileBody, "file" | "path"> {
|
||||
/** หากต้องการอัพโหลดไฟล์ด้วยให้ส่งค่าเป็นจริง */
|
||||
from: {
|
||||
/** @example ["แฟ้ม 1", "แฟ้ม 2", "แฟ้ม 3"] */
|
||||
path: string[];
|
||||
/** @example "ไฟล์ 1.xlsx" */
|
||||
file: string;
|
||||
};
|
||||
to?: {
|
||||
/** @example ["แฟ้ม 1", "แฟ้ม 2", "แฟ้ม 3"] */
|
||||
path: string[];
|
||||
/** @example "ไฟล์ 1 แก้ไข.xlsx" */
|
||||
file: string;
|
||||
};
|
||||
/** @example false */
|
||||
upload?: boolean;
|
||||
}
|
||||
|
||||
interface DeleteFileBody {
|
||||
/** @example ["แฟ้ม 1", "แฟ้ม 2", "แฟ้ม 3"] */
|
||||
path: string[];
|
||||
/** @example "ไฟล์ 1 แก้ไข.xlsx" */
|
||||
file: string;
|
||||
}
|
||||
|
||||
async function listFolder(path: string[]) {
|
||||
const list = await new Promise<{ pathname: string; name: string }[]>((resolve, reject) => {
|
||||
const item: { pathname: string; name: string }[] = [];
|
||||
|
||||
const stream = minioClient.listObjectsV2(DEFAULT_BUCKET, path.join("/") + "/");
|
||||
stream.on("data", (v) => {
|
||||
if (v && v.prefix)
|
||||
item.push({
|
||||
pathname: v.prefix,
|
||||
name: v.prefix.split("/").filter(Boolean).at(-1)!,
|
||||
});
|
||||
});
|
||||
stream.on("end", () => resolve(item));
|
||||
stream.on("error", () => reject(new Error(MINIO_ERROR_MESSAGE)));
|
||||
});
|
||||
|
||||
const folder = await Promise.all(
|
||||
list.map(async (v) => {
|
||||
// Get stat from hidden object that used to mark as folder as minio doesn't really have folder
|
||||
const stat = await minioClient
|
||||
.statObject(DEFAULT_BUCKET, `${v.pathname}.keep`)
|
||||
.catch((e) => console.error(`MinIO Error: ${e}`));
|
||||
|
||||
if (!stat) return undefined;
|
||||
|
||||
const { createdat, createdby } = stat.metaData;
|
||||
|
||||
return {
|
||||
...v,
|
||||
createdAt: createdat ?? "n/a",
|
||||
createdBy: createdby ?? "n/a",
|
||||
} satisfies StorageFolder;
|
||||
}),
|
||||
);
|
||||
|
||||
return folder.filter((v: StorageFolder | undefined): v is StorageFolder => !!v);
|
||||
}
|
||||
|
||||
async function listFile(path: string[]) {
|
||||
const result = await esClient
|
||||
.search<StorageFile & { attachment: Record<string, string> }>({
|
||||
index: DEFAULT_INDEX,
|
||||
sort: [{ pathname: "asc" }],
|
||||
query: { match: { path: path.join("/") + "/" } },
|
||||
size: 10000,
|
||||
})
|
||||
.then((r) => r.hits.hits);
|
||||
|
||||
const records = result
|
||||
.map((v) => {
|
||||
if (v._source) {
|
||||
const { attachment, ...rest } = v._source;
|
||||
return rest satisfies StorageFile;
|
||||
}
|
||||
})
|
||||
.filter((v: StorageFile | undefined): v is StorageFile => !!v);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
async function checkPathExist(bucket: string, path: string) {
|
||||
return await checkFileExist(bucket, `${path}/.keep`);
|
||||
}
|
||||
|
||||
async function checkFileExist(bucket: string, pathname: string) {
|
||||
return Boolean(
|
||||
await minioClient.statObject(bucket, pathname).catch((e) => {
|
||||
if (e.code === "NotFound") return false;
|
||||
console.error(`Storage Error: ${e}`);
|
||||
throw new Error(MINIO_ERROR_MESSAGE);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@Route("storage")
|
||||
export class StorageController extends Controller {
|
||||
@Post("list")
|
||||
@Example([
|
||||
{
|
||||
path: "ตู้เอกสาร 1/ลิ้นชัก 1/แฟ้ม 1",
|
||||
name: "แฟ้ม 1",
|
||||
createdAt: "2021-07-20T12:33:13.018Z",
|
||||
createdBy: "admin",
|
||||
},
|
||||
{
|
||||
path: "ตู้เอกสาร 1/ลิ้นชัก 1/แฟ้ม 2",
|
||||
name: "แฟ้ม 2",
|
||||
createdAt: "2022-01-23T16:05:02.114Z",
|
||||
createdBy: "admin",
|
||||
},
|
||||
])
|
||||
@Example([
|
||||
{
|
||||
pathname: "ตู้เอกสาร 1/ลิ้นชัก 1/แฟ้ม 1/เอกสาร 1.pdf",
|
||||
path: "ตู้เอกสาร 1/ลิ้นชัก 1/แฟ้ม 1/",
|
||||
title: "เอกสาร",
|
||||
description: "เอกสารการเงิน",
|
||||
category: ["บัญชี"],
|
||||
keyword: ["เงิน", "บัญชี", "รายจ่าย", "รายรับ"],
|
||||
upload: false,
|
||||
fileName: "เอกสาร 1.pdf",
|
||||
fileSize: 10240,
|
||||
fileType: "application/pdf",
|
||||
createdAt: "2021-07-20T12:33:13.018Z",
|
||||
createdBy: "admin",
|
||||
updatedAt: "2021-07-20T12:33:13.018Z",
|
||||
updatedBy: "admin",
|
||||
},
|
||||
])
|
||||
@Tags("Storage Folder", "Storage File")
|
||||
@Security("bearerAuth")
|
||||
public async getList(@Body() body: ListRequestBody) {
|
||||
const path = body.path.filter(Boolean);
|
||||
|
||||
if (body.operation === "folder") return await listFolder(path);
|
||||
if (body.operation === "file") return await listFile(path);
|
||||
}
|
||||
|
||||
@Post("folder")
|
||||
@Tags("Storage Folder")
|
||||
@Security("bearerAuth", ["management-role", "admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
public async postFolder(
|
||||
@Request() request: { user: { preferred_username: string } },
|
||||
@Body() body: FolderBody,
|
||||
) {
|
||||
const { path, name } = body;
|
||||
|
||||
if (!(await checkPathExist(DEFAULT_BUCKET, path.join("/")))) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, PATH_NOT_FOUND_MESSAGE);
|
||||
}
|
||||
|
||||
const meta = {
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
};
|
||||
|
||||
const created = await minioClient
|
||||
.putObject(
|
||||
DEFAULT_BUCKET,
|
||||
`${path.join("/")}/${name.replace(/[/\\?%*:|"<>#]/g, "-").trim()}/.keep`,
|
||||
"",
|
||||
0,
|
||||
meta,
|
||||
)
|
||||
.catch((e) => console.error(`MinIO Error: ${e}`));
|
||||
|
||||
if (!created) throw new Error(MINIO_ERROR_MESSAGE);
|
||||
|
||||
io.getInstance()?.emit("FolderCreate", {
|
||||
pathname: `${path.join("/")}/${name.replace(/[/\\?%*:|"<>#]/g, "-").trim()}/`,
|
||||
name: name.replace(/[/\\?%*:|"<>#]/g, "-").trim(),
|
||||
...meta,
|
||||
});
|
||||
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* ยา้ย Folder ภายใต้ Folder (Path) หนึ่ง ไปภายใน Folder (Path) หนึ่งและสามารถเปลี่ยนชื่อได้
|
||||
*/
|
||||
@Put("folder")
|
||||
@Tags("Storage Folder")
|
||||
@Security("bearerAuth", ["management-role", "admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
public async moveFolder(@Body() body: PutFolderBody) {
|
||||
const src = `${body.from.path.join("/")}/${body.from.name}`;
|
||||
const dst = `${body.to.path.join("/")}/${body.to.name}`;
|
||||
|
||||
if (!(await checkPathExist(DEFAULT_BUCKET, src))) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, PATH_NOT_FOUND_MESSAGE);
|
||||
}
|
||||
if (await checkPathExist(DEFAULT_BUCKET, dst)) {
|
||||
throw new HttpError(HttpStatusCode.CONFLICT, PATH_ALREADY_EXIST);
|
||||
}
|
||||
if (!(await checkPathExist(DEFAULT_BUCKET, body.to.path.join("/")))) {
|
||||
throw new HttpError(HttpStatusCode.PRECONDITION_FAILED, "ไม่พบตำแหน่งที่ต้องการย้าย");
|
||||
}
|
||||
|
||||
const list = await new Promise<{ pathname: string }[]>((resolve, reject) => {
|
||||
const stream = minioClient.listObjectsV2(DEFAULT_BUCKET, `${src}/`, true);
|
||||
const item: { pathname: string }[] = [];
|
||||
|
||||
stream.on("data", (v) => {
|
||||
if (v && v.name) item.push({ pathname: v.name });
|
||||
});
|
||||
stream.on("end", () => resolve(item));
|
||||
stream.on("error", () => reject(new Error(MINIO_ERROR_MESSAGE)));
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
list.map(async (v) => {
|
||||
const from = `/${DEFAULT_BUCKET}/${v.pathname}`;
|
||||
const to = `${dst}/${v.pathname.slice(`${src}/`.length)}`;
|
||||
|
||||
const result = await minioClient
|
||||
.copyObject(DEFAULT_BUCKET, to, from, copyCond)
|
||||
.catch((e) => {
|
||||
console.error(`MinIO Error: ${e}`);
|
||||
throw new Error("เกิดข้อผิดพลาด ไม่สามารถย้ายไฟล์ได้");
|
||||
});
|
||||
|
||||
if (result) {
|
||||
if (v.pathname.includes(".keep")) {
|
||||
return await minioClient
|
||||
.removeObject(DEFAULT_BUCKET, v.pathname)
|
||||
.catch((e) => console.error(`MinIO Error: ${e}`));
|
||||
}
|
||||
|
||||
const search = await esClient.search<
|
||||
StorageFile & { attachment: Record<string, string> }
|
||||
>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: { match: { pathname: v.pathname } },
|
||||
});
|
||||
|
||||
if (search && search.hits.hits.length === 0) {
|
||||
await minioClient
|
||||
.removeObject(DEFAULT_BUCKET, v.pathname)
|
||||
.catch((e) => console.error(`MinIO Error: ${e}`));
|
||||
return console.log(
|
||||
`Trying to update file in storage but not exist in database: ${from} > ${to}`,
|
||||
);
|
||||
}
|
||||
|
||||
const data = search.hits.hits[0];
|
||||
|
||||
await esClient
|
||||
.update({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: data._id,
|
||||
doc: {
|
||||
pathname: to,
|
||||
path: to.split("/").slice(0, -1).join("/") + "/",
|
||||
},
|
||||
refresh: "wait_for",
|
||||
})
|
||||
.catch((e) => console.error(`ElasticSearch Error: ${e}`));
|
||||
|
||||
await minioClient
|
||||
.removeObject(DEFAULT_BUCKET, v.pathname)
|
||||
.catch((e) => console.error(`MinIO Error: ${e}`));
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
io.getInstance()?.emit("FolderMove", {
|
||||
from: `${src}/`,
|
||||
to: `${dst}/`,
|
||||
});
|
||||
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* ลบ Folder หรือ File ออกจากระบบ
|
||||
*/
|
||||
@Delete("folder")
|
||||
@Tags("Storage Folder")
|
||||
@Security("bearerAuth", ["management-role", "admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
public async deleteStorage(@Body() body: DeleteFolderBody) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const objects: string[] = [];
|
||||
const stream = minioClient.listObjectsV2(DEFAULT_BUCKET, body.path.join("/") + "/", true);
|
||||
|
||||
stream.on("data", (v) => v && v.name && objects.push(v.name));
|
||||
stream.on("close", async () => {
|
||||
resolve(await minioClient.removeObjects(DEFAULT_BUCKET, objects));
|
||||
});
|
||||
stream.on("error", () => reject(new Error(MINIO_ERROR_MESSAGE)));
|
||||
});
|
||||
|
||||
io.getInstance()?.emit("FolderDelete", { pathname: body.path.join("/") + "/" });
|
||||
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* ร้องขอการอัพโหลดไฟล์ โดยเมื่อร้องขอจะได้ URL สำหรับอัพโหลดไฟล์มาพร้อมข้อมูลของไฟล์ที่จะทำการอัพโหลด
|
||||
*/
|
||||
@Post("file")
|
||||
@Tags("Storage File")
|
||||
@Security("bearerAuth", ["management-role", "admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
public async postFile(
|
||||
@Request() request: { user: { preferred_username: string } },
|
||||
@Body() body: FileBody,
|
||||
) {
|
||||
const { path, file } = body;
|
||||
|
||||
if (!(await checkPathExist(DEFAULT_BUCKET, path.join("/")))) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, PATH_NOT_FOUND_MESSAGE);
|
||||
}
|
||||
|
||||
const result = await esClient
|
||||
.search<StorageFile & { attachment?: Record<string, unknown> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: { match: { pathname: path.join("/") + "/" } },
|
||||
})
|
||||
.catch((e) => console.error(`MinIO Error: ${e}`));
|
||||
|
||||
const metadata: StorageFile = {
|
||||
path: path.join("/") + "/",
|
||||
pathname: path.join("/") + "/" + file.replace(/[/\\?%*:|"<>#]/g, "-").trim(),
|
||||
fileName: file.replace(/[/\\?%*:|"<>#]/g, "-").trim(),
|
||||
fileSize: 0, // Will be get by minio object storage after file is uploaded
|
||||
fileType: "", // Will be determined by minio object storage after file is uploaded
|
||||
title: body.title ?? file.replace(/[/\\?%*:|"<>#]/g, "-").trim(), // default to same as filename
|
||||
description: body.description ?? "",
|
||||
category: body.category ?? [],
|
||||
keyword: body.keyword ?? [],
|
||||
upload: false, // flag
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username,
|
||||
};
|
||||
|
||||
// Pathname is unique and should not have multiple record with same path
|
||||
if (result && result.hits.hits.length > 0 && result.hits.hits[0]._source) {
|
||||
await esClient
|
||||
.delete({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: result.hits.hits[0]._id,
|
||||
})
|
||||
.catch((e) => console.error(`MinIO Error: ${e}`));
|
||||
|
||||
const rec = result.hits.hits[0]._source;
|
||||
|
||||
// File exist get created at and created by field but all other will be replaced
|
||||
// by provided infomation or blank if not provided
|
||||
metadata.createdAt = rec.createdAt;
|
||||
metadata.createdBy = rec.createdBy;
|
||||
}
|
||||
|
||||
await esClient.index({
|
||||
index: DEFAULT_INDEX!,
|
||||
document: metadata,
|
||||
refresh: "wait_for", // Must have or else it doesn't wait for updated index resulted in data not found on fetch
|
||||
});
|
||||
|
||||
io.getInstance()?.emit("FileUploadRequest", metadata);
|
||||
|
||||
const presignedUrl = await minioClient.presignedPutObject(DEFAULT_BUCKET, metadata.pathname);
|
||||
|
||||
return { ...metadata, uploadUrl: presignedUrl };
|
||||
}
|
||||
|
||||
@Put("file")
|
||||
@Tags("Storage File")
|
||||
@Security("bearerAuth", ["management-role", "admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
public async moveFile(
|
||||
@Request() request: { user: { preferred_username: string } },
|
||||
@Body() body: PutFileBody,
|
||||
) {
|
||||
const search = await esClient
|
||||
.search<StorageFile & { attachment: Record<string, any> }>({
|
||||
index: DEFAULT_INDEX,
|
||||
query: {
|
||||
match: { pathname: body.from.path.join("/") + `/${body.from.file}` },
|
||||
},
|
||||
})
|
||||
.catch((e) => console.error(`ElasticSearch Error: ${e}`));
|
||||
|
||||
if (!search) {
|
||||
throw new Error("เกิดข้อผิดพลาดกับระบบฐานข้อมูล กรุณาลองใหม่ในภายหลัง");
|
||||
}
|
||||
if (search && search.hits.hits.length === 0) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบไฟล์ดังกล่าว");
|
||||
}
|
||||
if (!(await checkFileExist(DEFAULT_BUCKET, body.from.path.join("/") + `/${body.from.file}`))) {
|
||||
await esClient.delete({
|
||||
index: DEFAULT_INDEX,
|
||||
id: search.hits.hits[0]._id,
|
||||
});
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบไฟล์ดังกล่าว");
|
||||
}
|
||||
if (body.to && !(await checkPathExist(DEFAULT_BUCKET, body.to.path.join("/")))) {
|
||||
throw new HttpError(HttpStatusCode.PRECONDITION_FAILED, "ไม่พบตำแหน่งที่ต้องการย้าย");
|
||||
}
|
||||
if (
|
||||
body.to &&
|
||||
(await checkFileExist(DEFAULT_BUCKET, body.to.path.join("/") + `/${body.to.file}`))
|
||||
) {
|
||||
throw new HttpError(
|
||||
HttpStatusCode.PRECONDITION_FAILED,
|
||||
"พบไฟล์ในต้ำแหน่งปลายทาง ไม่สามารถย้ายได้",
|
||||
);
|
||||
}
|
||||
if (!search.hits.hits[0]._source) {
|
||||
// This should not possible.
|
||||
// Just in case the result found with no associated data.
|
||||
await esClient.delete({
|
||||
index: DEFAULT_INDEX,
|
||||
id: search.hits.hits[0]._id,
|
||||
});
|
||||
throw new Error("ไม่พบข้อมูลในฐานข้อมูล");
|
||||
}
|
||||
|
||||
const id = search.hits.hits[0]._id;
|
||||
const { attachment: _, ...source } = search.hits.hits[0]._source;
|
||||
|
||||
const { to, from, upload, ...metadata } = body;
|
||||
|
||||
const dateMeta = {
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username,
|
||||
};
|
||||
|
||||
if (from && to) {
|
||||
const src = [DEFAULT_BUCKET, ...from.path, ""].join("/") + from.file;
|
||||
const dst = to.path.join("/") + `/${to.file}`;
|
||||
|
||||
const result = await minioClient.copyObject(DEFAULT_BUCKET, dst, src, copyCond).catch((e) => {
|
||||
console.error(`MinIO Error: ${e}`);
|
||||
throw new Error("เกิดข้อผิดพลาด ไม่สามารถย้ายไฟล์ได้");
|
||||
});
|
||||
|
||||
if (result) {
|
||||
await esClient
|
||||
.update({
|
||||
index: DEFAULT_INDEX,
|
||||
id: id,
|
||||
doc: {
|
||||
...metadata,
|
||||
path: to.path.join("/") + "/",
|
||||
pathname: dst,
|
||||
...dateMeta,
|
||||
},
|
||||
refresh: "wait_for",
|
||||
})
|
||||
.then(async () => await minioClient.removeObject(DEFAULT_INDEX, src))
|
||||
.catch((e) => console.error(`ElasticSearch Error: ${e}`));
|
||||
|
||||
io.getInstance()?.emit("FileMove", {
|
||||
from: source,
|
||||
to: {
|
||||
...source,
|
||||
...metadata,
|
||||
path: to.path.join("/") + "/",
|
||||
pathname: dst,
|
||||
...dateMeta,
|
||||
},
|
||||
});
|
||||
|
||||
if (upload) {
|
||||
const presignedUrl = await minioClient.presignedPutObject(DEFAULT_BUCKET, dst);
|
||||
return { uploadUrl: presignedUrl };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (from) {
|
||||
await esClient
|
||||
.update({
|
||||
index: DEFAULT_INDEX,
|
||||
id: id,
|
||||
doc: {
|
||||
...metadata,
|
||||
...dateMeta,
|
||||
},
|
||||
refresh: "wait_for",
|
||||
})
|
||||
.catch((e) => console.error(`ElasticSearch Error: ${e}`));
|
||||
|
||||
io.getInstance()?.emit("FileMove", {
|
||||
from: source,
|
||||
to: {
|
||||
...source,
|
||||
...metadata,
|
||||
...dateMeta,
|
||||
},
|
||||
});
|
||||
|
||||
if (upload) {
|
||||
const src = from.path.join("/") + `/${from.file}`;
|
||||
const presignedUrl = await minioClient.presignedPutObject(DEFAULT_BUCKET, src);
|
||||
return { uploadUrl: presignedUrl };
|
||||
}
|
||||
}
|
||||
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Delete("file")
|
||||
@Tags("Storage File")
|
||||
@Security("bearerAuth", ["management-role", "admin"])
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT, "สำเร็จ")
|
||||
public async deleteFile(@Body() body: DeleteFileBody) {
|
||||
const pathname = body.path.join("/") + body.file;
|
||||
|
||||
await minioClient
|
||||
.removeObject(DEFAULT_BUCKET, pathname)
|
||||
.catch((e) => console.error(`MinIO Error: ${e}`));
|
||||
await esClient
|
||||
.deleteByQuery({
|
||||
index: DEFAULT_INDEX,
|
||||
query: { match: { pathname } },
|
||||
})
|
||||
.catch((e) => console.error(`ElasticSearch Error: ${e}`));
|
||||
|
||||
io.getInstance()?.emit("FileDelete", { pathname });
|
||||
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
|
@ -96,18 +96,23 @@ export class SubFolderController extends Controller {
|
|||
if (!(await pathExist(DEFAULT_BUCKET!, basePath))) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบตำแหน่งที่ต้องการสร้างลิ้นชัก");
|
||||
}
|
||||
const meta = {
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
};
|
||||
|
||||
const created = await minioClient
|
||||
.putObject(DEFAULT_BUCKET!, `${basePath}${replaceIllegalChars(body.name)}/.keep`, "", 0, {
|
||||
createdAt: new Date().toISOString(),
|
||||
createdBy: request.user.preferred_username,
|
||||
})
|
||||
.putObject(DEFAULT_BUCKET!, `${basePath}${replaceIllegalChars(body.name)}/.keep`, "", 0, meta)
|
||||
.catch((e) => console.error(e));
|
||||
|
||||
if (!created) throw new Error("เกิดข้อผิดพลาดกับระบบจัดการไฟล์");
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("CreateFolder", { pathname: `${basePath}${replaceIllegalChars(body.name)}/` });
|
||||
io?.emit("CreateFolder", {
|
||||
pathname: `${basePath}${replaceIllegalChars(body.name)}/`,
|
||||
name: replaceIllegalChars(body.name),
|
||||
...meta,
|
||||
});
|
||||
|
||||
return this.setStatus(HttpStatusCode.CREATED);
|
||||
}
|
||||
|
|
@ -230,7 +235,7 @@ export class SubFolderController extends Controller {
|
|||
|
||||
const io = getInstance();
|
||||
io?.emit("DeleteFolder", {
|
||||
pathname: `${cabinetName}/${drawerName}/${folderName}/${subFolderName}`,
|
||||
pathname: `${cabinetName}/${drawerName}/${folderName}/${subFolderName}/`,
|
||||
});
|
||||
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import { StorageFile } from "../interfaces/storage-fs";
|
|||
import HttpError from "../interfaces/http-error";
|
||||
|
||||
import { copyCond, pathExist, replaceIllegalChars } from "../utils/minio";
|
||||
import { getInstance } from "../lib/websocket";
|
||||
|
||||
const DEFAULT_BUCKET = process.env.MINIO_BUCKET;
|
||||
const DEFAULT_INDEX = process.env.ELASTICSEARCH_INDEX;
|
||||
|
|
@ -206,6 +207,9 @@ export class SubFolderFileController extends Controller {
|
|||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("FileUploadRequest", metadata);
|
||||
|
||||
return {
|
||||
...body,
|
||||
createdAt: metadata.createdAt,
|
||||
|
|
@ -292,7 +296,10 @@ export class SubFolderFileController extends Controller {
|
|||
query: { match: { pathname } },
|
||||
})
|
||||
.catch((e) => console.error(e));
|
||||
|
||||
const meta = {
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
};
|
||||
if (search && search.hits.hits.length > 0 && search.hits.hits[0]._source) {
|
||||
const { _index: index, _id: id } = search.hits.hits[0];
|
||||
await esClient
|
||||
|
|
@ -304,12 +311,24 @@ export class SubFolderFileController extends Controller {
|
|||
pathname: destination,
|
||||
path: basePath,
|
||||
fileName: replaceIllegalChars(file),
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
...meta,
|
||||
},
|
||||
refresh: "wait_for",
|
||||
})
|
||||
.then(() => minioClient.removeObject(DEFAULT_BUCKET!, pathname));
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("FileUpdateMove", {
|
||||
from: search.hits.hits[0]._source,
|
||||
to: {
|
||||
...search.hits.hits[0]._source,
|
||||
...metadata,
|
||||
pathname: destination,
|
||||
path: basePath,
|
||||
fileName: replaceIllegalChars(file),
|
||||
...meta,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
await minioClient.removeObject(DEFAULT_BUCKET!, pathname);
|
||||
}
|
||||
|
|
@ -324,6 +343,10 @@ export class SubFolderFileController extends Controller {
|
|||
|
||||
if (search && search.hits.hits.length > 0 && search.hits.hits[0]._source) {
|
||||
const { _index: index, _id: id } = search.hits.hits[0];
|
||||
const meta = {
|
||||
updatedAt: new Date().toISOString(),
|
||||
updatedBy: request.user.preferred_username ?? "n/a",
|
||||
};
|
||||
await esClient.update({
|
||||
index,
|
||||
id,
|
||||
|
|
@ -334,6 +357,14 @@ export class SubFolderFileController extends Controller {
|
|||
},
|
||||
refresh: "wait_for",
|
||||
});
|
||||
const updated: StorageFile = {
|
||||
...search.hits.hits[0]._source,
|
||||
...metadata,
|
||||
...meta,
|
||||
};
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("FileUpdate", updated);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -369,6 +400,14 @@ export class SubFolderFileController extends Controller {
|
|||
DEFAULT_BUCKET!,
|
||||
`${cabinetName}/${drawerName}/${folderName}/${subFolderName}/${fileName}`,
|
||||
);
|
||||
await esClient.deleteByQuery({
|
||||
index: DEFAULT_INDEX!,
|
||||
query: {
|
||||
match: {
|
||||
pathname: `${cabinetName}/${drawerName}/${folderName}/${subFolderName}/${fileName}`,
|
||||
},
|
||||
},
|
||||
});
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,3 +9,5 @@ export function setInstance(server: Server) {
|
|||
export function getInstance() {
|
||||
return io;
|
||||
}
|
||||
|
||||
export default { getInstance, setInstance };
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ async function handleNotFoundRecord(
|
|||
if (!result) return false;
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("FileUpdate", metadata);
|
||||
io?.emit("FileUpload", metadata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ async function handleFoundRecord(
|
|||
if (!result) return false;
|
||||
|
||||
const io = getInstance();
|
||||
io?.emit("FileUpdate", metadata);
|
||||
io?.emit("FileUpload", metadata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import { FolderController } from './controllers/folderController';
|
|||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
import { SearchController } from './controllers/searchController';
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
import { StorageController } from './controllers/storageController';
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
import { SubFolderController } from './controllers/subFolderController';
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
import { SubFolderFileController } from './controllers/subFolderFileController';
|
||||
|
|
@ -65,6 +67,77 @@ const models: TsoaRoute.Models = {
|
|||
"additionalProperties": false,
|
||||
},
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
"ListRequestBody": {
|
||||
"dataType": "refObject",
|
||||
"properties": {
|
||||
"operation": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["folder"]},{"dataType":"enum","enums":["file"]}],"required":true},
|
||||
"path": {"dataType":"array","array":{"dataType":"string"},"required":true},
|
||||
},
|
||||
"additionalProperties": false,
|
||||
},
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
"FolderBody": {
|
||||
"dataType": "refObject",
|
||||
"properties": {
|
||||
"path": {"dataType":"array","array":{"dataType":"string"},"required":true},
|
||||
"name": {"dataType":"string","required":true},
|
||||
},
|
||||
"additionalProperties": false,
|
||||
},
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
"PutFolderBody": {
|
||||
"dataType": "refObject",
|
||||
"properties": {
|
||||
"from": {"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true},"path":{"dataType":"array","array":{"dataType":"string"},"required":true}},"required":true},
|
||||
"to": {"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true},"path":{"dataType":"array","array":{"dataType":"string"},"required":true}},"required":true},
|
||||
},
|
||||
"additionalProperties": false,
|
||||
},
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
"DeleteFolderBody": {
|
||||
"dataType": "refObject",
|
||||
"properties": {
|
||||
"path": {"dataType":"array","array":{"dataType":"string"},"required":true},
|
||||
},
|
||||
"additionalProperties": false,
|
||||
},
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
"FileBody": {
|
||||
"dataType": "refObject",
|
||||
"properties": {
|
||||
"path": {"dataType":"array","array":{"dataType":"string"},"required":true},
|
||||
"file": {"dataType":"string","required":true},
|
||||
"title": {"dataType":"string"},
|
||||
"description": {"dataType":"string"},
|
||||
"category": {"dataType":"array","array":{"dataType":"string"}},
|
||||
"keyword": {"dataType":"array","array":{"dataType":"string"}},
|
||||
},
|
||||
"additionalProperties": false,
|
||||
},
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
"PutFileBody": {
|
||||
"dataType": "refObject",
|
||||
"properties": {
|
||||
"title": {"dataType":"string"},
|
||||
"description": {"dataType":"string"},
|
||||
"category": {"dataType":"array","array":{"dataType":"string"}},
|
||||
"keyword": {"dataType":"array","array":{"dataType":"string"}},
|
||||
"from": {"dataType":"nestedObjectLiteral","nestedProperties":{"file":{"dataType":"string","required":true},"path":{"dataType":"array","array":{"dataType":"string"},"required":true}},"required":true},
|
||||
"to": {"dataType":"nestedObjectLiteral","nestedProperties":{"file":{"dataType":"string","required":true},"path":{"dataType":"array","array":{"dataType":"string"},"required":true}}},
|
||||
"upload": {"dataType":"boolean"},
|
||||
},
|
||||
"additionalProperties": false,
|
||||
},
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
"DeleteFileBody": {
|
||||
"dataType": "refObject",
|
||||
"properties": {
|
||||
"path": {"dataType":"array","array":{"dataType":"string"},"required":true},
|
||||
"file": {"dataType":"string","required":true},
|
||||
},
|
||||
"additionalProperties": false,
|
||||
},
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
};
|
||||
const validationService = new ValidationService(models);
|
||||
|
||||
|
|
@ -656,6 +729,181 @@ export function RegisterRoutes(app: Router) {
|
|||
}
|
||||
});
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
app.post('/storage/list',
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController)),
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController.prototype.getList)),
|
||||
|
||||
function StorageController_getList(request: any, response: any, next: any) {
|
||||
const args = {
|
||||
body: {"in":"body","name":"body","required":true,"ref":"ListRequestBody"},
|
||||
};
|
||||
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
|
||||
let validatedArgs: any[] = [];
|
||||
try {
|
||||
validatedArgs = getValidatedArgs(args, request, response);
|
||||
|
||||
const controller = new StorageController();
|
||||
|
||||
|
||||
const promise = controller.getList.apply(controller, validatedArgs as any);
|
||||
promiseHandler(controller, promise, response, undefined, next);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
});
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
app.post('/storage/folder',
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController)),
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController.prototype.postFolder)),
|
||||
|
||||
function StorageController_postFolder(request: any, response: any, next: any) {
|
||||
const args = {
|
||||
body: {"in":"body","name":"body","required":true,"ref":"FolderBody"},
|
||||
};
|
||||
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
|
||||
let validatedArgs: any[] = [];
|
||||
try {
|
||||
validatedArgs = getValidatedArgs(args, request, response);
|
||||
|
||||
const controller = new StorageController();
|
||||
|
||||
|
||||
const promise = controller.postFolder.apply(controller, validatedArgs as any);
|
||||
promiseHandler(controller, promise, response, 204, next);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
});
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
app.put('/storage/folder',
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController)),
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController.prototype.moveFolder)),
|
||||
|
||||
function StorageController_moveFolder(request: any, response: any, next: any) {
|
||||
const args = {
|
||||
body: {"in":"body","name":"body","required":true,"ref":"PutFolderBody"},
|
||||
};
|
||||
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
|
||||
let validatedArgs: any[] = [];
|
||||
try {
|
||||
validatedArgs = getValidatedArgs(args, request, response);
|
||||
|
||||
const controller = new StorageController();
|
||||
|
||||
|
||||
const promise = controller.moveFolder.apply(controller, validatedArgs as any);
|
||||
promiseHandler(controller, promise, response, 204, next);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
});
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
app.delete('/storage/folder',
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController)),
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController.prototype.deleteStorage)),
|
||||
|
||||
function StorageController_deleteStorage(request: any, response: any, next: any) {
|
||||
const args = {
|
||||
body: {"in":"body","name":"body","required":true,"ref":"DeleteFolderBody"},
|
||||
};
|
||||
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
|
||||
let validatedArgs: any[] = [];
|
||||
try {
|
||||
validatedArgs = getValidatedArgs(args, request, response);
|
||||
|
||||
const controller = new StorageController();
|
||||
|
||||
|
||||
const promise = controller.deleteStorage.apply(controller, validatedArgs as any);
|
||||
promiseHandler(controller, promise, response, 204, next);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
});
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
app.post('/storage/file',
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController)),
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController.prototype.postFile)),
|
||||
|
||||
function StorageController_postFile(request: any, response: any, next: any) {
|
||||
const args = {
|
||||
body: {"in":"body","name":"body","required":true,"ref":"FileBody"},
|
||||
};
|
||||
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
|
||||
let validatedArgs: any[] = [];
|
||||
try {
|
||||
validatedArgs = getValidatedArgs(args, request, response);
|
||||
|
||||
const controller = new StorageController();
|
||||
|
||||
|
||||
const promise = controller.postFile.apply(controller, validatedArgs as any);
|
||||
promiseHandler(controller, promise, response, 204, next);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
});
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
app.put('/storage/file',
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController)),
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController.prototype.moveFile)),
|
||||
|
||||
function StorageController_moveFile(request: any, response: any, next: any) {
|
||||
const args = {
|
||||
body: {"in":"body","name":"body","required":true,"ref":"PutFileBody"},
|
||||
};
|
||||
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
|
||||
let validatedArgs: any[] = [];
|
||||
try {
|
||||
validatedArgs = getValidatedArgs(args, request, response);
|
||||
|
||||
const controller = new StorageController();
|
||||
|
||||
|
||||
const promise = controller.moveFile.apply(controller, validatedArgs as any);
|
||||
promiseHandler(controller, promise, response, 204, next);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
});
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
app.delete('/storage/file',
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController)),
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController.prototype.deleteFile)),
|
||||
|
||||
function StorageController_deleteFile(request: any, response: any, next: any) {
|
||||
const args = {
|
||||
body: {"in":"body","name":"body","required":true,"ref":"DeleteFileBody"},
|
||||
};
|
||||
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
|
||||
let validatedArgs: any[] = [];
|
||||
try {
|
||||
validatedArgs = getValidatedArgs(args, request, response);
|
||||
|
||||
const controller = new StorageController();
|
||||
|
||||
|
||||
const promise = controller.deleteFile.apply(controller, validatedArgs as any);
|
||||
promiseHandler(controller, promise, response, 204, next);
|
||||
} catch (err) {
|
||||
return next(err);
|
||||
}
|
||||
});
|
||||
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
||||
app.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder',
|
||||
authenticateMiddleware([{"bearerAuth":[]}]),
|
||||
...(fetchMiddlewares<RequestHandler>(SubFolderController)),
|
||||
|
|
|
|||
|
|
@ -174,6 +174,299 @@
|
|||
},
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
},
|
||||
"ListRequestBody": {
|
||||
"properties": {
|
||||
"operation": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"folder",
|
||||
"file"
|
||||
]
|
||||
},
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"operation",
|
||||
"path"
|
||||
],
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
},
|
||||
"FolderBody": {
|
||||
"properties": {
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"แฟ้ม 1",
|
||||
"แฟ้ม 2"
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "แฟ้ม 3"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"path",
|
||||
"name"
|
||||
],
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
},
|
||||
"PutFolderBody": {
|
||||
"properties": {
|
||||
"from": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "แฟ้ม 3"
|
||||
},
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"แฟ้ม 1",
|
||||
"แฟ้ม 2"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"path"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"to": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "แฟ้ม 3 แก้ไข"
|
||||
},
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"แฟ้ม 1",
|
||||
"แฟ้ม 2"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"path"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"from",
|
||||
"to"
|
||||
],
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
},
|
||||
"DeleteFolderBody": {
|
||||
"properties": {
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"แฟ้ม 1",
|
||||
"แฟ้ม 2",
|
||||
"แฟ้ม 3 แก้ไข"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"path"
|
||||
],
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
},
|
||||
"FileBody": {
|
||||
"properties": {
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"แฟ้ม 1",
|
||||
"แฟ้ม 2",
|
||||
"แฟ้ม 3"
|
||||
]
|
||||
},
|
||||
"file": {
|
||||
"type": "string",
|
||||
"example": "ไฟล์ 1.xlsx"
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"example": "การเงิน"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "การเงิน"
|
||||
},
|
||||
"category": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"การเงิน",
|
||||
"รายงาน"
|
||||
]
|
||||
},
|
||||
"keyword": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"การเงิน",
|
||||
"รายรับ",
|
||||
"รายจ่าย"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"path",
|
||||
"file"
|
||||
],
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
},
|
||||
"PutFileBody": {
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"example": "การเงิน"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "การเงิน"
|
||||
},
|
||||
"category": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"การเงิน",
|
||||
"รายงาน"
|
||||
]
|
||||
},
|
||||
"keyword": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"การเงิน",
|
||||
"รายรับ",
|
||||
"รายจ่าย"
|
||||
]
|
||||
},
|
||||
"from": {
|
||||
"properties": {
|
||||
"file": {
|
||||
"type": "string",
|
||||
"example": "ไฟล์ 1.xlsx"
|
||||
},
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"แฟ้ม 1",
|
||||
"แฟ้ม 2",
|
||||
"แฟ้ม 3"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"file",
|
||||
"path"
|
||||
],
|
||||
"type": "object",
|
||||
"description": "หากต้องการอัพโหลดไฟล์ด้วยให้ส่งค่าเป็นจริง"
|
||||
},
|
||||
"to": {
|
||||
"properties": {
|
||||
"file": {
|
||||
"type": "string",
|
||||
"example": "ไฟล์ 1 แก้ไข.xlsx"
|
||||
},
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"แฟ้ม 1",
|
||||
"แฟ้ม 2",
|
||||
"แฟ้ม 3"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"file",
|
||||
"path"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"upload": {
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"from"
|
||||
],
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
},
|
||||
"DeleteFileBody": {
|
||||
"properties": {
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"แฟ้ม 1",
|
||||
"แฟ้ม 2",
|
||||
"แฟ้ม 3"
|
||||
]
|
||||
},
|
||||
"file": {
|
||||
"type": "string",
|
||||
"example": "ไฟล์ 1 แก้ไข.xlsx"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"path",
|
||||
"file"
|
||||
],
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"securitySchemes": {
|
||||
|
|
@ -1662,6 +1955,356 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/storage/list": {
|
||||
"post": {
|
||||
"operationId": "GetList",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Ok",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/StorageFolder"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/StorageFile"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
]
|
||||
},
|
||||
"examples": {
|
||||
"Example 1": {
|
||||
"value": [
|
||||
{
|
||||
"path": "ตู้เอกสาร 1/ลิ้นชัก 1/แฟ้ม 1",
|
||||
"name": "แฟ้ม 1",
|
||||
"createdAt": "2021-07-20T12:33:13.018Z",
|
||||
"createdBy": "admin"
|
||||
},
|
||||
{
|
||||
"path": "ตู้เอกสาร 1/ลิ้นชัก 1/แฟ้ม 2",
|
||||
"name": "แฟ้ม 2",
|
||||
"createdAt": "2022-01-23T16:05:02.114Z",
|
||||
"createdBy": "admin"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Example 2": {
|
||||
"value": [
|
||||
{
|
||||
"pathname": "ตู้เอกสาร 1/ลิ้นชัก 1/แฟ้ม 1/เอกสาร 1.pdf",
|
||||
"path": "ตู้เอกสาร 1/ลิ้นชัก 1/แฟ้ม 1/",
|
||||
"title": "เอกสาร",
|
||||
"description": "เอกสารการเงิน",
|
||||
"category": [
|
||||
"บัญชี"
|
||||
],
|
||||
"keyword": [
|
||||
"เงิน",
|
||||
"บัญชี",
|
||||
"รายจ่าย",
|
||||
"รายรับ"
|
||||
],
|
||||
"upload": false,
|
||||
"fileName": "เอกสาร 1.pdf",
|
||||
"fileSize": 10240,
|
||||
"fileType": "application/pdf",
|
||||
"createdAt": "2021-07-20T12:33:13.018Z",
|
||||
"createdBy": "admin",
|
||||
"updatedAt": "2021-07-20T12:33:13.018Z",
|
||||
"updatedBy": "admin"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Storage Folder",
|
||||
"Storage File"
|
||||
],
|
||||
"security": [],
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ListRequestBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage/folder": {
|
||||
"post": {
|
||||
"operationId": "PostFolder",
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "สำเร็จ"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Storage Folder"
|
||||
],
|
||||
"security": [],
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/FolderBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"operationId": "MoveFolder",
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "สำเร็จ"
|
||||
}
|
||||
},
|
||||
"description": "ยา้ย Folder ภายใต้ Folder (Path) หนึ่ง ไปภายใน Folder (Path) หนึ่งและสามารถเปลี่ยนชื่อได้",
|
||||
"tags": [
|
||||
"Storage Folder"
|
||||
],
|
||||
"security": [],
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/PutFolderBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"operationId": "DeleteStorage",
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "สำเร็จ"
|
||||
}
|
||||
},
|
||||
"description": "ลบ Folder หรือ File ออกจากระบบ",
|
||||
"tags": [
|
||||
"Storage Folder"
|
||||
],
|
||||
"security": [],
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DeleteFolderBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage/file": {
|
||||
"post": {
|
||||
"operationId": "PostFile",
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "สำเร็จ",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"createdBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
]
|
||||
},
|
||||
"updatedBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
]
|
||||
},
|
||||
"upload": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"keyword": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"category": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"fileType": {
|
||||
"type": "string"
|
||||
},
|
||||
"fileSize": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"fileName": {
|
||||
"type": "string"
|
||||
},
|
||||
"pathname": {
|
||||
"type": "string"
|
||||
},
|
||||
"uploadUrl": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"createdBy",
|
||||
"createdAt",
|
||||
"updatedBy",
|
||||
"updatedAt",
|
||||
"upload",
|
||||
"path",
|
||||
"keyword",
|
||||
"category",
|
||||
"description",
|
||||
"title",
|
||||
"fileType",
|
||||
"fileSize",
|
||||
"fileName",
|
||||
"pathname",
|
||||
"uploadUrl"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "ร้องขอการอัพโหลดไฟล์ โดยเมื่อร้องขอจะได้ URL สำหรับอัพโหลดไฟล์มาพร้อมข้อมูลของไฟล์ที่จะทำการอัพโหลด",
|
||||
"tags": [
|
||||
"Storage File"
|
||||
],
|
||||
"security": [],
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/FileBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"operationId": "MoveFile",
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "สำเร็จ",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"anyOf": [
|
||||
{},
|
||||
{
|
||||
"properties": {
|
||||
"uploadUrl": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"uploadUrl"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Storage File"
|
||||
],
|
||||
"security": [],
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/PutFileBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"operationId": "DeleteFile",
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "สำเร็จ"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Storage File"
|
||||
],
|
||||
"security": [],
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DeleteFileBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/cabinet/{cabinetName}/drawer/{drawerName}/folder/{folderName}/subfolder": {
|
||||
"get": {
|
||||
"operationId": "ListFolder",
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ export async function expressAuthentication(
|
|||
securityName: string,
|
||||
scopes?: string[],
|
||||
) {
|
||||
if (process.env.AUTH_BYPASS) return { preferred_username: "bypassed" };
|
||||
if (process.env.NODE_ENV !== "production" && process.env.AUTH_BYPASS) {
|
||||
return { preferred_username: "bypassed" };
|
||||
}
|
||||
|
||||
if (securityName !== "bearerAuth") throw new Error("Unknown authentication method.");
|
||||
|
||||
|
|
@ -36,7 +38,7 @@ export async function expressAuthentication(
|
|||
? request.headers["authorization"].split(" ")[1]
|
||||
: null;
|
||||
|
||||
if (!token) throw new HttpError(HttpStatusCode.UNAUTHORIZED, "No token provided.");
|
||||
if (!token) throw new HttpError(HttpStatusCode.UNAUTHORIZED, "ไม่พบข้อมูลสำหัรบบืนบันตัวตน");
|
||||
|
||||
let payload: JwtPayload = {};
|
||||
|
||||
|
|
@ -60,7 +62,7 @@ export async function expressAuthentication(
|
|||
.map((v) => (v === "management-role" ? process.env.MANAGEMENT_ROLE : v))
|
||||
.every((v) => !payload.resource_access[payload.azp].roles.includes(v))
|
||||
) {
|
||||
throw new HttpError(HttpStatusCode.FORBIDDEN, "You are not allowed to perform this action.");
|
||||
throw new HttpError(HttpStatusCode.FORBIDDEN, "คุณไม่มีสิทธิในเข้าถึงข้อมูลนี้");
|
||||
}
|
||||
|
||||
return payload;
|
||||
|
|
@ -68,7 +70,7 @@ export async function expressAuthentication(
|
|||
|
||||
async function verifyOffline(token: string) {
|
||||
const payload = await jwtVerify(token).catch((_) => null);
|
||||
if (!payload) throw new HttpError(HttpStatusCode.UNAUTHORIZED, "Invalid token provided.");
|
||||
if (!payload) throw new HttpError(HttpStatusCode.UNAUTHORIZED, "ไม่สามารถยืนยันตัวตนได้");
|
||||
return payload;
|
||||
}
|
||||
|
||||
|
|
@ -77,8 +79,8 @@ async function verifyOnline(token: string) {
|
|||
headers: { authorization: `Bearer ${token}` },
|
||||
}).catch((e) => console.error(e));
|
||||
|
||||
if (!res) throw new Error("Cannot connect to auth service.");
|
||||
if (!res.ok) throw new HttpError(HttpStatusCode.UNAUTHORIZED, "Invalid token provided.");
|
||||
if (!res) throw new Error("ไม่สามารถเข้าถึงระบบยืนยันตัวตน");
|
||||
if (!res.ok) throw new HttpError(HttpStatusCode.UNAUTHORIZED, "ไม่สามารถยืนยันตัวตนได้");
|
||||
|
||||
return await jwtDecode(token);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue