74 lines
2.4 KiB
Org Mode
74 lines
2.4 KiB
Org Mode
* Report cli
|
|
|
|
Automate generating invoices.
|
|
|
|
|
|
** Usage
|
|
|
|
** Install/Getting started
|
|
|
|
Get ~.phar~ file, run configuration wizzard.
|
|
|
|
** Specs
|
|
A simple Console Command that prints out monthly report from youtrack.
|
|
|
|
Simple configuration:
|
|
- authentication token value
|
|
- project categories
|
|
- hourly wage
|
|
- folder for reports
|
|
|
|
|
|
** Components
|
|
- report service - provides a csv of a report
|
|
- local csv file read (provided via argument)
|
|
- youtrack api request (with [[https://docs.guzzlephp.org/en/stable/][Guzzle]] and [[https://github.com/cybercog/youtrack-rest-php][Youtrack API php client]] )
|
|
- Authentication: https://www.jetbrains.com/help/youtrack/devportal/Manage-Permanent-Token.html#obtain-permanent-token
|
|
- API documentation: https://www.jetbrains.com/help/youtrack/devportal/youtrack-rest-api.html
|
|
- parse report
|
|
- compute hours per configured project categories from report
|
|
- output a table
|
|
- Create an invoice
|
|
- send the invoice (to Wolfgang)
|
|
|
|
** Motivation
|
|
- practice php
|
|
- automatization of repetitive task
|
|
- is it worth it? according to xkcd table - you should spend 1 day for
|
|
automating a monthly task that takes 30 minutes. That would be if only
|
|
I'd be using this app. If it get's picked up, by 5 others - it is worth
|
|
5 days of development.
|
|
- remove errors from reports
|
|
|
|
** Plan
|
|
1. Basic structure of the cli-app
|
|
1. App preparation
|
|
- nice specifications
|
|
- composer project
|
|
- autoloading & dependency injection
|
|
2. Report service
|
|
- read a local csv file
|
|
3. Parse report
|
|
- read configuration (project categories, hourly wage)
|
|
- simple table output
|
|
2. First round of enhancements
|
|
1. Tests
|
|
2. youtrack request
|
|
3. create composer package, create executable
|
|
3. Second round of enhancements
|
|
1. Invoice output
|
|
2. configuration wizard
|
|
|
|
** Learning
|
|
- https://www.youtube.com/watch?v=aCqM9YnjTe0
|
|
- Choices (~new ChoiceQuestion~)
|
|
- ~addOption('config')~
|
|
|
|
** API calls
|
|
|
|
|
|
*** Get csv file
|
|
|
|
curl 'https://drunomics.myjetbrains.com/youtrack/api/reports/83-554/export/csv?&$top=-1' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H "Authorization: Bearer $TKN" > ~/Documents/Drunomics/workhours/2021/21-09.csv
|
|
|