xxx
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import { CreateKeySystemDto } from 'src/model/dto';
|
||||
import { Cylinder, Key, User } from 'src/model/entitites';
|
||||
import { IUser } from 'src/model/interface';
|
||||
import {
|
||||
@@ -68,17 +67,6 @@ export class KeyService {
|
||||
});
|
||||
}
|
||||
|
||||
async createKeySystem(user: User, systemDTO: CreateKeySystemDto) {
|
||||
const sys = this.systemRepo.create(systemDTO);
|
||||
sys.managers = [user];
|
||||
try {
|
||||
const res = await this.systemRepo.save(sys);
|
||||
return res;
|
||||
} catch (e) {
|
||||
throw new HttpException(e.code, HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
}
|
||||
|
||||
async handoverKey(user: IUser, data: any, keyID: string) {
|
||||
const key: Key = await this.keyrepository.findOneOrFail({
|
||||
where: { id: keyID, cylinder: { system: { managers: { id: user.id } } } },
|
||||
|
||||
Reference in New Issue
Block a user