mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Improve
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { EventService } from './event.service';
|
||||
|
||||
describe('EventService', () => {
|
||||
let service: EventService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(EventService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
import { AttachmentsService } from '../attachments.service';
|
||||
import { EventsService } from '../events.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class EventService {
|
||||
|
||||
constructor(
|
||||
private eventService: EventsService,
|
||||
public p: PermissionService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
) { }
|
||||
|
||||
|
||||
create({body, calendar}) {
|
||||
|
||||
|
||||
if(this.p.userRole(['PR'])) {
|
||||
return this.eventService.postEventPr(body, calendar)
|
||||
} else {
|
||||
return this.eventService.postEventMd(body, calendar)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
addAttachment(attachment: addAttachment) {
|
||||
return this.attachmentsService.setEventAttachmentById(attachment)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user