Skip to content

Commit

Permalink
add user to employee list
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmasken committed Feb 13, 2024
1 parent 45dfe18 commit 40f2122
Show file tree
Hide file tree
Showing 81 changed files with 1,102 additions and 203 deletions.
71 changes: 71 additions & 0 deletions .dfx/local/canisters/backend/backend.did
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ type Result =
err: text;
ok: text;
};
type Response_3 =
record {
data: opt Employee;
error_text: opt text;
status: nat16;
status_text: text;
};
type Response_2 =
record {
data: opt text;
Expand All @@ -49,6 +56,22 @@ type Response =
status: nat16;
status_text: text;
};
type Notification__1 =
record {
amount: nat;
id: nat;
isRead: bool;
receiver: text;
sender: text;
};
type Notification =
record {
amount: nat;
id: nat;
isRead: bool;
receiver: text;
sender: text;
};
type GetTransactionSuccess = record {transaction: Transaction__1;};
type GetTransactionResult =
variant {
Expand All @@ -75,6 +98,17 @@ type GetAccountIdentifierResult =
};
type GetAccountIdentifierErr = record {message: opt text;};
type GetAccountIdentifierArgs = record {"principal": principal;};
type Employee =
record {
created_at: int;
creator: principal;
email: text;
id: nat;
modified_at: int;
name: text;
phone_number: text;
wallet: text;
};
type CreateTransactionSuccess = record {transaction: Transaction__1;};
type CreateTransactionResult =
variant {
Expand Down Expand Up @@ -102,10 +136,39 @@ type CreateTransactionArgs =
destination: principal;
successful: bool;
};
type CreateNotificationSuccess = record {notification: Notification;};
type CreateNotificationResult =
variant {
err: CreateNotificationErr;
ok: CreateNotificationSuccess;
};
type CreateNotificationErr =
record {
kind: variant {
InvalidNotification;
Other;
};
message: opt text;
};
type CreateNotificationArgs =
record {
amount: nat;
isRead: bool;
receiver: text;
sender: text;
};
type CreateEmployeeArgs =
record {
email: text;
name: text;
phone_number: text;
wallet: text;
};
type Backend =
service {
accountIdentifierToBlob: (AccountIdentifier) ->
(AccountIdentifierToBlobResult);
create_employee: (CreateEmployeeArgs) -> (Response_3);
getAddress: () -> (text);
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
Expand All @@ -114,8 +177,15 @@ type Backend =
getInvoice: () -> (Account);
/// * Get latest log items. Log output is capped at 100 items.
getLogs: () -> (vec text) query;
getMyContacts: () -> (vec Employee);
getMyContactsLength: () -> (text);
getMyTransactionLength: () -> (text);
getNotifications: () -> (vec Notification__1);
getTradingAddress: () -> (text);
getTradingBalance: () -> (text);
getTransactionLength: () -> (text) query;
getUnreadNotifications: () -> (vec Notification__1);
getUnreadNotificationsLength: () -> (text);
/// * High-Level API
/// * Get the merchant's information
getUser: () -> (Response) query;
Expand All @@ -127,6 +197,7 @@ type Backend =
(GetAccountIdentifierResult) query;
get_transaction: (GetTransactionArgs) -> (GetTransactionResult) query;
get_transactions: () -> (vec Transaction) query;
save_notification: (CreateNotificationArgs) -> (CreateNotificationResult);
save_transaction: (CreateTransactionArgs) -> (CreateTransactionResult);
/// * Set the courier API key. Only the owner can set the courier API key.
setCourierApiKey: (text) -> (Response_2);
Expand Down
21 changes: 20 additions & 1 deletion .dfx/local/canisters/backend/backend.most
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@
type AssocList<K, V> = List<(K, V)>;
type AssocList__1<K, V> = AssocList<K, V>;
type Branch<K, V> = {left : Trie<K, V>; right : Trie<K, V>; size : Nat};
type Employee =
{
created_at : Int;
creator : Principal;
email : Text;
id : Nat;
modified_at : Int;
name : Text;
phone_number : Text;
wallet : Text
};
type Employee__1 = Employee;
type Hash = Nat32;
type Key__1<K> = {hash : Hash; key : K};
type Leaf<K, V> = {keyvals : AssocList__1<Key__1<K>, V>; size : Nat};
type List<T> = ?(T, List<T>);
type Notification =
{amount : Nat; id : Nat; isRead : Bool; receiver : Text; sender : Text};
type Notification__1 = Notification;
type Transaction =
{
amount : Nat;
Expand All @@ -26,10 +41,14 @@ type User =
};
type User__1 = User;
actor {
stable var contactsCounter : Nat;
stable var courierApiKey : Text;
stable var entries : [(Nat, Transaction__2)];
stable var latestTransactionIndex : Nat;
stable var notificationsCounter : Nat;
stable var notifs : [(Nat, Notification__1)];
stable var transactionCounter : Nat;
stable var userStore :
{#branch : Branch<Text, User__1>; #empty; #leaf : Leaf<Text, User__1>}
{#branch : Branch<Text, User__1>; #empty; #leaf : Leaf<Text, User__1>};
stable var users : [(Nat, Employee__1)]
};
16 changes: 15 additions & 1 deletion .dfx/local/canisters/backend/backend.old.most
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
type AssocList<K, V> = List<(K, V)>;
type AssocList__1<K, V> = AssocList<K, V>;
type Branch<K, V> = {left : Trie<K, V>; right : Trie<K, V>; size : Nat};
type Employee =
{
created_at : Int;
creator : Principal;
email : Text;
id : Nat;
modified_at : Int;
name : Text;
phone_number : Text;
wallet : Text
};
type Employee__1 = Employee;
type Hash = Nat32;
type Key__1<K> = {hash : Hash; key : K};
type Leaf<K, V> = {keyvals : AssocList__1<Key__1<K>, V>; size : Nat};
Expand All @@ -26,10 +38,12 @@ type User =
};
type User__1 = User;
actor {
stable var contactsCounter : Nat;
stable var courierApiKey : Text;
stable var entries : [(Nat, Transaction__2)];
stable var latestTransactionIndex : Nat;
stable var transactionCounter : Nat;
stable var userStore :
{#branch : Branch<Text, User__1>; #empty; #leaf : Leaf<Text, User__1>}
{#branch : Branch<Text, User__1>; #empty; #leaf : Leaf<Text, User__1>};
stable var users : [(Nat, Employee__1)]
};
Binary file modified .dfx/local/canisters/backend/backend.wasm
Binary file not shown.
71 changes: 71 additions & 0 deletions .dfx/local/canisters/backend/constructor.did
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ type Result =
err: text;
ok: text;
};
type Response_3 =
record {
data: opt Employee;
error_text: opt text;
status: nat16;
status_text: text;
};
type Response_2 =
record {
data: opt text;
Expand All @@ -49,6 +56,22 @@ type Response =
status: nat16;
status_text: text;
};
type Notification__1 =
record {
amount: nat;
id: nat;
isRead: bool;
receiver: text;
sender: text;
};
type Notification =
record {
amount: nat;
id: nat;
isRead: bool;
receiver: text;
sender: text;
};
type GetTransactionSuccess = record {transaction: Transaction__1;};
type GetTransactionResult =
variant {
Expand All @@ -75,6 +98,17 @@ type GetAccountIdentifierResult =
};
type GetAccountIdentifierErr = record {message: opt text;};
type GetAccountIdentifierArgs = record {"principal": principal;};
type Employee =
record {
created_at: int;
creator: principal;
email: text;
id: nat;
modified_at: int;
name: text;
phone_number: text;
wallet: text;
};
type CreateTransactionSuccess = record {transaction: Transaction__1;};
type CreateTransactionResult =
variant {
Expand Down Expand Up @@ -102,10 +136,39 @@ type CreateTransactionArgs =
destination: principal;
successful: bool;
};
type CreateNotificationSuccess = record {notification: Notification;};
type CreateNotificationResult =
variant {
err: CreateNotificationErr;
ok: CreateNotificationSuccess;
};
type CreateNotificationErr =
record {
kind: variant {
InvalidNotification;
Other;
};
message: opt text;
};
type CreateNotificationArgs =
record {
amount: nat;
isRead: bool;
receiver: text;
sender: text;
};
type CreateEmployeeArgs =
record {
email: text;
name: text;
phone_number: text;
wallet: text;
};
type Backend =
service {
accountIdentifierToBlob: (AccountIdentifier) ->
(AccountIdentifierToBlobResult);
create_employee: (CreateEmployeeArgs) -> (Response_3);
getAddress: () -> (text);
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
Expand All @@ -114,8 +177,15 @@ type Backend =
getInvoice: () -> (Account);
/// * Get latest log items. Log output is capped at 100 items.
getLogs: () -> (vec text) query;
getMyContacts: () -> (vec Employee);
getMyContactsLength: () -> (text);
getMyTransactionLength: () -> (text);
getNotifications: () -> (vec Notification__1);
getTradingAddress: () -> (text);
getTradingBalance: () -> (text);
getTransactionLength: () -> (text) query;
getUnreadNotifications: () -> (vec Notification__1);
getUnreadNotificationsLength: () -> (text);
/// * High-Level API
/// * Get the merchant's information
getUser: () -> (Response) query;
Expand All @@ -127,6 +197,7 @@ type Backend =
(GetAccountIdentifierResult) query;
get_transaction: (GetTransactionArgs) -> (GetTransactionResult) query;
get_transactions: () -> (vec Transaction) query;
save_notification: (CreateNotificationArgs) -> (CreateNotificationResult);
save_transaction: (CreateTransactionArgs) -> (CreateTransactionResult);
/// * Set the courier API key. Only the owner can set the courier API key.
setCourierApiKey: (text) -> (Response_2);
Expand Down
31 changes: 31 additions & 0 deletions .dfx/local/canisters/backend/constructor.old.did
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ type Result =
err: text;
ok: text;
};
type Response_3 =
record {
data: opt Employee;
error_text: opt text;
status: nat16;
status_text: text;
};
type Response_2 =
record {
data: opt text;
Expand Down Expand Up @@ -75,6 +82,17 @@ type GetAccountIdentifierResult =
};
type GetAccountIdentifierErr = record {message: opt text;};
type GetAccountIdentifierArgs = record {"principal": principal;};
type Employee =
record {
created_at: int;
creator: principal;
email: text;
id: nat;
modified_at: int;
name: text;
phone_number: text;
wallet: text;
};
type CreateTransactionSuccess = record {transaction: Transaction__1;};
type CreateTransactionResult =
variant {
Expand Down Expand Up @@ -102,6 +120,13 @@ type CreateTransactionArgs =
destination: principal;
successful: bool;
};
type CreateEmployeeArgs =
record {
email: text;
name: text;
phone_number: text;
wallet: text;
};
type AccountIdentifierToBlobSuccess = blob;
type AccountIdentifierToBlobResult =
variant {
Expand Down Expand Up @@ -130,15 +155,20 @@ type Account =
service : {
accountIdentifierToBlob: (AccountIdentifier) ->
(AccountIdentifierToBlobResult);
create_employee: (CreateEmployeeArgs) -> (Response_3);
getAddress: () -> (text);
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
getFundingAddress: () -> (text);
getFundingBalance: () -> (text);
getInvoice: () -> (Account);
getLogs: () -> (vec text) query;
getMyContacts: () -> (vec Employee);
getMyContactsLength: () -> (text);
getMyTransactionLength: () -> (text);
getTradingAddress: () -> (text);
getTradingBalance: () -> (text);
getTransactionLength: () -> (text) query;
getUser: () -> (Response) query;
getUsersList: () -> (vec record {
text;
Expand All @@ -147,6 +177,7 @@ service : {
get_account_identifier: (GetAccountIdentifierArgs) ->
(GetAccountIdentifierResult) query;
get_transaction: (GetTransactionArgs) -> (GetTransactionResult) query;
get_transactions: () -> (vec Transaction) query;
save_transaction: (CreateTransactionArgs) -> (CreateTransactionResult);
setCourierApiKey: (text) -> (Response_2);
transferFromCanistertoSubAccount: () -> (Result);
Expand Down

0 comments on commit 40f2122

Please sign in to comment.