parent
b4ebf254c8
commit
d9775c147f
5 changed files with 14 additions and 9 deletions
|
|
@ -1,13 +1,11 @@
|
|||
import { initDb } from '../db/postgre';
|
||||
import { getRepository } from 'typeorm';
|
||||
import { User } from '@/models/entities/user';
|
||||
|
||||
async function main(username: string) {
|
||||
if (!username) throw `username required`;
|
||||
username = username.replace(/^@/, '');
|
||||
|
||||
await initDb();
|
||||
const Users = getRepository(User);
|
||||
const { Users } = await import('@/models/index');
|
||||
|
||||
const res = await Users.update({
|
||||
usernameLower: username.toLowerCase(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue