Still not much to say here, just adding the basic functionaliy

This commit is contained in:
2025-07-13 22:07:39 +01:00
parent a56a277463
commit 83ffa57dbf
26 changed files with 488 additions and 135 deletions
+37 -37
View File
@@ -1,97 +1,97 @@
<mxfile host="Electron" modified="2025-07-07T14:50:15.284Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.6.4 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="CjDBUIA4ec52agdhe-jr" version="24.6.4" type="device">
<mxfile host="Electron" modified="2025-07-13T18:40:27.459Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.6.4 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="E7Zlkm9D5CuTbYWM9N3p" version="24.6.4" type="device">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="2901" dy="1221" 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="1606" dy="1205" 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="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="2HHwYVkoNOaQELfMIDZ7-0" value="Expense" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-0" value="Expense" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="-800" y="320" width="140" height="208" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-11" value="+ ID: int&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-0">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-11" value="+ ExpID: int&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-0" vertex="1">
<mxGeometry y="26" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-1" value="+ Value: float&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-0">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-1" value="+ Value: float&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-0" vertex="1">
<mxGeometry y="52" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-2" value="+ (FK) StoreID: int&amp;nbsp;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-0">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-2" value="+ (FK) StoreID: int&amp;nbsp;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-0" vertex="1">
<mxGeometry y="78" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-3" value="+ (FK) CategoryID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-0">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-3" value="+ (FK) CategoryID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-0" vertex="1">
<mxGeometry y="104" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-4" value="+ (FK) Owner&lt;span style=&quot;background-color: initial;&quot;&gt;User&lt;/span&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;ID: int&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-0">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-4" value="+ (FK) Owner&lt;span style=&quot;background-color: initial;&quot;&gt;User&lt;/span&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;ID: int&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-0" vertex="1">
<mxGeometry y="130" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-6" value="+ ExpenseDate&lt;span style=&quot;background-color: initial;&quot;&gt;: date&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-0">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-6" value="+ ExpenseDate&lt;span style=&quot;background-color: initial;&quot;&gt;: date&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-0" vertex="1">
<mxGeometry y="156" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-5" value="+ CreationDate&lt;span style=&quot;background-color: initial;&quot;&gt;: date&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-0">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-5" value="+ CreationDate&lt;span style=&quot;background-color: initial;&quot;&gt;: date&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-0" vertex="1">
<mxGeometry y="182" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-7" value="Category" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-7" value="Category" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="-800" y="40" width="140" height="78" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-8" value="+ ID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-7">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-8" value="+ CategoryID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-7" vertex="1">
<mxGeometry y="26" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-9" value="+ Name: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-7">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-9" value="+ CategoryName: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-7" vertex="1">
<mxGeometry y="52" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-12" value="Store" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-12" value="Store" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="-640" y="40" width="140" height="78" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-13" value="+ ID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-12">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-13" value="+ StoreID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-12" vertex="1">
<mxGeometry y="26" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-14" value="+ Name: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-12">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-14" value="+ StoreName: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-12" vertex="1">
<mxGeometry y="52" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-16" value="User" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-16" value="User" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="-480" y="40" width="140" height="104" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-17" value="+ ID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-16">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-17" value="+ UserID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-16" vertex="1">
<mxGeometry y="26" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-18" value="+ Name: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-16">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-18" value="+ UserName: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-16" vertex="1">
<mxGeometry y="52" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-19" value="+ Password: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-16">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-19" value="+ UserPass: str" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-16" vertex="1">
<mxGeometry y="78" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-20" value="ExpensePayers" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-20" value="ExpensePayers" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="-440" y="470" width="140" height="130" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-21" value="+ ID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-20">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-21" value="+ ExpPaymID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-20" vertex="1">
<mxGeometry y="26" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-33" value="+ (FK) ExpenseID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-20">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-33" value="+ (FK) ExpenseID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-20" vertex="1">
<mxGeometry y="52" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-22" value="+ (FK) UserID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-20">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-22" value="+ (FK) UserID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-20" vertex="1">
<mxGeometry y="78" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-23" value="+ PayedAmount: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-20">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-23" value="+ PayedAmount: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-20" vertex="1">
<mxGeometry y="104" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-24" value="ExpenseShares" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-24" value="ExpenseShares" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="-440" y="320" width="140" height="130" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-25" value="+ ID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-24">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-25" value="+ ExpShareID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-24" vertex="1">
<mxGeometry y="26" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-31" value="+ (FK) ExpenseID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-24">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-31" value="+ (FK) ExpenseID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-24" vertex="1">
<mxGeometry y="52" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-26" value="+ (FK) UserID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-24">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-26" value="+ (FK) UserID: int" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-24" vertex="1">
<mxGeometry y="78" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-27" value="+ share: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" vertex="1" parent="2HHwYVkoNOaQELfMIDZ7-24">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-27" value="+ share: float" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;" parent="2HHwYVkoNOaQELfMIDZ7-24" vertex="1">
<mxGeometry y="104" width="140" height="26" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0;exitDx=0;exitDy=0;entryX=0.007;entryY=1.038;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-0" target="2HHwYVkoNOaQELfMIDZ7-9">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0;exitDx=0;exitDy=0;entryX=0.007;entryY=1.038;entryDx=0;entryDy=0;entryPerimeter=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-0" target="2HHwYVkoNOaQELfMIDZ7-9" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=0;exitDx=0;exitDy=0;entryX=0.264;entryY=1.115;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-0" target="2HHwYVkoNOaQELfMIDZ7-14">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=0;exitDx=0;exitDy=0;entryX=0.264;entryY=1.115;entryDx=0;entryDy=0;entryPerimeter=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-0" target="2HHwYVkoNOaQELfMIDZ7-14" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-765" y="220" />
@@ -99,7 +99,7 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.486;entryY=1.154;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-0" target="2HHwYVkoNOaQELfMIDZ7-19">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.486;entryY=1.154;entryDx=0;entryDy=0;entryPerimeter=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-0" target="2HHwYVkoNOaQELfMIDZ7-19" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-730" y="260" />
@@ -107,13 +107,13 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-25" target="2HHwYVkoNOaQELfMIDZ7-11">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-25" target="2HHwYVkoNOaQELfMIDZ7-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-21" target="2HHwYVkoNOaQELfMIDZ7-5">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-21" target="2HHwYVkoNOaQELfMIDZ7-5" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.786;entryY=1.231;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-24" target="2HHwYVkoNOaQELfMIDZ7-19">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.786;entryY=1.231;entryDx=0;entryDy=0;entryPerimeter=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-24" target="2HHwYVkoNOaQELfMIDZ7-19" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-370" y="190" />
@@ -121,7 +121,7 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="2HHwYVkoNOaQELfMIDZ7-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-33" target="2HHwYVkoNOaQELfMIDZ7-18">
<mxCell id="2HHwYVkoNOaQELfMIDZ7-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2HHwYVkoNOaQELfMIDZ7-33" target="2HHwYVkoNOaQELfMIDZ7-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
+12 -2
View File
@@ -33,13 +33,13 @@
opacity: 1.1;
}
40% {
opacity: 0.9;
opacity: 1.1;
}
60% {
opacity: 1;
}
80% {
opacity: 1.1;
opacity: 1;
}
100% {
opacity: 1;
@@ -126,6 +126,16 @@
text-shadow: 2.6208764474px 0 1px rgba(0, 30, 255, 0.5), -2.6208764474px 0 1px rgba(255, 0, 80, 0.3), 0 0 3px;
}
}
.decimal-align {
text-align: right;
font-variant-numeric: tabular-nums; /* makes digits equal width */
font-family: monospace, monospace;
}
th {
text-align: left;
}
:root {
--html_font_size: 20px;
--html_mobile_font_size: 15px;
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["crt.scss","main.scss"],"names":[],"mappings":";AAIA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EAIA;EACA;EACA;EACA;EAEA;;;AAGF;EAII;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;;AAKN;EACE;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;;AClJJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EAEA;EAEA;EACA;AAEA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EAEA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAEF;AAEA;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;EACA,aACE;;;AAGJ;EACE;EACA;EAEA;EACA;;;AAGF;AACE;EACA;EACA;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EAEA;;;AAGF;EACE;EAEA;AAEA;EACA;AACA;EACA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;AACA;AACA;AACA;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;IACE","file":"aesthetic.css"}
{"version":3,"sourceRoot":"","sources":["crt.scss","expensesTable.scss","main.scss"],"names":[],"mappings":";AAMA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EAIA;EACA;EACA;EACA;EAEA;;;AAGF;EAII;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;;AAKN;EACE;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;;ACtJJ;EACE;EACA;EACA;;;AAGF;EACE;;;ACJF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EAEA;EAEA;EACA;AAEA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EAEA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAEF;AAEA;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;EACA,aACE;;;AAGJ;EACE;EACA;EAEA;EACA;;;AAGF;AACE;EACA;EACA;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EAEA;;;AAGF;EACE;EAEA;AAEA;EACA;AACA;EACA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;AACA;AACA;AACA;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;IACE","file":"aesthetic.css"}
+4 -2
View File
@@ -1,3 +1,5 @@
@use 'sass:math';
// #container {
// animation: flicker 1.75s infinite;
// }
@@ -38,8 +40,8 @@
$steps: 5;
@for $i from 0 through $steps {
#{percentage(calc($i * (1 / $steps)))} {
opacity: calc((random(3) + 8) / 10.0);
#{math.percentage(calc($i * (1 / $steps)))} {
opacity: calc((math.random(3) + 8) / 10.0);
}
}
}
+9
View File
@@ -0,0 +1,9 @@
.decimal-align {
text-align: right;
font-variant-numeric: tabular-nums; /* makes digits equal width */
font-family: monospace, monospace;
}
th {
text-align: left;
}
+1
View File
@@ -1,4 +1,5 @@
@use 'crt';
@use 'expensesTable';
:root {
--html_font_size: 20px;
+12
View File
@@ -0,0 +1,12 @@
<table>
<tr>
<th>ID</th>
<th>Name</th>
</tr>
{{ range .categories }}
<tr>
<th><a href="/categories/{{ .CategoryID }}">{{ .CategoryID }}</th>
<th spellcheck="false" contenteditable>{{ .CategoryName }}</th>
</tr>
{{ end }}
</table>
+10
View File
@@ -0,0 +1,10 @@
<table>
<tr>
<td>ID:</td>
<td>{{ .category.CategoryID }}</td>
</tr>
<tr>
<td>Name:</td>
<td>{{ .category.CategoryName }}</td>
</tr>
</table>
+14
View File
@@ -0,0 +1,14 @@
<table>
<tr>
<td>ID:</td>
<td>{{ .expense.ExpID }}</td>
</tr>
<tr>
<td>Description:</td>
<td>{{ .expense.Description }}</td>
</tr>
<tr>
<td>Date:</td>
<td>{{ formatDate .expense.ExpDate }}</td>
</tr>
</table>
+16 -4
View File
@@ -1,4 +1,16 @@
<dl>
<dt>Hello,</dt>
<dd>world</dd>
</dl>
<table>
<tr>
<th>ID</th>
<th>Desc</th>
<th>Price</th>
<th>Date</th>
</tr>
{{ range .expenses }}
<tr>
<th><a href="/expenses/{{ .ExpID }}">{{ .ExpID }}</th>
<th spellcheck="false" contenteditable>{{ .Description }}</th>
<th spellcheck="false" contenteditable>{{ formatPrice .Value }}</th>
<th spellcheck="false" contenteditable>{{ formatDate .ExpDate }}</th>
</tr>
{{ end }}
</table>
View File
+61
View File
@@ -0,0 +1,61 @@
package expenses
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
"log"
"strconv"
)
type Category struct {
CategoryID int
CategoryName string
}
func GetAllCategories() ([]Category, error) {
db, err := sql.Open("sqlite3", "./data/data.db")
if err != nil {
return nil, err
}
defer db.Close()
query := "SELECT CategoryID,CategoryName " +
"FROM categories"
var categoryList []Category
rows, err := db.Query(query)
if err != nil {
return nil, err
}
for rows.Next() {
exp := &Category{}
err := rows.Scan(&exp.CategoryID, &exp.CategoryName)
if err != nil {
log.Fatalf("Failed to parse data from db: %v", err)
}
categoryList = append(categoryList, *exp)
}
return categoryList, nil
}
func GetCategory(catID int) (Category, error) {
db, err := sql.Open("sqlite3", "./data/data.db")
if err != nil {
return Category{}, err
}
defer db.Close()
query := "SELECT CategoryID,CategoryName " +
"FROM categories " +
"WHERE CategoryID = " + strconv.Itoa(catID)
var cat Category
err = db.QueryRow(query).Scan(&cat.CategoryID, &cat.CategoryName)
if err != nil {
return Category{}, nil
}
return cat, nil
}
+75
View File
@@ -0,0 +1,75 @@
package expenses
import (
"database/sql"
"log"
"strconv"
_ "github.com/mattn/go-sqlite3"
)
type Expense struct {
ExpID int
Description string
Value float32
StoreID int
CategoryID int
OwnerUserID int
ExpDate int
CreationDate int
}
func GetAllExpenses() ([]Expense, error) {
db, err := sql.Open("sqlite3", "./data/data.db")
if err != nil {
return nil, err
}
defer db.Close()
query := "SELECT ExpID,Description,Value,StoreID,CategoryID," +
"OwnerUserID,ExpDate,CreationDate " +
"FROM expenses"
var expList []Expense
rows, err := db.Query(query)
if err != nil {
return nil, err
}
for rows.Next() {
exp := &Expense{}
err := rows.Scan(&exp.ExpID, &exp.Description, &exp.Value, &exp.StoreID,
&exp.CategoryID, &exp.OwnerUserID, &exp.ExpDate, &exp.CreationDate,
)
if err != nil {
log.Fatalf("Failed to parse data from db: %v", err)
}
expList = append(expList, *exp)
}
return expList, nil
}
func GetExpense(expID int) (Expense, error) {
db, err := sql.Open("sqlite3", "./data/data.db")
if err != nil {
return Expense{}, err
}
defer db.Close()
query := "SELECT ExpID,Description,Value,StoreID,CategoryID," +
"OwnerUserID,ExpDate,CreationDate " +
"FROM expenses " +
"WHERE ExpID = " + strconv.Itoa(expID)
var exp Expense
err = db.QueryRow(query).Scan(
&exp.ExpID, &exp.Description, &exp.Value, &exp.StoreID,
&exp.CategoryID, &exp.OwnerUserID, &exp.ExpDate, &exp.CreationDate,
)
if err != nil {
return Expense{}, nil
}
return exp, nil
}
+6
View File
@@ -0,0 +1,6 @@
package expenses
type Stores struct {
StoreID int
StoreName string
}
+6
View File
@@ -0,0 +1,6 @@
package expenses
type Users struct {
UserID int
UserName string
}
+1
View File
@@ -4,6 +4,7 @@ go 1.24.4
require (
github.com/gin-gonic/gin v1.10.1
github.com/mattn/go-sqlite3 v1.14.28
gopkg.in/yaml.v2 v2.4.0
)
+2
View File
@@ -38,6 +38,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+2
View File
@@ -22,6 +22,8 @@ func main() {
router.LoadHTMLGlob(filepath.Join(cfg.AssetsDir, "htmx/*.gotempl"))
pages.RouteHome(router)
pages.RouteExpenses(router)
pages.RouteCategories(router)
pages.RouteNotFound(router)
pages.RouteServerError(router)
+2 -2
View File
@@ -2,7 +2,7 @@ package pages
import (
"expenses/config"
"expenses/utils"
"expenses/templating"
"net/http"
@@ -12,7 +12,7 @@ import (
func NotFoundView(c *gin.Context, msg string) {
cfg := config.GetInstance()
errHtml := utils.HtmlTemplate(
errHtml := templating.HtmlTemplate(
cfg.AssetsDir+"htmx/panic.tpl", map[string]any{
"msg": msg,
},
+2 -2
View File
@@ -2,7 +2,7 @@ package pages
import (
"expenses/config"
"expenses/utils"
"expenses/templating"
"github.com/gin-gonic/gin"
)
@@ -10,7 +10,7 @@ import (
func ServerErrorView(c *gin.Context, msg string) {
cfg := config.GetInstance()
errHtml := utils.HtmlTemplate(
errHtml := templating.HtmlTemplate(
cfg.AssetsDir+"htmx/panic.tpl", map[string]any{
"msg": msg,
},
+85
View File
@@ -0,0 +1,85 @@
package pages
import (
"expenses/config"
"expenses/expenses"
"expenses/templating"
"log"
"net/http"
fp "path/filepath"
"strconv"
"github.com/gin-gonic/gin"
)
const (
CategoriesPath = "/categories"
)
func categoriesContent() (map[string]any, error) {
log.Println("here1")
categories, err := expenses.GetAllCategories()
if err != nil {
return nil, err
}
log.Println("here2")
data := map[string]any{
"size": len(categories) - 1,
"categories": categories,
"resource": "categories",
}
return data, nil
}
func categoriesGlobalPage(c *gin.Context) {
cfg := config.GetInstance()
categories, err := categoriesContent()
if err != nil {
c.Header("HX-Redirect", "/500")
return
}
content := templating.HtmlTemplate(
fp.Join(cfg.AssetsDir, "htmx/categories.html"),
categories,
)
c.HTML(http.StatusOK, "terminal.gotempl", gin.H{
"page": "categories",
"renderNavBar": true,
"content": content,
})
}
func categoryPage(c *gin.Context) {
cfg := config.GetInstance()
categoryID, err := strconv.Atoi(c.Param("id"))
if err != nil {
c.Redirect(404, "/404")
}
category, err := expenses.GetCategory(categoryID)
content := templating.HtmlTemplate(
fp.Join(cfg.AssetsDir, "/htmx/category.html"),
map[string]any{
"category": category,
},
)
c.HTML(http.StatusOK, "terminal.gotempl", gin.H{
"page": "category",
"renderNavBar": false,
"content": content,
})
}
func RouteCategories(router *gin.Engine) {
router.GET(CategoriesPath, categoriesGlobalPage)
router.POST(CategoriesPath, categoriesGlobalPage)
router.GET(CategoriesPath+"/:id", categoryPage)
}
+82
View File
@@ -0,0 +1,82 @@
package pages
import (
"expenses/config"
"expenses/expenses"
"expenses/templating"
"strconv"
"net/http"
fp "path/filepath"
"github.com/gin-gonic/gin"
)
const (
ExpensesPath = "/expenses"
)
func expensesContent() (map[string]any, error) {
expenses, err := expenses.GetAllExpenses()
if err != nil {
return nil, err
}
data := map[string]any{
"size": len(expenses) - 1,
"expenses": expenses,
"resource": "expenses",
}
return data, nil
}
func ExpensesGlobalPage(c *gin.Context) {
cfg := config.GetInstance()
expenses, err := expensesContent()
if err != nil {
c.Header("HX-Redirect", "/500")
return
}
content := templating.HtmlTemplate(
fp.Join(cfg.AssetsDir, "htmx/expenses.html"),
expenses,
)
c.HTML(http.StatusOK, "terminal.gotempl", gin.H{
"page": "expenses",
"renderNavBar": true,
"content": content,
})
}
func ExpensePage(c *gin.Context) {
cfg := config.GetInstance()
expenseID, err := strconv.Atoi(c.Param("id"))
if err != nil {
c.Redirect(404, "/404")
}
expense, err := expenses.GetExpense(expenseID)
content := templating.HtmlTemplate(
fp.Join(cfg.AssetsDir, "/htmx/expense.html"),
map[string]any{
"expense": expense,
},
)
c.HTML(http.StatusOK, "terminal.gotempl", gin.H{
"page": "expense",
"renderNavBar": false,
"content": content,
})
}
func RouteExpenses(router *gin.Engine) {
router.GET(ExpensesPath, ExpensesGlobalPage)
router.POST(ExpensesPath, ExpensesGlobalPage)
router.GET(ExpensesPath+"/:id", ExpensePage)
}
-34
View File
@@ -1,47 +1,13 @@
package pages
import (
"expenses/config"
"expenses/utils"
"html/template"
"net/http"
fp "path/filepath"
"github.com/gin-gonic/gin"
)
const (
ExpensesPath = "/expenses"
)
func ExpensesContent() template.HTML {
cfg := config.GetInstance()
expensesPage := template.HTML(
utils.LoadFile(fp.Join(cfg.AssetsDir, "htmx/expenses.html")),
)
return expensesPage
}
func GetExpensesPage(c *gin.Context) {
c.String(http.StatusOK, string(ExpensesContent()))
}
func ExpensesPage(c *gin.Context) {
content := ExpensesContent()
c.HTML(http.StatusOK, "terminal.gotempl", gin.H{
"page": "expenses",
"renderNavBar": true,
"content": content,
})
}
func RouteHome(router *gin.Engine) {
router.GET("/", func(c *gin.Context) {
c.Redirect(http.StatusFound, ExpensesPath)
})
router.GET(ExpensesPath, ExpensesPage)
router.POST(ExpensesPath, ExpensesPage)
}
+48
View File
@@ -0,0 +1,48 @@
package templating
import (
"bytes"
"fmt"
"html/template"
"log"
fp "path/filepath"
"time"
)
func createTemplateEngine(name string) *template.Template {
funcMap := template.FuncMap{
"formatDate": func(ts int) string {
return time.Unix(int64(ts), 0).Format("02-Jan-2006")
},
"formatPrice": func(v float32) string {
return fmt.Sprintf("%.2f", v)
},
}
tmpl := template.New(name).Funcs(funcMap)
return tmpl
}
func HtmlTemplate(file string, data map[string]any) template.HTML {
tmplEngName := fp.Base(file)
tmplEngine := createTemplateEngine(tmplEngName)
tmpl, err := tmplEngine.ParseFiles(file)
if err != nil {
log.Println("error in templating")
panic(err)
}
// Use a bytes.Buffer to store the rendered output
var renderedOutput bytes.Buffer
// Render the template
err = tmpl.ExecuteTemplate(&renderedOutput, tmplEngName, data)
if err != nil {
log.Fatalf("Template execution: %v", err)
}
// Now renderedOutput holds the rendered template
return template.HTML(renderedOutput.String())
}
-14
View File
@@ -1,14 +0,0 @@
package utils
import (
"os"
"log"
)
func LoadFile(path string) []byte {
file, err := os.ReadFile(path)
if err != nil {
log.Printf("Unable to open file: %s\n", path)
}
return file
}
-37
View File
@@ -1,37 +0,0 @@
package utils
import (
"bytes"
"html/template"
"log"
"os"
"path"
)
func ReadFile(path string) []byte {
file, err := os.ReadFile(path)
if err != nil {
log.Printf("Unable to open file: %s\n", path)
}
return file
}
func HtmlTemplate(file string, data map[string]any) template.HTML {
templateName := path.Base(file)
tmpl, err := template.New(templateName).ParseFiles(file)
if err != nil {
panic(err)
}
// Use a bytes.Buffer to store the rendered output
var renderedOutput bytes.Buffer
// Render the template
err = tmpl.ExecuteTemplate(&renderedOutput, templateName, data)
if err != nil {
log.Fatalf("Template execution: %v", err)
}
// Now, renderedOutput holds the rendered template
return template.HTML(renderedOutput.String())
}