2021-11-23 16:04:12 -05:00
|
|
|
import { Injectable } from '@nestjs/common';
|
|
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
|
|
import { Repository } from 'typeorm';
|
|
|
|
import { RefreshToken } from 'server/entities/refresh_token.entity';
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class RefreshTokensService {
|
|
|
|
constructor(
|
|
|
|
@InjectRepository(RefreshToken)
|
|
|
|
private refreshTokenRespository: Repository<RefreshToken>,
|
|
|
|
) {}
|
|
|
|
|
|
|
|
create(refreshToken: RefreshToken) {
|
|
|
|
return this.refreshTokenRespository.save(refreshToken);
|
|
|
|
}
|
|
|
|
|
2021-12-06 19:57:04 -05:00
|
|
|
destroy(...refreshTokens: RefreshToken[]) {
|
|
|
|
return this.refreshTokenRespository.remove(refreshTokens);
|
2021-11-23 16:04:12 -05:00
|
|
|
}
|
|
|
|
}
|