-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved chared zod schemas, updated password generation for tests
- Loading branch information
1 parent
92681d5
commit 3cffcbb
Showing
13 changed files
with
112 additions
and
146 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,34 +1,14 @@ | ||
import { z } from 'zod' | ||
import { emailSchema, loginSchema, signUpSchema } from '@wallet/shared' | ||
|
||
export const signUpSchema = z.object({ | ||
body: z | ||
.object({ | ||
email: z.string().email({ message: 'Email is required' }), | ||
password: z | ||
.string() | ||
.min(6, { message: 'Password should be at least 6 characters long' }), | ||
confirmPassword: z.string() | ||
}) | ||
.superRefine(({ password, confirmPassword }, ctx) => { | ||
if (password !== confirmPassword) { | ||
ctx.addIssue({ | ||
code: 'custom', | ||
message: `Passwords do not match`, | ||
path: ['confirmPassword'] | ||
}) | ||
} | ||
}) | ||
export const signUpBodySchema = z.object({ | ||
body: signUpSchema | ||
}) | ||
|
||
export const logInSchema = z.object({ | ||
body: z.object({ | ||
email: z.string().email(), | ||
password: z.string() | ||
}) | ||
export const logInBodySchema = z.object({ | ||
body: loginSchema | ||
}) | ||
|
||
export const resendVerifyEmailSchema = z.object({ | ||
body: z.object({ | ||
email: z.string().email() | ||
}) | ||
export const emailBodySchema = z.object({ | ||
body: emailSchema | ||
}) |
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
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,4 +1,15 @@ | ||
import { z } from 'zod' | ||
|
||
export interface RatesResponse { | ||
base: string | ||
rates: Record<string, number> | ||
} | ||
|
||
export const ratesSchema = z.object({ | ||
query: z.object({ | ||
base: z | ||
.string() | ||
.length(3) | ||
.transform((v) => v.toLocaleUpperCase()) | ||
}) | ||
}) |
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