-
Notifications
You must be signed in to change notification settings - Fork 0
/
companies.service.ts
48 lines (43 loc) 路 1.42 KB
/
companies.service.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { BaseService } from "./base.service";
import { injectable } from "inversify";
import { User, ApiResponseDto, Internship, Company, Defaults } from "thesis-dais-internship-manager-core";
/**
* The companies service
*
* @extends {BaseService}
*/
@injectable()
export class CompaniesService extends BaseService {
/**
* Return all the companies of which the given id is a owner
*
* @param {string} ownerId The owner identifier
*/
getByOwnerId(ownerId: string): Promise<ApiResponseDto<Array<Company>>> {
return this.getVerb(`${Defaults.collectionsName.companies}/getByOwnerId/${ownerId}`) as Promise<ApiResponseDto<Array<Company>>>;
}
/**
* Create a new company
*
* @param {Company} company The new company to create
*/
create(company: Company): Promise<ApiResponseDto<Company>> {
return this.postVerb(Defaults.collectionsName.companies, company.clone());
}
/**
* Return a company by id
*
* @param {string} id The company identifier
*/
getById(id: string): Promise<ApiResponseDto<Company>> {
return this.getVerb(`${Defaults.collectionsName.companies}/${id}`);
}
/**
* Update an existing company
*
* @param {Company} company The company to update
*/
update(company: Company): Promise<ApiResponseDto<Company>> {
return this.putVerb(Defaults.collectionsName.companies, company);
}
}