Skip to content
Snippets Groups Projects
Commit a9bd365f authored by Amalie Urdshals's avatar Amalie Urdshals
Browse files

Issue: Added isAdmin frontend and backend (#19)

parent 4077a245
No related branches found
No related tags found
1 merge request!25Resolve "Opprettelse av administrator tilgang"
......@@ -7,6 +7,7 @@ export class User implements Deserializable, Serializable {
private email: string;
private password: string;
private create_time: Date;
private isAdmin: number;
constructor(input: any = null) {
if (input) {
......@@ -17,11 +18,13 @@ export class User implements Deserializable, Serializable {
this.email = null;
this.password = null;
this.create_time = new Date();
this.isAdmin = 0;
}
}
deserialize(input: Object): this {
Object.assign(this, input);
console.log(this);
return this;
}
......@@ -31,7 +34,8 @@ export class User implements Deserializable, Serializable {
username: this.username,
email: this.email,
password: this.password,
create_time: this.create_time
create_time: this.create_time,
isAdmin: 0
};
}
......@@ -75,4 +79,11 @@ export class User implements Deserializable, Serializable {
this.create_time = create_time;
}
get getIsAdmin() {
return this.isAdmin;
}
set setIsAdmin(isAdmin: number) {
isAdmin = this.isAdmin;
}
}
\ No newline at end of file
......@@ -20,7 +20,8 @@ describe('UserProfileComponent', () => {
username: "tester",
email: "test@test.com",
password: "1234",
create_time: 513498
create_time: 513498,
isAdmin: 0
}));
......@@ -57,7 +58,8 @@ describe('UserProfileComponent', () => {
username: "tester",
email: "test@test.com",
password: "1234",
create_time: 513498
create_time: 513498,
isAdmin: 0
}));
});
});
......@@ -60,6 +60,7 @@ export class UserRegistrationFormComponent implements OnInit {
username: this.username,
email: this.email,
password: this.password,
isAdmin: 0,
});
// Adds user to database and redirects to the homepage afterwards
......
......@@ -40,6 +40,7 @@ describe('UserService', () => {
email: "blob@planet.us",
password: "Hyttepine",
create_time: 1613552549000,
isAdmin: 0
}]
});
});
......@@ -59,6 +60,7 @@ describe('UserService', () => {
username: "zorg",
email: "blob@planet.us",
password: "Hyttepine",
isAdmin: 0
}]
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment