-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OV-3: add sign up flow #30
Merged
Merged
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
c51398a
OV-3: + name column to users table, with mods into model and user ser…
JPjok3r 9a3a62b
OV-3: * user repository, validations from shared
JPjok3r b881101
OV-3: - name from existing migration file, + name to users table in d…
JPjok3r 09d597d
OV-3: - lint and prettier errors
JPjok3r b4dfe2b
OV-3: * fix lint errors, * drop field and not table in last migration…
JPjok3r eca26b8
OV-3: * user validation messages and user validation schema
JPjok3r 6fe3503
OV-3: * changing name to fullName
JPjok3r 53c0a6a
OV-3: * applying lint format
JPjok3r 56d664e
OV-3: * validation rules
JPjok3r 25d2f9e
OV-3: * validation messages
JPjok3r 58895f3
OV-3: * validation messages
JPjok3r 375b4f0
OV-3: * lint format
JPjok3r de12058
OV-3: * fullName in auth controller
JPjok3r a628e34
OV-3: * solve merge conficts
JPjok3r 82d819d
OV-3: * validations
JPjok3r bef91bb
OV-3: * merge conflicts
JPjok3r 3a962ad
OV-3: * solve merge conficts
JPjok3r 0584350
Merge remote-tracking branch 'origin/next' into task/OV-3-add-sign-up…
JPjok3r 59e9a0a
OV-3: - merge conflict solved
JPjok3r 0bdf6b5
OV-3: * lint and prettier
JPjok3r afaea06
OV-3: * name to fullName
JPjok3r 2ab3912
OV-3: * name to fullName
JPjok3r d3ac3eb
OV-3: * name to fullName
JPjok3r b5cdb0d
Merge branch 'origin/next' into task/OV-3-add-sign-up-flow
JPjok3r b8c0ee2
OV-3: * name to fullName, solve merge conflicts
JPjok3r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -5,58 +5,69 @@ class UserEntity implements Entity { | |
|
||
private 'email': string; | ||
|
||
private 'name': string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in design looks like we have Full Name |
||
|
||
private 'passwordHash': string; | ||
|
||
private 'passwordSalt': string; | ||
|
||
private constructor({ | ||
id, | ||
email, | ||
name, | ||
passwordHash, | ||
passwordSalt, | ||
}: { | ||
id: number | null; | ||
email: string; | ||
name: string; | ||
passwordHash: string; | ||
passwordSalt: string; | ||
}) { | ||
this.id = id; | ||
this.email = email; | ||
this.name = name; | ||
this.passwordHash = passwordHash; | ||
this.passwordSalt = passwordSalt; | ||
} | ||
|
||
public static initialize({ | ||
id, | ||
email, | ||
name, | ||
passwordHash, | ||
passwordSalt, | ||
}: { | ||
id: number; | ||
email: string; | ||
name: string; | ||
passwordHash: string; | ||
passwordSalt: string; | ||
}): UserEntity { | ||
return new UserEntity({ | ||
id, | ||
email, | ||
name, | ||
passwordHash, | ||
passwordSalt, | ||
}); | ||
} | ||
|
||
public static initializeNew({ | ||
email, | ||
name, | ||
passwordHash, | ||
passwordSalt, | ||
}: { | ||
email: string; | ||
name: string; | ||
passwordHash: string; | ||
passwordSalt: string; | ||
}): UserEntity { | ||
return new UserEntity({ | ||
id: null, | ||
email, | ||
name, | ||
passwordHash, | ||
passwordSalt, | ||
}); | ||
|
@@ -65,20 +76,24 @@ class UserEntity implements Entity { | |
public toObject(): { | ||
id: number; | ||
email: string; | ||
name: string; | ||
} { | ||
return { | ||
id: this.id as number, | ||
email: this.email, | ||
name: this.name, | ||
}; | ||
} | ||
|
||
public toNewObject(): { | ||
email: string; | ||
name: string; | ||
passwordHash: string; | ||
passwordSalt: string; | ||
} { | ||
return { | ||
email: this.email, | ||
name: this.name, | ||
passwordHash: this.passwordHash, | ||
passwordSalt: this.passwordSalt, | ||
}; | ||
|
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
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
17 changes: 17 additions & 0 deletions
17
backend/src/migrations/20240820093010_add_name_field_to_users_table.ts
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,17 @@ | ||
import { type Knex } from 'knex'; | ||
|
||
const TABLE_NAME = 'users'; | ||
|
||
async function up(knex: Knex): Promise<void> { | ||
await knex.schema.table(TABLE_NAME, (table) => { | ||
table.string('name').notNullable(); | ||
}); | ||
} | ||
|
||
async function down(knex: Knex): Promise<void> { | ||
await knex.schema.table(TABLE_NAME, (table) => { | ||
table.dropColumn('name'); | ||
}); | ||
} | ||
|
||
export { down, up }; |
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
1 change: 1 addition & 0 deletions
1
shared/src/bundles/users/types/user-sign-up-response-dto.type.ts
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,5 +1,6 @@ | ||
type UserSignUpResponseDto = { | ||
id: number; | ||
name: string; | ||
email: 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also change it to full name here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Anton, it's done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like not resolved