Revision 61385
Added by Stefania Martziou over 2 years ago
repository.service.ts | ||
---|---|---|
12 | 12 |
RepositoryInterface, |
13 | 13 |
RepositorySnippet, RepositorySummaryInfo, |
14 | 14 |
Timezone, |
15 |
Typology |
|
15 |
Typology, User
|
|
16 | 16 |
} from '../domain/typeScriptClasses'; |
17 | 17 |
import { Observable, of } from 'rxjs'; |
18 | 18 |
import { timezones } from '../domain/timezones'; |
... | ... | |
28 | 28 |
|
29 | 29 |
@Injectable () |
30 | 30 |
export class RepositoryService { |
31 |
private apiUrl = environment.API_ENDPOINT + '/repository/';
|
|
31 |
private apiUrl = environment.API_ENDPOINT + '/repositories/';
|
|
32 | 32 |
private dashboardAPIUrl = environment.API_ENDPOINT + '/dashboard/'; |
33 | 33 |
|
34 | 34 |
constructor(private httpClient: HttpClient) { } |
... | ... | |
91 | 91 |
return this.httpClient.get<RepositorySnippet[]>(url, headerOptions); |
92 | 92 |
} |
93 | 93 |
|
94 |
getRepositoriesOfUser(): Observable<RepositorySnippet[]> { |
|
95 |
const url = `${this.apiUrl}getRepositoriesOfUser/0/100`;
|
|
94 |
getRepositoriesSnippetsOfUser(): Observable<RepositorySnippet[]> {
|
|
95 |
const url = `${this.apiUrl}snippets/user`;
|
|
96 | 96 |
console.log(`knocking on: ${url}`); |
97 | 97 |
return this.httpClient.get<RepositorySnippet[]>(url, headerOptions); |
98 | 98 |
} |
99 | 99 |
|
100 | 100 |
|
101 | 101 |
getRepositoryById(id: string): Observable<Repository> { |
102 |
const url = `${this.apiUrl}getRepositoryById/${id}`; |
|
102 |
const url = `${this.apiUrl}getRepositoryById/${id}`;
|
|
103 | 103 |
console.log(`knocking on: ${url}`); |
104 | 104 |
return this.httpClient.get<Repository>(url, headerOptions); |
105 | 105 |
} |
... | ... | |
144 | 144 |
} |
145 | 145 |
|
146 | 146 |
getCountries(): Observable<Country[]> { |
147 |
const url = `${this.apiUrl}getCountries`;
|
|
147 |
const url = `${this.apiUrl}countries`;
|
|
148 | 148 |
console.log(`knocking on: ${url}`); |
149 | 149 |
return this.httpClient.get<Country[]>(url, headerOptions); |
150 | 150 |
} |
... | ... | |
193 | 193 |
console.log(`knocking on: ${url}`); |
194 | 194 |
return this.httpClient.get<RepositorySummaryInfo[]>(url, headerOptions); |
195 | 195 |
} |
196 |
|
|
197 |
getRepositoryAdmins(repoId: string): Observable<User[]> { |
|
198 |
const url = `${this.apiUrl}${repoId}/admins`; |
|
199 |
console.log(`knocking on: ${url}`); |
|
200 |
return this.httpClient.get<User[]>(url, headerOptions); |
|
201 |
} |
|
202 |
|
|
203 |
deleteRepositoryAdmin(repoId: string, repoAdminEmail: string) { |
|
204 |
const url = `${this.apiUrl}${repoId}/admins/${repoAdminEmail}`; |
|
205 |
console.log(`knocking on: ${url}`); |
|
206 |
|
|
207 |
return this.httpClient.delete(url, headerOptions); |
|
208 |
} |
|
209 |
|
|
210 |
addRepositoryAdmin(repoId: string, repoAdminEmail: string) { |
|
211 |
const url = `${this.apiUrl}${repoId}/admins`; |
|
212 |
return this.httpClient.post<string>(url, repoAdminEmail, headerOptions); |
|
213 |
} |
|
196 | 214 |
} |
Also available in: Unified diff
Finished the multiuser access functionality