You are on page 1of 6

source:

http://api.suleschool.com/api/
1. /login
$http.defaults.headers.common['Authorization'] =
'Basic ' + encode(user.name + ":" + user.pass);
$http({
method: "get",
url: source + "login"
})

public class UserModel


{
public int id { get; set; }
public string userName { get; set; }
public string fullName { get; set; }
public int roleId { get; set; }
public string role { get; set; }
public int teamId { get; set; }
public string team { get; set; }
}

2. /annual/{year}
Header {
year: int,
itemList: [
{
person: string,
totalHours: string
}
]
}
Year is optional default value is currentYear in web.config
Format for totalHours: ##9.9 [converted in backend]
Last row is TOTAL row for entire company with sum of montly hours

3. /month/{year}/{month}
{
year: int,
month: int,
people: [
{
person: string,
totalHours: string,
ptoDays: string,
projects: [
project: string,
hours: string
]
}
]
}
Year is optional default value is currentYear in web.config
Month is optional default value is currentMonth (calendar)
Format for all numbers: #,##9.9 [converted in backend]
First row is TOTAL for entire company with sum for all projects

4. /personal/{userId}/{year}/{month}
{
personId: int,
person: string,
year: int,
month: int,
totalHours: string,
ptoDays: string,
diary: [
{
id: int,
day: int,
// day in month
dow: int,
// day in week (0=Sunday)
type: string, // workday, vacation
note: string,
time: string, // format hh:mm, done on server
details: [
id: int,
projectId: int,
project: string,
time: string, // format hh:mm
note: string

]
}
]
}
Use for personal report / time entry / approval screen
Format for all numbers: #,##9.9 [done in backend]
Format for all times: 99:99 [done in backend]
First row is TOTAL for entire company with sum for all projects

5. /dashboard
{
year: int,
// current year
month: int,
// current month
limit: int,
// last day in month
days: int,
// number of required workdays in month
total: int,
// total number of required entries
work: int,
// total number of work days
pto: int,
// total number of pto days
empty: int,
// total number of missing entries
projectHours: [
{
project: string,
// project name
hours: int
// total hours in current month
}
],
teamYear: [
{
team: string,
// team name
hours: int[12]
// hours in current year
}
],
missing: [
{
person: string,
// employee name
entries: int
// missing entries in cur.month
}
],
}

6. /projects/{id}
{
id: int,
name: string,
linked: bool // if not linked = can delete
}

7. /persons/{id}
{
id: int,
firstName: string,
lastName: string,
email: string,
phone: string,
roleId: int,
role: string,
teamId: int,
team: string,
linked: bool // if not linked = can delete
}

8. /roles/{id}
{
id: int,
name: string,
size: int
// if size = 0 then can delete

9. }/teams/{id}
{
id: int,
name: string,
size: int
// if size = 0 then can delete
}

10.

/search/{filter}
Returns list of Persons
Criteria:
filter contained in
firstName or lastName or teamName or roleName

$http.defaults.headers.common['Authorization'] =
'Basic ' + encode(user.name + ":" + user.pass);
GET

$http({
method: "get",
url: source + "projects"
})

POST (obj)

$http({
method: "post",
url: source + "projects"
data: obj,
})

PUT (obj, id)

$http({
method: "post",
url: source + "projects/" + id
data: obj
})

DELETE (id)

$http({
method: "post",
url: source + "projects/-" + id
data: null
})

Data Service
(function() {
var app = angular.module("timeKeeper");
var DataService = function($http, timeConfig) {
var source = timeConfig.source;
return {
list: function(set) {
return $http.get(source + set)
},
get: function(set, id) {
return $http.get(source + set + "/" + id)
},
post: function(set, obj) {
return $http({ method:"post",
url:source+set,
data:obj })},
put: function(set, id, obj) {
return $http({ method:"post",
url:source+set+"/"+id,
data:obj })},
delete: function(set, id) {
return $http({ method:"post",
url:source+set+"/-"+id,
data: null })}
};
};
app.factory("DataService", DataService);
}());

You might also like