From feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 11 Dec 2016 21:50:51 +0100 Subject: First version with PostgreSQL --- client/src/app/shared/auth/auth-user.model.ts | 9 +++------ client/src/app/shared/search/search-field.type.ts | 2 +- client/src/app/shared/search/search.component.ts | 4 ++-- client/src/app/shared/users/user.model.ts | 10 +++++----- 4 files changed, 11 insertions(+), 14 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/auth/auth-user.model.ts b/client/src/app/shared/auth/auth-user.model.ts index bdd5ea5a9..f560351f4 100644 --- a/client/src/app/shared/auth/auth-user.model.ts +++ b/client/src/app/shared/auth/auth-user.model.ts @@ -7,9 +7,6 @@ export class AuthUser extends User { USERNAME: 'username' }; - id: string; - role: string; - username: string; tokens: Tokens; static load() { @@ -17,7 +14,7 @@ export class AuthUser extends User { if (usernameLocalStorage) { return new AuthUser( { - id: localStorage.getItem(this.KEYS.ID), + id: parseInt(localStorage.getItem(this.KEYS.ID)), username: localStorage.getItem(this.KEYS.USERNAME), role: localStorage.getItem(this.KEYS.ROLE) }, @@ -35,7 +32,7 @@ export class AuthUser extends User { Tokens.flush(); } - constructor(userHash: { id: string, username: string, role: string }, hashTokens: any) { + constructor(userHash: { id: number, username: string, role: string }, hashTokens: any) { super(userHash); this.tokens = new Tokens(hashTokens); } @@ -58,7 +55,7 @@ export class AuthUser extends User { } save() { - localStorage.setItem(AuthUser.KEYS.ID, this.id); + localStorage.setItem(AuthUser.KEYS.ID, this.id.toString()); localStorage.setItem(AuthUser.KEYS.USERNAME, this.username); localStorage.setItem(AuthUser.KEYS.ROLE, this.role); this.tokens.save(); diff --git a/client/src/app/shared/search/search-field.type.ts b/client/src/app/shared/search/search-field.type.ts index 5228ee68a..6be584ed1 100644 --- a/client/src/app/shared/search/search-field.type.ts +++ b/client/src/app/shared/search/search-field.type.ts @@ -1 +1 @@ -export type SearchField = "name" | "author" | "podUrl" | "magnetUri" | "tags"; +export type SearchField = "name" | "author" | "host" | "magnetUri" | "tags"; diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts index b6237469b..9f7e156ec 100644 --- a/client/src/app/shared/search/search.component.ts +++ b/client/src/app/shared/search/search.component.ts @@ -14,8 +14,8 @@ export class SearchComponent implements OnInit { fieldChoices = { name: 'Name', author: 'Author', - podUrl: 'Pod Url', - magnetUri: 'Magnet Uri', + host: 'Pod Host', + magnetUri: 'Magnet URI', tags: 'Tags' }; searchCriterias: Search = { diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index 726495d11..52d89e004 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts @@ -1,16 +1,16 @@ export class User { - id: string; + id: number; username: string; role: string; - createdDate: Date; + createdAt: Date; - constructor(hash: { id: string, username: string, role: string, createdDate?: Date }) { + constructor(hash: { id: number, username: string, role: string, createdAt?: Date }) { this.id = hash.id; this.username = hash.username; this.role = hash.role; - if (hash.createdDate) { - this.createdDate = hash.createdDate; + if (hash.createdAt) { + this.createdAt = hash.createdAt; } } -- cgit v1.2.3