Redmine time logging application built with Node.js ##Installation git clone https://github.com/webbylab/redmine-reports-api.git
npm install
cp etc/users.htpasswd.sample etc/users.htpasswd after copy write login and password for users, for example
user1:password
user2:password
cp etc/config.json.sample etc/config.json after copy set next field:
1. host (example: job.redmine.com)
2. apiKey (user apiKey from redmine with all permission)
3. from (example redmine-reports@job.com)
4. destinationEmails (array with recipient emails, example: [worker1@mail.com, worker2@mail.com])
5. login and password from htpasswd for send_reports script
6. appUrl: (example http://localhost:8080/api/v1)
7. minLogTime: (example 40 hours at last week for eight-hour shift)
8. staticPath: (example ../client/public/)
##Uses For sync from redmine use sync_time_entries.js script with one of the modes, for example:
node bin/sync_time_entries.js --fullsync
Clear database and sync all time entries, projects and users.
node bin/sync_time_entries.js --sync
Sync only new time entries, projects and users.
For send email with report use send_report_to_email.js script, example:
node bin/send_report_to_email.js --send
You can set your crontab for use scripts automatically.
For start application write:
npm start
##API
###Projects list
####Request
GET /api/v1/projects
####Response
{
"status": 1,
projects: [
{
id: 12,
name: 'Some project'
},
{
id: 2,
name: 'Some project'
}
]
}
###Users list ####Request
GET /api/v1/users
Supported parameters:
- "users" - comma separated list of ids of users (default - all users)
GET /api/v1/users?users=12,2
####Response
{
"status": 1,
users: [
{
id: 12,
name: 'John Smith'
},
{
id: 2,
name: 'Bogdan Shevchenko'
}
]
}
###Time entries list ####Request
GET /api/v1/time_entries
Supported parameters:
- "projects" - comma separated list of ids of projects (default - all projects)
- "users" - comma separated list of ids of users (default - all users)
- "startDate" - ISO8601 date (example - "2014-10-24")
- "endDate" - ISO8601 date (example - "2014-10-24")
Supported includes:
- "user"
GET /api/v1/time_entries?projects=1,3&users=1,2,3,4,5&startDate=2014-07-07&include=user
####Response
{
"status": 1,
timeEntries: [
{
totalHours: 13.5,
hoursByIssue: {
1: 3,
3: 10,
8: 0.5
},
hoursByProject: {
2: 13.5
},
hoursByActivity: {
Fixing: 10,
Development: 0.5,
Design: 3
},
links: {
user: 12,
issues: [1, 3, 8],
projects: [2]
}
},
{
totalHours: 14,
hoursByIssue: {
1: 2,
3: 10,
5: 2
},
hoursByProject: {
1: 14
},
hoursByActivity: {
Fixing: 10,
Development: 5,
Design: 3
},
links: {
user: 2
issues: [1, 3, 5],
projects: [14]
}
}
],
linked: {
users: [
{
id: 12,
name: 'Viktor Turskyi'
},
{
id: 2,
name: 'Anton Morozov'
}
]
}
}