Commit 602f80dd authored by nanahira's avatar nanahira

add log for novelai

parent 0df1c6b5
Pipeline #17341 passed with stages
in 3 minutes and 33 seconds
......@@ -1792,8 +1792,14 @@ export class AppService {
where: { username: user.username },
});
if (!userInfo || userInfo.exp < config.novelaiCost) {
this.log.log(
`${user.username} has no enough exp to use novelai: ${userInfo.exp}`,
);
throw new HttpException(new CodeResponseDto(402), 402);
}
this.log.log(
`${user.username} paid ${config.novelaiCost} exp to use novelai.`,
);
await edb
.getRepository(UserInfo)
.decrement({ username: user.username }, 'exp', config.novelaiCost);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment