Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions backend/household.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

import Member from "./Member.ts";
import User from "./User.ts";
class Household{
name: string;
members: Member[]
//creatorName: string;
//creatorBal//whatever balance the user input (ask for starting bal)

constructor(creator: User, creatorBal: number, name: string){
this.name = name;
this.members = [];
const creatorMember = new Member(creator, creatorBal, true);
this.members.push(creatorMember);
}

add_member(user : User, balance: number, admin: boolean){
if(admin == false){
const newmember = new Member(user, balance, false);
this.members.push(newmember);
}
else{
const newmember = new Member(user, balance, true);
this.members.push(newmember);
}

}
}

export default Household;
13 changes: 13 additions & 0 deletions backend/member.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import User from './user';
class Member{
name: string;
balance: number;
admin: boolean;
constructor(curr_user: User, balance: number, admin: boolean){
this.name = curr_user.username;
this.balance = balance;
this.admin = admin;
}
}

export default Member;
15 changes: 15 additions & 0 deletions backend/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

class User{
userid: string;
username: string;
email: string;
//passwordHash: string; not sure how this should be included
constructor(userid: string, username: string, email: string, passwordHash: string) {
this.userid = userid;
this.username = username;
this.email = email;
//this.passwordHash = passwordHash;
}
}

export default User;