- Prefijo v2: MCH - TRACEABILITY-MASTER.yml creado - Listo para integracion como submodulo Workspace: v2.0.0 | SIMCO: v4.0.0
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { Repository } from 'typeorm';
|
|
import { JwtService } from '@nestjs/jwt';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { Tenant } from './entities/tenant.entity';
|
|
import { User } from './entities/user.entity';
|
|
import { RegisterDto, LoginDto } from './dto/register.dto';
|
|
export interface TokenPayload {
|
|
sub: string;
|
|
tenantId: string;
|
|
phone: string;
|
|
role: string;
|
|
}
|
|
export interface AuthResponse {
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
user: {
|
|
id: string;
|
|
name: string;
|
|
role: string;
|
|
phone: string;
|
|
};
|
|
tenant: {
|
|
id: string;
|
|
name: string;
|
|
slug: string;
|
|
businessType: string;
|
|
subscriptionStatus: string;
|
|
};
|
|
}
|
|
export declare class AuthService {
|
|
private readonly tenantRepository;
|
|
private readonly userRepository;
|
|
private readonly jwtService;
|
|
private readonly configService;
|
|
constructor(tenantRepository: Repository<Tenant>, userRepository: Repository<User>, jwtService: JwtService, configService: ConfigService);
|
|
private generateSlug;
|
|
register(dto: RegisterDto): Promise<AuthResponse>;
|
|
login(dto: LoginDto): Promise<AuthResponse>;
|
|
refreshToken(refreshToken: string): Promise<AuthResponse>;
|
|
changePin(userId: string, currentPin: string, newPin: string): Promise<void>;
|
|
private generateTokens;
|
|
}
|