docs
This commit is contained in:
@@ -13,7 +13,6 @@ export class SystemService {
|
||||
constructor(
|
||||
private systemRepo: KeySystemRepository,
|
||||
private userRepo: UserRepository,
|
||||
// private systemActivityRepo: ActivityRepository,
|
||||
private mailService: MailService,
|
||||
private readonly configService: ConfigService,
|
||||
private readonly activityService: ActivityHelperService
|
||||
@@ -66,7 +65,6 @@ export class SystemService {
|
||||
return this.systemRepo.findOne({ where: { id: id } });
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
async update(user: User, updateSystemDto: UpdateSystemDto) {
|
||||
if (!user || !user.id || !updateSystemDto.id) { throw new HttpException('forbidden', HttpStatus.FORBIDDEN); }
|
||||
const system = await this.systemRepo.findOne({ where: { id: updateSystemDto.id, managers: { id: user.id } }, withDeleted: true });
|
||||
|
||||
@@ -130,7 +130,7 @@ export class ActivityHelperService {
|
||||
async logCylinderRestored(user: User, cylinder: Cylinder) {
|
||||
let msg = `Zylinder ${cylinder.name} wiederhergestellt`;
|
||||
|
||||
const system: KeySystem = await this.helper.getSystemOCylinder(cylinder);
|
||||
const system: KeySystem = await this.helper.getSystemOfCylinder(cylinder);
|
||||
|
||||
this.activityRepo.save(
|
||||
this.activityRepo.create({
|
||||
@@ -142,7 +142,7 @@ export class ActivityHelperService {
|
||||
|
||||
async logCylinderCreated(user: User, cylinder: Cylinder) {
|
||||
const msg = `Zylinder ${cylinder.name} angelegt`;
|
||||
const system: KeySystem = await this.helper.getSystemOCylinder(cylinder);
|
||||
const system: KeySystem = await this.helper.getSystemOfCylinder(cylinder);
|
||||
this.activityRepo.save(
|
||||
this.activityRepo.create({
|
||||
system,
|
||||
@@ -154,7 +154,7 @@ export class ActivityHelperService {
|
||||
async logCylinderDeleted(user: User, cylinder: Cylinder) {
|
||||
let msg = `Zylinder ${cylinder.name} gelöscht`;
|
||||
|
||||
const system: KeySystem = await this.helper.getSystemOCylinder(cylinder);
|
||||
const system: KeySystem = await this.helper.getSystemOfCylinder(cylinder);
|
||||
|
||||
this.activityRepo.save(
|
||||
this.activityRepo.create({
|
||||
|
||||
@@ -39,6 +39,11 @@ export class HelperService {
|
||||
return keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sucht das System eines Schlüssels und gibt es als Promise zurück
|
||||
* @param key key
|
||||
* @returns system: KeySystem
|
||||
*/
|
||||
async getSystemOfKey(key: Key): Promise<KeySystem> {
|
||||
const k = await this.keyRepo.findOne({
|
||||
where: { id: key.id },
|
||||
@@ -50,7 +55,12 @@ export class HelperService {
|
||||
return found.system;
|
||||
}
|
||||
|
||||
async getSystemOCylinder(cylinder: Cylinder): Promise<KeySystem> {
|
||||
/**
|
||||
* Gibt das System eines Zylinders und gibt es als Promise zurück
|
||||
* @param cylinder Zylinder
|
||||
* @returns Promise<KeySystem>
|
||||
*/
|
||||
async getSystemOfCylinder(cylinder: Cylinder): Promise<KeySystem> {
|
||||
const k = await this.cylinderRepository.findOne({
|
||||
where: { id: cylinder.id },
|
||||
relations: ['system'],
|
||||
|
||||
Reference in New Issue
Block a user