Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
PSManagementUI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
PSManagementUI
Commits
39eaf4f3
Commit
39eaf4f3
authored
Aug 23, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add track service
parent
7d6a57cb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
188 additions
and
1 deletion
+188
-1
UpdateEmployeeWorkTrackRequest.ts
.../tracks/models/requests/UpdateEmployeeWorkTrackRequest.ts
+1
-0
updateStepTrack.ts
src/app/tracks/models/requests/updateStepTrack.ts
+8
-0
track.ts
src/app/tracks/models/responses/track.ts
+8
-0
track.service.ts
src/app/tracks/services/track.service.ts
+171
-1
No files found.
src/app/tracks/models/requests/UpdateEmployeeWorkTrackRequest.ts
View file @
39eaf4f3
...
@@ -10,3 +10,4 @@ export class UpdateEmployeeWorkTrackRequest {
...
@@ -10,3 +10,4 @@ export class UpdateEmployeeWorkTrackRequest {
employeeWork
:
EmployeeWork
;
employeeWork
:
EmployeeWork
;
notes
:
string
;
notes
:
string
;
}
}
src/app/tracks/models/requests/updateStepTrack.ts
0 → 100644
View file @
39eaf4f3
export
class
UpdateStepTrack
{
stepTrackId
:
number
;
trackId
:
numebr
;
stepId
:
number
;
executionState
:
String
;
trackDate
:
Date
;
trackExecutionRatio
:
number
;
}
src/app/tracks/models/responses/track.ts
View file @
39eaf4f3
import
{
TrackInfo
}
from
"../valueObjects/trackInfo"
export
class
Track
{
id
:
number
trackInfo
:
TrackInfo
notes
:
string
projectId
:
number
}
\ No newline at end of file
src/app/tracks/services/track.service.ts
View file @
39eaf4f3
import
{
HttpClient
}
from
'@angular/common/http'
;
import
{
HttpClient
}
from
'@angular/common/http'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
Observable
}
from
'rxjs'
;
import
{
ConfigurationService
}
from
'../../core/services/configuration/configuration.service'
;
import
{
Track
}
from
'../models/responses/track'
;
import
{
StepTrack
}
from
'../models/responses/steptrack'
;
import
{
UpdateStepTrack
}
from
'../models/requests/UpdateStepTrack'
;
import
{
AddEmployeeTrackRequest
}
from
'../models/requests/AddEmployeeTrackRequest'
;
import
{
AddStepTrackRequest
}
from
'../models/requests/AddStepTrackRequest'
;
import
{
CompleteTrackRequest
}
from
'../models/requests/completeTrakRequest'
;
import
{
CreateTrackRequest
}
from
'../models/requests/CreateTrackRequest'
;
import
{
GetTracksByProjectRequest
}
from
'../models/requests/GetTracksByProjectRequest'
;
import
{
RemoveTrackRequest
}
from
'../models/requests/RemoveTrackRequest'
;
import
{
UpdateEmployeeWorkTrackRequest
}
from
'../models/requests/UpdateEmployeeWorkTrackRequest'
;
@
Injectable
({
@
Injectable
({
providedIn
:
'root'
providedIn
:
'root'
})
})
export
class
TrackService
{
export
class
TrackService
{
constructor
(
private
http
:
HttpClient
)
{
}
constructor
(
private
http
:
HttpClient
,
private
config
:
ConfigurationService
)
{
}
// this method retreive the track by its id
public
getByTrackById
(
trackId
:
number
):
Observable
<
Track
>
{
return
this
.
http
.
get
<
Track
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/
${
trackId
}
}`
);
}
// this method retreive the steps track by track id
//
public
getStepsTrackById
(
trackId
:
number
):
Observable
<
StepTrack
[]
>
{
return
this
.
http
.
get
<
StepTrack
[]
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/GetStepsTrack/
${
trackId
}
}`
);
}
// this method retreive the employees track by track id
//
public
getEmployeesTrackById
(
trackId
:
number
):
Observable
<
StepTrack
[]
>
{
return
this
.
http
.
get
<
StepTrack
[]
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/GetEmployeesTrack/
${
trackId
}
}`
);
}
// this method retreive the tracks by project id
//
public
getTrackByProjectId
(
request
:
GetTracksByProjectRequest
):
Observable
<
Track
[]
>
{
let
pagination
=
this
.
getPagination
(
request
.
pageSize
,
request
.
pageNumber
);
return
this
.
http
.
get
<
Track
[]
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/GetTracksByProject/?projectId=
${
request
.
projectId
}${
pagination
}
}`
);
}
// this method add a steps tracks to a track
//
public
addStepTrack
(
request
:
AddStepTrackRequest
):
Observable
<
number
>
{
return
this
.
http
.
post
<
number
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/AddStepTrack/`
,
request
);
}
// this method add a employee tracks to a track
//
public
addEmployeeTrack
(
request
:
AddEmployeeTrackRequest
):
Observable
<
number
>
{
return
this
.
http
.
post
<
number
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/AddEmployeeTrack/`
,
request
);
}
// this method complete a track
//
public
completeTrack
(
request
:
CompleteTrackRequest
):
Observable
<
void
>
{
return
this
.
http
.
post
<
void
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/AddStepTrack/`
,
request
);
}
// this method remove a track
//
public
removeTrack
(
request
:
RemoveTrackRequest
):
Observable
<
void
>
{
return
this
.
http
.
post
<
void
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/RemoveTrack/`
,
request
);
}
// this method add a track
//
public
createTrack
(
request
:
CreateTrackRequest
):
Observable
<
Track
>
{
return
this
.
http
.
post
<
Track
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/AddStepTrack/`
,
request
);
}
// this method update the employee work
//
public
updateEmployeeWorkTrack
(
request
:
UpdateEmployeeWorkTrackRequest
):
Observable
<
void
>
{
return
this
.
http
.
put
<
void
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/UpdateEmployeeWorkTrack/`
,
request
);
}
// this method update the step track
//
public
UupdateStepTrack
(
request
:
UpdateStepTrack
):
Observable
<
void
>
{
return
this
.
http
.
put
<
void
>
(
`
${
this
.
config
.
getServerUrl
()}
/Tracks/UpdateStepTrack/`
,
request
);
}
//#region pagination convert
private
getPagination
(
pageSize
:
number
|
null
,
pageNumber
:
number
|
null
){
if
(
pageNumber
==
null
||
pageSize
==
null
){
return
""
;
}
else
{
return
`&pageSize=
${
pageSize
}
&PageNumber=
${
pageNumber
}
`
;
}
}
//#endregion pagination convert
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment