mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
36 lines
836 B
TypeScript
36 lines
836 B
TypeScript
import { DeepPartial } from 'typeorm'
|
|
import { UserPersonalization } from '../entity/user_personalization'
|
|
import { authTrx } from '../repository'
|
|
|
|
export const findUserPersonalization = async (id: string, userId: string) => {
|
|
return authTrx(
|
|
(t) =>
|
|
t.getRepository(UserPersonalization).findOneBy({
|
|
id,
|
|
}),
|
|
undefined,
|
|
userId
|
|
)
|
|
}
|
|
|
|
export const deleteUserPersonalization = async (id: string, userId: string) => {
|
|
return authTrx(
|
|
(t) =>
|
|
t.getRepository(UserPersonalization).delete({
|
|
id,
|
|
}),
|
|
undefined,
|
|
userId
|
|
)
|
|
}
|
|
|
|
export const saveUserPersonalization = async (
|
|
userId: string,
|
|
userPersonalization: DeepPartial<UserPersonalization>
|
|
) => {
|
|
return authTrx(
|
|
(t) => t.getRepository(UserPersonalization).save(userPersonalization),
|
|
undefined,
|
|
userId
|
|
)
|
|
}
|