Skip to content

Commit 188b95a

Browse files
committed
Fix types
1 parent 26ae737 commit 188b95a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

server/src/methods/updateProfile.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ export const handler = async (input: Input, context: HandlerContext): Promise<St
3232

3333
let props: DbNewUser = {}
3434
if ("firstName" in input) {
35-
if (input.firstName.length < 1) {
35+
if (input.firstName && input.firstName.length < 1) {
3636
throw new InlineError(InlineError.ApiError.FIRST_NAME_INVALID)
3737
}
3838
props.firstName = input.firstName ?? null
3939
}
4040
if ("lastName" in input) props.lastName = input.lastName ?? null
4141
if ("username" in input) {
42-
if (input.username.length < 2) {
42+
if (input.username && input.username.length < 2) {
4343
throw new InlineError(InlineError.ApiError.USERNAME_INVALID)
4444
}
4545
props.username = input.username ?? null

server/src/realtime/handlers/_rpc.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const handleRpcCall = async (call: RpcCall, handlerContext: HandlerContex
1616

1717
switch (call.method) {
1818
case Method.GET_ME: {
19-
let result = await getMe(call.params, handlerContext)
19+
let result = await getMe(call.input, handlerContext)
2020
return { oneofKind: "getMe", getMe: result }
2121
}
2222

server/src/realtime/handlers/getMe.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { UsersModel } from "@in/server/db/models/users"
22
import type { GetMeInput, GetMeResult } from "@in/server/protocol/core"
33
import type { HandlerContext } from "@in/server/realtime/types"
44

5-
export const getMe = async (params: GetMeInput, handlerContext: HandlerContext): Promise<GetMeResult> => {
5+
export const getMe = async (input: GetMeInput, handlerContext: HandlerContext): Promise<GetMeResult> => {
66
let user = await UsersModel.getUserById(handlerContext.userId)
77

88
if (!user) {

0 commit comments

Comments
 (0)