mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-24 14:47:54 +00:00
convert project from microservices to rest apis
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export * from './user.service';
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { TuyaContext } from '@tuya/tuya-connector-nodejs';
|
||||
import { UserListDto } from '../dtos/user.list.dto';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
@Injectable()
|
||||
export class UserService {
|
||||
private tuya: TuyaContext;
|
||||
constructor(private readonly configService: ConfigService) {
|
||||
const accessKey = this.configService.get<string>('auth-config.ACCESS_KEY');
|
||||
const secretKey = this.configService.get<string>('auth-config.SECRET_KEY');
|
||||
// const clientId = this.configService.get<string>('auth-config.CLIENT_ID');
|
||||
this.tuya = new TuyaContext({
|
||||
baseUrl: 'https://openapi.tuyaeu.com',
|
||||
accessKey,
|
||||
secretKey,
|
||||
});
|
||||
}
|
||||
async userDetails(userListDto: UserListDto) {
|
||||
const path = `/v2.0/apps/${userListDto.schema}/users`;
|
||||
const data = await this.tuya.request({
|
||||
method: 'GET',
|
||||
path,
|
||||
query: userListDto,
|
||||
});
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user