Skip to content

Commit

Permalink
refactor to remove reduddant code
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmasken committed Jun 10, 2024
1 parent dfbc082 commit 9085143
Show file tree
Hide file tree
Showing 162 changed files with 2,160 additions and 2,042 deletions.
11 changes: 4 additions & 7 deletions .dfx/local/canister_ids.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"__Candid_UI": {
"local": "br5f7-7uaaa-aaaaa-qaaca-cai"
"local": "be2us-64aaa-aaaaa-qaabq-cai"
},
"assets": {
"local": "b77ix-eeaaa-aaaaa-qaada-cai"
"local": "bw4dl-smaaa-aaaaa-qaacq-cai"
},
"backend": {
"local": "bd3sg-teaaa-aaaaa-qaaba-cai"
Expand All @@ -12,12 +12,9 @@
"local": "bkyz2-fmaaa-aaaaa-qaaaq-cai"
},
"icrc1_index": {
"local": "bw4dl-smaaa-aaaaa-qaacq-cai"
},
"image_tank": {
"local": "be2us-64aaa-aaaaa-qaabq-cai"
"local": "br5f7-7uaaa-aaaaa-qaaca-cai"
},
"internet_identity": {
"local": "by6od-j4aaa-aaaaa-qaadq-cai"
"local": "b77ix-eeaaa-aaaaa-qaada-cai"
}
}
15 changes: 3 additions & 12 deletions .dfx/local/canisters/backend/backend.did
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,6 @@ type Response =
status: nat16;
status_text: text;
};
type Permissions =
record {
canAdd: bool;
canDelete: bool;
canEdit: bool;
canPay: bool;
canUpdate: bool;
canView: bool;
};
type PayslipData =
record {
department: text;
Expand Down Expand Up @@ -281,7 +272,6 @@ type Emp =
joining_date: text;
last_name: text;
organization: text;
permissions: opt Permissions;
phone_number: text;
role: text;
};
Expand Down Expand Up @@ -402,6 +392,7 @@ type Backend =
create_organization: (CreateOrganizationArgs) -> (Response_8);
emailExists: (text) -> (bool) query;
generatePayslip: (nat) -> (Response_7);
generateUUID: () -> (text);
getAddress: () -> (text);
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
Expand Down Expand Up @@ -452,7 +443,7 @@ type Backend =
save_notification: (CreateNotificationArgs) -> (CreateNotificationResult);
save_payroll: (SchedulePaymentsArgs) -> (SchedulePaymentsResult);
save_transaction: (CreateTransactionArgs) -> (CreateTransactionResult);
sendToOwner: (nat, text) -> (Result);
sendToOwner: (nat, text) -> (Response_1);
send_notifications: (text, text, text, text, text) -> ();
/// * Set the courier API key. Only the owner can set the courier API key.
setCourierApiKey: (text) -> (Response_2);
Expand All @@ -470,4 +461,4 @@ type Account =
owner: principal;
subaccount: opt Subaccount;
};
service : (nat) -> Backend
service : () -> Backend
10 changes: 0 additions & 10 deletions .dfx/local/canisters/backend/backend.most
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type Emp =
joining_date : Text;
last_name : Text;
organization : Text;
permissions : ?Permissions;
phone_number : Text;
role : Text
};
Expand Down Expand Up @@ -74,15 +73,6 @@ type PayrollType =
successful : Bool
};
type PayrollType__1 = PayrollType;
type Permissions =
{
canAdd : Bool;
canDelete : Bool;
canEdit : Bool;
canPay : Bool;
canUpdate : Bool;
canView : Bool
};
type Transaction =
{
amount : Nat;
Expand Down
Binary file modified .dfx/local/canisters/backend/backend.wasm
Binary file not shown.
15 changes: 3 additions & 12 deletions .dfx/local/canisters/backend/constructor.did
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,6 @@ type Response =
status: nat16;
status_text: text;
};
type Permissions =
record {
canAdd: bool;
canDelete: bool;
canEdit: bool;
canPay: bool;
canUpdate: bool;
canView: bool;
};
type PayslipData =
record {
department: text;
Expand Down Expand Up @@ -281,7 +272,6 @@ type Emp =
joining_date: text;
last_name: text;
organization: text;
permissions: opt Permissions;
phone_number: text;
role: text;
};
Expand Down Expand Up @@ -402,6 +392,7 @@ type Backend =
create_organization: (CreateOrganizationArgs) -> (Response_8);
emailExists: (text) -> (bool) query;
generatePayslip: (nat) -> (Response_7);
generateUUID: () -> (text);
getAddress: () -> (text);
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
Expand Down Expand Up @@ -452,7 +443,7 @@ type Backend =
save_notification: (CreateNotificationArgs) -> (CreateNotificationResult);
save_payroll: (SchedulePaymentsArgs) -> (SchedulePaymentsResult);
save_transaction: (CreateTransactionArgs) -> (CreateTransactionResult);
sendToOwner: (nat, text) -> (Result);
sendToOwner: (nat, text) -> (Response_1);
send_notifications: (text, text, text, text, text) -> ();
/// * Set the courier API key. Only the owner can set the courier API key.
setCourierApiKey: (text) -> (Response_2);
Expand All @@ -470,4 +461,4 @@ type Account =
owner: principal;
subaccount: opt Subaccount;
};
service : (nat) -> Backend
service : () -> Backend
3 changes: 2 additions & 1 deletion .dfx/local/canisters/backend/constructor.old.did
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ service : {
create_organization: (CreateOrganizationArgs) -> (Response_8);
emailExists: (text) -> (bool) query;
generatePayslip: (nat) -> (Response_7);
generateUUID: () -> (text);
getAddress: () -> (text);
getCanisterAddress: () -> (text);
getCanisterBalance: () -> (text);
Expand Down Expand Up @@ -452,7 +453,7 @@ service : {
save_notification: (CreateNotificationArgs) -> (CreateNotificationResult);
save_payroll: (SchedulePaymentsArgs) -> (SchedulePaymentsResult);
save_transaction: (CreateTransactionArgs) -> (CreateTransactionResult);
sendToOwner: (nat, text) -> (Result);
sendToOwner: (nat, text) -> (Response_1);
send_notifications: (text, text, text, text, text) -> ();
setCourierApiKey: (text) -> (Response_2);
setRecurringTimer: (nat) -> (nat);
Expand Down
2 changes: 1 addition & 1 deletion .dfx/local/canisters/backend/init_args.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(nat)
()
12 changes: 2 additions & 10 deletions .dfx/local/canisters/backend/service.did
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Backend = service {
create_organization : (CreateOrganizationArgs) -> (Response_8);
emailExists : (text) -> (bool) query;
generatePayslip : (nat) -> (Response_7);
generateUUID : () -> (text);
getAddress : () -> (text);
getCanisterAddress : () -> (text);
getCanisterBalance : () -> (text);
Expand Down Expand Up @@ -50,7 +51,7 @@ type Backend = service {
save_notification : (CreateNotificationArgs) -> (CreateNotificationResult);
save_payroll : (SchedulePaymentsArgs) -> (SchedulePaymentsResult);
save_transaction : (CreateTransactionArgs) -> (CreateTransactionResult);
sendToOwner : (nat, text) -> (Result);
sendToOwner : (nat, text) -> (Response_1);
send_notifications : (text, text, text, text, text) -> ();
setCourierApiKey : (text) -> (Response_2);
setRecurringTimer : (nat) -> (nat);
Expand Down Expand Up @@ -134,7 +135,6 @@ type Designation = record { creator : principal; code : text; name : text };
type Emp = record {
disability : bool;
email_address : text;
permissions : opt Permissions;
creator : principal;
joining_date : text;
gross_salary : text;
Expand Down Expand Up @@ -237,14 +237,6 @@ type PayslipData = record {
other_deductions : nat;
housing : nat;
};
type Permissions = record {
canEdit : bool;
canView : bool;
canAdd : bool;
canPay : bool;
canDelete : bool;
canUpdate : bool;
};
type Response = record {
status : nat16;
data : opt User;
Expand Down
12 changes: 2 additions & 10 deletions .dfx/local/canisters/backend/service.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface Backend {
'create_organization' : ActorMethod<[CreateOrganizationArgs], Response_8>,
'emailExists' : ActorMethod<[string], boolean>,
'generatePayslip' : ActorMethod<[bigint], Response_7>,
'generateUUID' : ActorMethod<[], string>,
'getAddress' : ActorMethod<[], string>,
'getCanisterAddress' : ActorMethod<[], string>,
'getCanisterBalance' : ActorMethod<[], string>,
Expand Down Expand Up @@ -63,7 +64,7 @@ export interface Backend {
[CreateTransactionArgs],
CreateTransactionResult
>,
'sendToOwner' : ActorMethod<[bigint, string], Result>,
'sendToOwner' : ActorMethod<[bigint, string], Response_1>,
'send_notifications' : ActorMethod<
[string, string, string, string, string],
undefined
Expand Down Expand Up @@ -156,7 +157,6 @@ export interface Designation {
export interface Emp {
'disability' : boolean,
'email_address' : string,
'permissions' : [] | [Permissions],
'creator' : Principal,
'joining_date' : string,
'gross_salary' : string,
Expand Down Expand Up @@ -264,14 +264,6 @@ export interface PayslipData {
'other_deductions' : bigint,
'housing' : bigint,
}
export interface Permissions {
'canEdit' : boolean,
'canView' : boolean,
'canAdd' : boolean,
'canPay' : boolean,
'canDelete' : boolean,
'canUpdate' : boolean,
}
export interface Response {
'status' : number,
'data' : [] | [User],
Expand Down
20 changes: 6 additions & 14 deletions .dfx/local/canisters/backend/service.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,9 @@ export const idlFactory = ({ IDL }) => {
'phone_number' : IDL.Text,
'department' : IDL.Text,
});
const Permissions = IDL.Record({
'canEdit' : IDL.Bool,
'canView' : IDL.Bool,
'canAdd' : IDL.Bool,
'canPay' : IDL.Bool,
'canDelete' : IDL.Bool,
'canUpdate' : IDL.Bool,
});
const Emp = IDL.Record({
'disability' : IDL.Bool,
'email_address' : IDL.Text,
'permissions' : IDL.Opt(Permissions),
'creator' : IDL.Principal,
'joining_date' : IDL.Text,
'gross_salary' : IDL.Text,
Expand Down Expand Up @@ -319,15 +310,15 @@ export const idlFactory = ({ IDL }) => {
'ok' : CreateTransactionSuccess,
'err' : CreateTransactionErr,
});
const Response_2 = IDL.Record({
const Response_1 = IDL.Record({
'status' : IDL.Nat16,
'data' : IDL.Opt(IDL.Text),
'data' : IDL.Opt(Transaction),
'status_text' : IDL.Text,
'error_text' : IDL.Opt(IDL.Text),
});
const Response_1 = IDL.Record({
const Response_2 = IDL.Record({
'status' : IDL.Nat16,
'data' : IDL.Opt(Transaction),
'data' : IDL.Opt(IDL.Text),
'status_text' : IDL.Text,
'error_text' : IDL.Opt(IDL.Text),
});
Expand Down Expand Up @@ -361,6 +352,7 @@ export const idlFactory = ({ IDL }) => {
),
'emailExists' : IDL.Func([IDL.Text], [IDL.Bool], ['query']),
'generatePayslip' : IDL.Func([IDL.Nat], [Response_7], []),
'generateUUID' : IDL.Func([], [IDL.Text], []),
'getAddress' : IDL.Func([], [IDL.Text], []),
'getCanisterAddress' : IDL.Func([], [IDL.Text], []),
'getCanisterBalance' : IDL.Func([], [IDL.Text], []),
Expand Down Expand Up @@ -425,7 +417,7 @@ export const idlFactory = ({ IDL }) => {
[CreateTransactionResult],
[],
),
'sendToOwner' : IDL.Func([IDL.Nat, IDL.Text], [Result], []),
'sendToOwner' : IDL.Func([IDL.Nat, IDL.Text], [Response_1], []),
'send_notifications' : IDL.Func(
[IDL.Text, IDL.Text, IDL.Text, IDL.Text, IDL.Text],
[],
Expand Down
Loading

0 comments on commit 9085143

Please sign in to comment.