0
0
Fork 0
This commit is contained in:
Xeltica 2020-08-04 16:43:13 +09:00
parent a0f6dabbdf
commit f06fcc2056
17 changed files with 194 additions and 25 deletions

View file

@ -1,5 +1,6 @@
import { User } from './models/entities/user';
import { Users } from './models';
import { DeepPartial } from 'typeorm';
export const getUser = (username: string, host: string): Promise<User | undefined> => {
return Users.findOne({ username, host });
@ -14,6 +15,10 @@ export const upsertUser = async (username: string, host: string, token: string):
}
};
export const updateUser = async (username: string, host: string, record: DeepPartial<User>): Promise<void> => {
await Users.update({ username, host }, record);
};
export const deleteUser = async (username: string, host: string): Promise<void> => {
await Users.delete({ username, host });
};