Skip to content

Commit

Permalink
fix(build): resolve all typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hudy9x committed Dec 18, 2023
1 parent 3bb81e4 commit b75a922
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
4 changes: 1 addition & 3 deletions packages/shared-models/src/lib/projectPin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const _getPinnedProjectList = async (
uid: string
): Promise<PinnedProjectSetting[]> => {
const user = await mdUserFindFirst({
where: {
id: uid
}
id: uid
})

if (!user) return []
Expand Down
21 changes: 20 additions & 1 deletion packages/shared-models/src/lib/taskAutomation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,27 @@ export const mdAutomationGet = async (projectId: string) => {
}

export const mdAutomationPost = async (data: Omit<TaskAutomation, 'id'>) => {
const {
organizationId,
projectId,
when,
then,
createdAt,
createdBy,
updatedAt,
updatedBy
} = data
return taskAutomation.create({
data
data: {
organizationId,
projectId,
when: when || {},
then: then || {},
createdAt,
createdBy,
updatedAt,
updatedBy
}
})
}

Expand Down
13 changes: 10 additions & 3 deletions packages/shared-models/src/lib/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ export const mdUserFindEmail = async (email: string) => {
})
}

export const mdUserFindFirst = async cond => {
return userModel.findFirst(cond)
export const mdUserFindFirst = async (cond: { id: string }) => {
return userModel.findFirst({
where: cond
})
}

export const mdUserAdd = async (data: Omit<User, 'id'>) => {
Expand All @@ -18,7 +20,10 @@ export const mdUserAdd = async (data: Omit<User, 'id'>) => {
})
}

export const mdUserUpdate = async (id: string, data: Partial<Omit<User, 'id'>>) => {
export const mdUserUpdate = async (
id: string,
data: Partial<Omit<User, 'id'>>
) => {
return userModel.update({
where: { id },
data
Expand All @@ -30,6 +35,8 @@ export const mdUserUpdateSetting = async (id: string, data: UserSetting) => {
where: { id }
})

if (!user) return null

const settings = user.settings as UserSetting
return userModel.update({
where: { id },
Expand Down

0 comments on commit b75a922

Please sign in to comment.