-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create separate type for user data with password. password should not…
… leave server once stored
- Loading branch information
1 parent
1bb3bfa
commit e6d083d
Showing
4 changed files
with
17 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import { UserSchemaType } from "../../../shared/schemas/user.schema"; | ||
|
||
import Repository from "./Repository"; | ||
import { DbUserSchemaType } from "./auth/DbUser.type"; | ||
|
||
const USERS_DATABASE = "users"; | ||
const USERS_COLLECTION = "users_list"; | ||
|
||
export default class AuthRepository extends Repository<UserSchemaType> { | ||
insert(data: UserSchemaType & { password: string }) { | ||
export default class AuthRepository extends Repository<DbUserSchemaType> { | ||
insert(data: DbUserSchemaType & { password: string }) { | ||
return this.client.insertOne(USERS_DATABASE, USERS_COLLECTION, data); | ||
} | ||
|
||
find(filters: Partial<UserSchemaType>) { | ||
find(filters: Partial<DbUserSchemaType>) { | ||
return this.client.find(USERS_DATABASE, USERS_COLLECTION, filters); | ||
} | ||
|
||
findOne(filters: Partial<UserSchemaType>) { | ||
findOne(filters: Partial<DbUserSchemaType>) { | ||
return this.client.findOne(USERS_DATABASE, USERS_COLLECTION, filters); | ||
} | ||
|
||
has(filters: Partial<UserSchemaType>) { | ||
has(filters: Partial<DbUserSchemaType>) { | ||
return this.client.has(USERS_DATABASE, USERS_COLLECTION, filters); | ||
} | ||
update(filters: Partial<UserSchemaType>, data: UserSchemaType) { | ||
update(filters: Partial<DbUserSchemaType>, data: DbUserSchemaType) { | ||
return this.client.updateOne( | ||
USERS_DATABASE, | ||
USERS_COLLECTION, | ||
filters, | ||
data | ||
); | ||
} | ||
delete(filters: Partial<UserSchemaType>) { | ||
delete(filters: Partial<DbUserSchemaType>) { | ||
return this.client.deleteOne(USERS_DATABASE, USERS_COLLECTION, filters); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { UserSchemaType } from "../../../../shared/schemas/user.schema"; | ||
|
||
export type DbUserSchemaType = UserSchemaType & { password: string }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters