feat: wechat login
This commit is contained in:
1 parent
3283d94ea4
commit
3cb55e20d5
13 files changed
+181
-12
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { UserBind } from '../entity/user-bind.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
import { User } from '../entity/user.entity';
|
||||
|
||||
@Injectable()
|
||||
export class UserBindService {
|
||||
constructor(
|
||||
@InjectRepository(UserBind)
|
||||
private readonly userBindRepository: Repository<UserBind>,
|
||||
) {}
|
||||
|
||||
async findByTypeAndBindId(type: string, bindId: string) {
|
||||
return this.userBindRepository.findOne({
|
||||
where: { type, bindId },
|
||||
relations: ['user'],
|
||||
});
|
||||
}
|
||||
|
||||
async create(user: User, type: string, bindId: string) {
|
||||
const userBind = this.userBindRepository.create({
|
||||
user,
|
||||
type,
|
||||
bindId,
|
||||
});
|
||||
return this.userBindRepository.save(userBind);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user