-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: trim all name use for entity creation
- Loading branch information
Showing
6 changed files
with
19 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,8 +1,8 @@ | ||
import type { UserCreateInput } from '@shelve/types' | ||
import type { CreateUserInput } from '@shelve/types' | ||
import { H3Event } from 'h3' | ||
import { upsertUser } from '~/server/app/userService' | ||
|
||
export default eventHandler(async (event: H3Event) => { | ||
const body = await readBody(event) as UserCreateInput | ||
const body = await readBody(event) as CreateUserInput | ||
return await upsertUser(body) | ||
}) |
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,8 +1,10 @@ | ||
import { H3Event } from 'h3' | ||
import { CreateTeamInput } from '@shelve/types' | ||
import { createTeam } from '~/server/app/teamsService' | ||
|
||
export default eventHandler(async (event: H3Event) => { | ||
const user = event.context.user | ||
const createTeamInput = await readBody(event) | ||
const createTeamInput = await readBody(event) as CreateTeamInput | ||
createTeamInput.name = createTeamInput.name.trim() | ||
return await createTeam(createTeamInput, user.id) | ||
}) |
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,9 +1,12 @@ | ||
import { H3Event } from 'h3' | ||
import { UpdateUserInput } from '@shelve/types' | ||
import { updateUser } from '~/server/app/userService' | ||
|
||
export default eventHandler(async (event: H3Event) => { | ||
const user = event.context.user | ||
const authToken = event.context.authToken | ||
const updateUserInput = await readBody(event) | ||
const updateUserInput = await readBody(event) as UpdateUserInput | ||
updateUserInput.username = updateUserInput.username?.trim() | ||
updateUserInput.email = updateUserInput.email?.trim() | ||
return await updateUser(user, updateUserInput, authToken) | ||
}) |
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