d13100ebf3
Update draft releases / main (push) Has been cancelled
Build and push docs image / build-image (push) Has been cancelled
Build Web Application / build-web (macos-latest) (push) Has been cancelled
Build Web Application / build-web (ubuntu-latest) (push) Has been cancelled
Python Code Quality Checks / build (push) Has been cancelled
Test Python / test-python (macos-latest, 3.10) (push) Has been cancelled
Test Python / test-python (macos-latest, 3.11) (push) Has been cancelled
Test Python / test-python (ubuntu-latest, 3.10) (push) Has been cancelled
Test Python / test-python (ubuntu-latest, 3.11) (push) Has been cancelled
27 lines
762 B
TypeScript
27 lines
762 B
TypeScript
import { connection } from '@/lib/dto/connect';
|
|
import UserDTO, { UserModel } from '@/lib/dto/models/user.dto';
|
|
|
|
export default async function getUserInfo(data: Omit<UserModel, 'id'>) {
|
|
const { out_user_no, user_channel, avatar_url, nick_name, email, phone } = data;
|
|
if (!out_user_no || !user_channel) return null;
|
|
try {
|
|
await connection();
|
|
const userInfo = await UserDTO.findOne({ where: { out_user_no, user_channel } });
|
|
if (userInfo) {
|
|
return userInfo.toJSON();
|
|
}
|
|
const instance = await UserDTO.create({
|
|
out_user_no,
|
|
user_channel,
|
|
nick_name,
|
|
avatar_url,
|
|
email,
|
|
phone,
|
|
});
|
|
return instance.toJSON();
|
|
} catch (e) {
|
|
console.log('[GET USERINFO ERROR]: ', e);
|
|
return null;
|
|
}
|
|
}
|