diff --git a/resources/templates/accounts.html b/resources/templates/accounts.html
index 92f2d20..5dbabf9 100644
--- a/resources/templates/accounts.html
+++ b/resources/templates/accounts.html
@@ -4,7 +4,31 @@
{% block body %}
-
bob le chef
+
+
+
+ |
+ id |
+ Amount |
+ Account Type |
+ Last Update |
+ Security |
+
+
+
+ {% for account in accounts %}
+
+ |
+ {{ account.id }} |
+ {{ account.amount }} |
+ {{ account.account_type }} |
+ {{ account.last_update }} |
+ {{ account.security_symbol }} |
+
+ {% endfor %}
+
+
+
{% endblock %}
diff --git a/resources/templates/components/navbar.html b/resources/templates/components/navbar.html
index 97e6c3e..065bf28 100644
--- a/resources/templates/components/navbar.html
+++ b/resources/templates/components/navbar.html
@@ -7,6 +7,7 @@
{% set nav_bar_items = [{'id': 'overview', 'label': 'Overview'},
{'id': 'accounts', 'label': 'Accounts'},
+ {'id': 'securities', 'label': 'Securities'},
{'id': 'actions', 'label': 'Actions'}]%}
{% for itm in nav_bar_items %}
- {{ itm.label }}
diff --git a/resources/templates/partials/actions/create_account.html b/resources/templates/partials/actions/create_account.html
index b10250b..facbbc2 100644
--- a/resources/templates/partials/actions/create_account.html
+++ b/resources/templates/partials/actions/create_account.html
@@ -1,7 +1,7 @@
+
+
+
{%include "partials/actions/submit_button.html"%}
diff --git a/resources/templates/partials/actions/create_security.html b/resources/templates/partials/actions/create_security.html
index ecec1ad..07b549b 100644
--- a/resources/templates/partials/actions/create_security.html
+++ b/resources/templates/partials/actions/create_security.html
@@ -30,4 +30,6 @@
+
+
{%include "partials/actions/submit_button.html"%}
diff --git a/resources/templates/securities.html b/resources/templates/securities.html
new file mode 100644
index 0000000..d91d10d
--- /dev/null
+++ b/resources/templates/securities.html
@@ -0,0 +1,34 @@
+{% set active_navbar_item = 'securities' %}
+
+{% extends "base.html" %}
+
+{% block body %}
+
+
+
+
+
+ |
+ Id |
+ Name |
+ Symbol |
+ Type |
+
+
+
+
+ {% for sec in securities %}
+
+ |
+ {{ sec.id }} |
+ {{ sec.name }} |
+ {{ sec.symbol }} |
+ {{ sec.security_type }} |
+
+ {% endfor %}
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/src/db/_external_id.rs b/src/db/_external_id.rs
index 09c9757..4804da5 100644
--- a/src/db/_external_id.rs
+++ b/src/db/_external_id.rs
@@ -1,7 +1,7 @@
use std::fmt;
use regex::{Captures, Regex};
-use serde::{Deserialize, Serialize};
+use serde::{Deserialize, Deserializer, Serialize, Serializer};
#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
struct SafeId {
@@ -101,16 +101,35 @@ macro_rules! impl_ids {
self.0.get_id()
}
}
+
+
+ impl Serialize for $T {
+ fn serialize(&self, serializer: S) -> Result where S: Serializer {
+ serializer.serialize_str(self.to_string().as_str())
+ }
+ }
+
+ impl<'de> Deserialize<'de> for $T {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>{
+ let s = String::deserialize(deserializer)?;
+ $T::from_string(&s).ok_or(serde::de::Error::custom("invalid string format"))
+ }
+ }
+
};
}
-#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
+
+#[derive(PartialEq, Debug, Clone)]
pub struct AccountId(SafeId);
-#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
+
+#[derive(PartialEq, Debug, Clone)]
pub struct UserId(SafeId);
-#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
+#[derive(PartialEq, Debug, Clone)]
pub struct SecurityId(SafeId);
impl_ids!(AccountId, "a");
@@ -118,7 +137,7 @@ impl_ids!(UserId, "u");
impl_ids!(SecurityId, "s");
#[derive(PartialEq, Debug)]
-pub enum ExternalId {
+pub enum ExternalId { // todo: perhaps this abstraction is useless.. duno
AccountId(AccountId),
UserId(UserId),
SecurityId(SecurityId),
diff --git a/src/db/_users.rs b/src/db/_users.rs
index 74af1bc..2759618 100644
--- a/src/db/_users.rs
+++ b/src/db/_users.rs
@@ -38,7 +38,7 @@ fn _user_from_row(row: &Row) -> Result {
})
}
-fn get_user_by_id(tx: &Transaction, id: & UserId) -> CustomResult