Browse Source

storage interfaces

Darko Luketic 1 year ago
parent
commit
f74d71c449
3 changed files with 144 additions and 7 deletions
  1. 52 5
      .idea/workspace.xml
  2. 3 2
      assets/index.html
  3. 89 0
      server/storage/interface.go

+ 52 - 5
.idea/workspace.xml

@@ -2,9 +2,9 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="b53224e0-aa94-4cfe-93b8-a3f518c11d96" name="Default" comment="">
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/assets/index.html" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/server/storage/interface.go" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/cmd/server.go" afterPath="$PROJECT_DIR$/cmd/server.go" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/assets/index.html" afterPath="$PROJECT_DIR$/assets/index.html" />
     </list>
     <ignored path="$PROJECT_DIR$/.tmp/" />
     <ignored path="$PROJECT_DIR$/temp/" />
@@ -31,7 +31,7 @@
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="index.html" pinned="false" current-in-tab="true">
+      <file leaf-file-name="index.html" pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/assets/index.html">
           <provider selected="true" editor-type-id="text-editor">
             <state relative-caret-position="160">
@@ -41,12 +41,23 @@
           </provider>
         </entry>
       </file>
+      <file leaf-file-name="interface.go" pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/server/storage/interface.go">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="0">
+              <caret line="0" column="0" lean-forward="true" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
     </leaf>
   </component>
   <component name="FileTemplateManagerImpl">
     <option name="RECENT_TEMPLATES">
       <list>
         <option value="HTML File" />
+        <option value="Go File" />
       </list>
     </option>
   </component>
@@ -58,6 +69,7 @@
       <list>
         <option value="$PROJECT_DIR$/cmd/server.go" />
         <option value="$PROJECT_DIR$/assets/index.html" />
+        <option value="$PROJECT_DIR$/server/storage/interface.go" />
       </list>
     </option>
   </component>
@@ -112,6 +124,24 @@
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
             <PATH_ELEMENT>
+              <option name="myItemId" value="server" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="storage" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+          </PATH>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="forum" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="forum" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+            </PATH_ELEMENT>
+            <PATH_ELEMENT>
               <option name="myItemId" value="cmd" />
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
             </PATH_ELEMENT>
@@ -141,6 +171,7 @@
     <property name="WebServerToolWindowFactoryState" value="false" />
     <property name="HbShouldOpenHtmlAsHb" value="" />
     <property name="DefaultHtmlFileTemplate" value="HTML File" />
+    <property name="DefaultGoTemplateProperty" value="Go File" />
   </component>
   <component name="RunDashboard">
     <option name="ruleStates">
@@ -248,12 +279,12 @@
       <option name="number" value="Default" />
       <option name="presentableId" value="Default" />
       <updated>1493121038252</updated>
-      <workItem from="1493121039397" duration="1004000" />
+      <workItem from="1493121039397" duration="3594000" />
     </task>
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="1004000" />
+    <option name="totallyTimeSpent" value="3594000" />
   </component>
   <component name="ToolWindowManager">
     <frame x="0" y="27" width="1920" height="1053" extended-state="6" />
@@ -314,5 +345,21 @@
         </state>
       </provider>
     </entry>
+    <entry file="file:///usr/lib/go/src/builtin/builtin.go">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="312">
+          <caret line="76" column="43" lean-forward="true" selection-start-line="76" selection-start-column="43" selection-end-line="76" selection-end-column="43" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/server/storage/interface.go">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" lean-forward="true" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
   </component>
 </project>

+ 3 - 2
assets/index.html

@@ -2,9 +2,10 @@
 <html lang="en">
 <head>
     <meta charset="UTF-8">
-    <title>$Title$</title>
+    <title>Assets</title>
 </head>
 <body>
-$END$
+<h1>The asset directory</h1>
+<p>Nothing to see here</p>
 </body>
 </html>

+ 89 - 0
server/storage/interface.go

@@ -0,0 +1,89 @@
+package storage
+
+/*
+Model Interfaces
+*/
+
+type CategoryModelInterface interface {
+	GetID() (string, error)
+	SetID(id string) error
+	GetTitle() (string, error)
+	SetTitle(title string) error
+	GetDescription() (string, error)
+	SetDescription(description string) error
+}
+
+type ForumModelInterface interface {
+	GetID() (string, error)
+	SetID(id string) error
+	GetCategoryID() (string, error)
+	SetCategoryID(id string) error
+	GetTitle() (string, error)
+	SetTitle(title string) error
+	GetDescription() (string, error)
+	SetDescription(description string) error
+	GetRules() (string, error)
+	SetRules(rules string) error
+}
+
+type ThreadModelInterface interface {
+	GetID() (string, error)
+	SetID(id string) error
+	GetForumID() (string, error)
+	SetForumID(id string) error
+	GetTitle() (string, error)
+	SetTitle(title string) error
+}
+
+type PostModelInterface interface {
+	GetID() (string, error)
+	SetID(id string) error
+	GetThreadID() (string, error)
+	SetThreadID(id string) error
+	GetTitle() (string, error)
+	SetTitle(title string) error
+}
+
+/*
+Storage Interfaces
+*/
+
+type CategoryStorageInterface interface {
+	Create(model *CategoryModelInterface) error
+	Update(id string, model *CategoryModelInterface) error
+	ReadOne(id string) (*CategoryModelInterface, error)
+	ReadOneBy(query map[string]interface{}) (*CategoryModelInterface, error)
+	ReadAll() ([]*CategoryModelInterface, error)
+	ReadAllBy(query map[string]interface{}) ([]*CategoryModelInterface, error)
+	Delete(id string) error
+}
+
+type ForumStorageInterface interface {
+	Create(model *ForumModelInterface) error
+	Update(id string, model *ForumModelInterface) error
+	ReadOne(id string) (*ForumModelInterface, error)
+	ReadOneBy(query map[string]interface{}) (*ForumModelInterface, error)
+	ReadAll() ([]*ForumModelInterface, error)
+	ReadAllBy(query map[string]interface{}) ([]*ForumModelInterface, error)
+	Delete(id string) error
+}
+
+type ThreadStorageInterface interface {
+	Create(model *ThreadModelInterface) error
+	Update(id string, model *ThreadModelInterface) error
+	ReadOne(id string) (*ThreadModelInterface, error)
+	ReadOneBy(query map[string]interface{}) (*ThreadModelInterface, error)
+	ReadAll() ([]*ThreadModelInterface, error)
+	ReadAllBy(query map[string]interface{}) ([]*ThreadModelInterface, error)
+	Delete(id string) error
+}
+
+type PostStorageInterface interface {
+	Create(model *PostModelInterface) error
+	Update(id string, model *PostModelInterface) error
+	ReadOne(id string) (*PostModelInterface, error)
+	ReadOneBy(query map[string]interface{}) (*PostModelInterface, error)
+	ReadAll() ([]*PostModelInterface, error)
+	ReadAllBy(query map[string]interface{}) ([]*PostModelInterface, error)
+	Delete(id string) error
+}