# TODO (J.F.C. - Just fucking code it already)

Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTQ0NTU5NzAwIiwiZXhwIjoiMTU0NzE1MTcwMCIsImlzcyI6ImF5YW5vdmEuY29tIiwiaWQiOiIxIiwiYXlhbm92YS9yb2xlcyI6IjMyNzY3In0.fMq_8Dvia63rzN_U2zjczPvUNM40OEAeI4VOeV6ulGw


## IMMEDIATE ITEMS



	Widget and user picklist, modify to use filter and sort criteria, remove the startswith built in filter
		- Fix up the old tests for picklists and replace with new test using filter ID
		- Don't forget to test with no filter ID to ensure still works as normal (default picklist should sort by alpha, need extra default method for sql query)

	ENUM
		- Need route to get enum values and lt by providing a lowercase name of the enum (used for building filter UI for enum types)
		- Client needs to pick enum value adn display localized

	NEXT
		- This should be the point that the lists code is concluded and can move on to the other SERVER items below then back to client stuff in the middle here

-----------------------

TODO CLIENT STUFF	
	- LIST
		- Overall list menu toolbar at top with following icons:
			- Add new item
			- Filter list
			- Refresh
			- Ellipsis submenu with mass ops options and other list wide options appear there	
		- How to show tags?	
		- Check the rights to the list before it gets the data
		- Edit / Trash buttons in grid are too small on a phone with fat fingers
		- TWO api calls are made when list is opened, sb one only.
	- Should list or any widgets fetch data automatically on display or should they have some way of requesting it to save bandwidth? (TTM CADILLAC PROBLEM?)
	- Should the list be narrow to start and expand on demand?(TTM CADILLAC PROBLEM?)
	- Login needs to scroll higher or logo smaller on sm so that the keyboard doesn't obscure the login lines
	- Need a test user that has access to every possible role so that I can see all the roles for testing purposes
	- About page has too big of margins on each side of display
	- numeric inputs need to be set as such so that the number keyboard appears

	- TODO: Will need currency symbol, date format, numeric format from user settings at server
		- rather than try to use local browser settings which is fraught with peril will need to be specified at server itself
		- Wherever I am currently storing time zone that's where these other settings need to be 
	

	- Make the copyright banner at bottom left aligned, right now it seems weird in small iPhone size when it breaks to two lines (make text smaller?)
	- Change server api page favicon to look like a SERVER version of the AyaNova logo, not the same one as the client uses [ fuck it, why? TTM!]
	- Disable google fonts for manual / docs generator:
		- first need to upgrade to latest mkdocs AND material theme for mkdocs
			- https://www.mkdocs.org/#installation
			- https://github.com/squidfunk/mkdocs-material
		- https://squidfunk.github.io/mkdocs-material/compliance/
	- Once docs no longer need google fonts can adjust the devops nginx config and remove the overrides for CORS and all that shit.



	- Make the following widgets for small screen, drag out size and see what can be done to benefit medium+ sizes, so two sizes for now
	- Just get basic Functionality working then iterate rather than trying to plabn out everything at once!!
	- Mockup filter popup dialog or filter in place near header with expansion thing
	- Edit dialog or edit in place?

	- Widget list component that works with real data	
		- paging, sorting, filtering (columns and by tag), items per page
			- Single column sorting only
			- Filter by popup dialog
				- generic dialog that accepts a object specifying column names and types and builds a UI with the options on it 
				- when applied it saves it as an object that is sent up to the server for each column sorted on in query string
				- Server list needs to accept those options and sort accordingly.
					- are we getting into huge territory needing more advanced utility at server for querying from client?
			- Saved filter as a whole grid component? or Stored locally with client so each client app can have individual settings (i.e. phone vs desktop can have alternate settings for same user)
				or both saveable as a pick item from teh main or as a whole preset grid widget? TIME TO MARKET!!!
		- Each item can be edited if they have the rights or viewed etc by opening into crud component
			- List should remember where the user was when they go to edit and back again
			- What to do if they edit?  Refresh the list but keep the same page location?
	- Widget crud component that works with real data
		- Dirty form check and prevent route leave: https://router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards
		- broken rule display 


----------------

TODO SERVER STUFF
	- ProcessObjectKeywords improvement
		-Should just be able to pass the object to be processed to a method that will automatically find the Name field and all text fields and process it accordingly
		- May need a hint if there isn't a specific "Name" field but that's probably so rare that can just leave that out and continue the old way for any object without a Name
	- Do these after doing the above as it may be all that's required for them anyway:
		- WidgetBiz Create / CreateAsync share much the same code, move redundancies to common method
			- This object will be replicated repeatedly so it always pays to clean it up more and more
		- WidgetBiz Put/Patch also share nearly the same process keywords code, so move to common method!!

	- Delete user should delete private datafilters
		- Did I code how to handle implications of user delete anywhere yet??
	- LOG File names, when logs are rotated, I'm seeing the number 18 and 17 in the devops log file rotated names?!  Shouldn't it just be 1 to 3 or something, will that number keep growing infinitely?
	- Client item actually: it should validate the time zone offset when the client software starts and if it's found to be off what was set offer to change it automatically
		- This way it works client to client and will handle DST changes almost automatically

	- Trial route needs in xml comments for route to add the timezone info parameter so it shows in the api explorer as well as the current trial size
	- Seeding huge 500 techs doesn't break the trial license which is for 100 techs, need some tech checks all over and also up the trial license to the max possible seeded techs
	- AyaNova 7 import is NOT erasing the db before it does the import but it should be so what's up with that??
		- Also isn't it supposed to respect if there is existing data and force user to erase db first??
	- TODO: Will need currency symbol, date format, numeric format from user settings at server
			- rather than try to use local browser settings which is fraught with peril will need to be specified at server itself
			- Wherever I am currently storing time zone that's where these other settings need to be 

	- TODO: Make sure private data filters get deleted with users who created them
	- TAGS: REally need to have a think about how tags are used in the UI, probably need a autofill route that has a source of used or common tags to drive it
		- so user can type first fiew characters adn select
		- So consistency is maintained and not sloppy multiple spellings
		- Maybe a db stored procedure and trigger or biz code that feeds a consolidated tag table of all entered tags in the system?
			- Maybe a reference count for each tag to drive a tag cloud feature and also a order by commonality feature when offering and also to know when to remove the tag repository when no one is using that tag anymore in any records



-----------------

TODO AFTER ABOVE:




- Stage 2 AFTER POSTED TEST ROUND COMPLETED		
	- Error handling at client (log? display?)
	- Notification of some kind (bell / toast)				
	- Add intro.js somewhere, even if just a quick hello type thing	with one single pointer to something on the screen
	- Look into: should each component do it's own ajax calls?	
	- Make a widget component / form to view/list/enter/edit	
	- Graph / Readonly UI component
	- Widget: List, search, edit, localized WIDGET UI components
	- Post up another build with the entry form and re-round of testing
		
- Stage 2.5 TESTING
	- Enable some end to end testing and use it going forward all over.
		
- Stage 3: 
	- At the end of this phase re-assess and see what needs to be the focus going forward and if anything is amiss
	- Plan out the next phase
		- UI layout design, how I want to see things, don't re-invent the wheel; v7 isn't perfect but I don't have forever either
			- Just remember roles and role based security and that might lead into the UI
			- the dashboard can drive a lot because for example a graph or list of workorders could also be where you add a new wo
		- Thorny issues:
			- Reporting
			- Notifications from the server
			- File upload / download
			- Offline abilities?
				- TIME TO MARKET TIME TO MARKET TIME TO MARKET 
				- RELEASE IT, RELEASE IT, RELEASE IT!!!!
				- Need a good think about this, time to market is of utmost importance but it would not hurt to see what can be done now or defferred to vNext
				- v7 is technically an always online app so there's that.
				- Would be nice to maybe be able to do some limited stuff offline
					- scope out a scenario or leave for vNext?
					- Fill out a workorder that is already up on the phone?
					- Parts can't be cached locally, there could be thousands, but maybe labour only is supported?
					- Maybe parts can be entered as text when offline for later lookup?
	- NOTE: many users want to see some progress on v8 so it's important that the initial shell have some "flash" to it
		- Nice transitions
		- Some sample charts
		- test well on all form factors 
		- Have examples of a form with all RAVEN required control types enabled
		- Use Intro.js to introduce the demo to new users and also to introduce the UI elements and it will be used all over the place!!


- Stage 4: 
	- Customer demo!!




DEVOPS 
	- Right now all that really matters is being able to test it and I can do that so the rest can be bumped.
		- Wipe the server, create new at v 18 (or try the upgrade first just for kicks)
			- Upgrade in place process: https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-ubuntu-18-04
		- Make devops AyaNova barebones without docker?
			- Look into pros and cons because ultimately we'll want to run a bunch, maybe on demand, how to do that automatically? (Cadillac problem)
				- Actually, won't they just be separate droplets?  So really what I want is a very efficient droplet that I can clone?
				- But then people want to just sign up and start working, not rent a whole server etc, it's up to us where we put the droplets or apps, but they don't want to see that
				- Several scenarios: 
					- User signs up and starts working immediately, all through a subdomain, i.e. https://abcelectric.ayanova.com 
					- User wants to host it themselves on their equipment (nothing for us to do but sell the license)
					- User wants their own host and domain i.e. https://abcelectric.com
					- User wants to run it all locally on their own computer, docker image?  Do we really want a windows installer route or...?

			- initially probably manually set up so really not an affect either way as will just need to dedicate a port to each one regardless if dockerized or not
			- We do want fastest perf though and no aggravation or cross exposure




=-=-=-
some shit I probably don't need anymore:

CHOPPY DAY WORK
+++++++++++++++

https://severalnines.com/blog/performance-cheat-sheet-postgresql
https://medium.com/@wesharehoodies/immensely-upgrade-your-development-environment-with-these-visual-studio-code-extensions-9cd790478530
Changes needed to routes??
	- http://www.talkingdotnet.com/actionresult-t-asp-net-core-2-1/

Ensure all modern best practice security is properly enabled on helloayanova.com so testing is valid
	- https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security#Deployment_best_practices



CODING
++++++
refs:
	- https://vuetifyjs.com/en/components/navigation-drawers
	- https://vuetifyjs.com/en/examples/layouts/googleContacts
	- Read this: https://qiita.com/nickhall/items/d1043f3f9874c90b6f8e
	- And this: https://logrocket.com/blog/an-imperative-guide-to-forms-in-vue-js-2/



// eslint-disable-next-line

NEXT UP / CURRENTLY WORKING ON:
=-=-=-

IMMEDIATE ITEMS:
================


*** CLIENT SHELL ***

Go through the TOOLS.txt file VUE section and install

ServiceWorker - learn it, know it, love it
	- Make Pecklist work with a service worker for offline use!!!!
		- Do it "manually" to learn about SW better
		- Use the VUE CLI generated stuff as a base

Do some tutorials to get a feel, read all the following 
VUE PWA 
	- https://naturaily.com/blog/pwa-vue-cli-3
	- https://dev.to/developerayo_58/vue-pwa-tutorial-how-to-build-efficient-progressive-web-apps-using-vuejs-5fdo

UI LIBS
	

OTHER
	- Think about spa features
	- Webpack (how can it help, what parts to use)
	- Read about Single File Components https://vuejs.org/v2/guide/single-file-components.html
	- Skim and have at hand ES2015 guide: https://babeljs.io/docs/en/learn




Once I can make the client I need to get into that and make the shell and initial interface with enough stuff to do basic testing initially
	- Make sure to see the vue.js stuff in tools and below and contemplate it fully before committing to it
		- VUE was chosen some time ago and there are likely other things out now
	- Look and layout, graphics, logo, anything that is shell only 
	- Menu system	
		- Help link
		- search 
	- Login , logout
	- License
	- Security / rights
	- See localized text / change locale 

	later
	- Widget CRUD and lists
		- All input controls and date localization etc etc
	- LOAD TESTER see below...








************************************************************************************
FUTURE ITEMS:
=============




LOAD TESTER
-----------
After very initial client stuff but before getting too deep into anything, need a load tester that drives the client and makes hundreds of thousands of objects and really exercises the client
and backend.  I want to know what happens under typical heavy usage simulating months to years of work in just a few minutes.
I'm guessing something that autodrives a browser or simulates one to access via client UI for full end to end testing.
	- Should be configurable to simulate various loads:
		- Smoke test (Quick bug test): excercises one of everything once only looking for fundamental problems
		- Load / scale / assurance test (Slower longer test to look for scaling issues related to a huge, busy office): exercises typical daily load of very large office but configurable to run in simulated days, so
			can run it as a simulated week with 7 or month with 30 or years by entering in the number of days to simulate.  
			Would be nice if it did month end type stuff or delayed then billed out etc.
			Should report stats about timing etc from the client perspective, we already have metrics for the backend perspective.
				I'd like to know immediately if something is weirdly slow, not just in error.
			Should not erase data at end so we can then manually login and check things out with a full load of at scale data


MISC FUTURE ITEMS NOT SURE ABOUT THAT CAME UP DURING CODING / TESTING
---------------------------------------------------------------------

- Should server show uptime somewhere?
- Log route: Add a route to download *all* log files as a single zip archive which will make life much easier for analysis





### ALL ITEMS

	
	- LOCALIZED TEXT
		- Localized text keys would be nice if they are understandable as is for API direct users so you don't need to be in the client to understand
			what's happening
		- Need a locale indepedent locale so that server errors without a corresponding user are localized to default english
			- Also maybe a locale can be chosen at the server for error messages since we'll go by code numbers anyway.
		- Starting to get to the point where I'll need this, i.e. error messages and logs that are part of core ops but need to be displayed in the UI
		- Need to go through the api and find all the plain text messages returned and convert to locale text keys
			- Ensure every error message has an error number of one kind or another and that they are not conflicted and easy to sort out if coming from server or api or etc
		- Need to suck out our paid for translations and convert them into new locale text format
			- DataDump??

	- REPORTING 
		- Huge and unknown at this point Oct. 2018

	- SEARCH TEXT
		- See spec docs
	
	- TECH SUPPORT
		- Investigate how I can look at a customers DB with RAVEN
		- Data masking for dumps is a start
			- special "tech support" dump with masked customer information??
			- Customer has a "key" that they can see which customer is the substituted masked one so we don't know the customer name but they can reference it themselves
		- What about live looking at data through some feature?
			- What would I need to look at or what information would I need?
			- Be able to run a query directly and view results??
		- Be able to run a query provided
			- As a fix might need to enable customer to run a provided query.
		- Be able to view all the meta information about the postgres instance
			- Collation, sort order, languages, anything the user can set that could fuck up RAVEN
	

	- MODIFICATION / CHANGE LOG (see case 79)
	
	- Visible ID number generator case 3544
	
	- CUSTOM FIELDS (case 3426)

	
	
	- Notification / generator / event of interest stuff (case 3491) BIG ONE
		- Need interface, code for triggering notifications in biz objects ITriggerable :)
		- Would it be more efficient to just process all notifications into the modification log regardless of subscribers	

	- CHILD objects need to point to their parent and be readable in code for searching and for opening objects based on child object
		- so all child objects need a typeandid of the immediate parent
		- Not sure where to document this so putting it here for reference
		- Required for opening a search result of a descendent that is not directly openable an
		- Need parent AyaType as an ENUM ATTRIBUTE in the AyaType table for easy traversal

	
	- Import V7
		- Tags - any type that is moving to tag can be coded now

	- TESTING
		- Longevity test on the DO server I can have up and running see core-testing.txt doc

CLIENT	
			
	- WHEN HAVE CLIENT - Localization (see core-localization.md) 
		- Time zone stuff (case 1912 related)
	- WHEN HAVE CLIENT - Layout / Form user setttings
	- WHEN HAVE CLIENT - Default form filling settings handling (case 3485)
	- WHEN HAVE CLIENT - Push notification to client
		- PUSH / POLL notification: determine and implement a system that can send notifications to client for things like 
		- change of localized text (invalidate cache)
		- Server shutting down (log out asap)
		- business object notifications (new workorder, status change etc)
	- WHEN HAVE CLIENT Report route for widget
	- WHEN HAVE CLIENT - test my PickList, is it sufficient? (pageable, alpha pageable (A-D, E-G kind of thing?))
		- Case 1692 
		- search by tags plus text plus maybe pageable or...???
	- WHEN HAVE CLIENT - ACTION / UI WIDGETS case 3460, 1729 UI as a collection of widgets stuff


- When widget is completely done, go over it and see if anything can be made easier or better before proceeding
- Generate seed data for tags
- Better to do this when the above core items are done as it touches on them
- Time zone	
	- This is not specced anywhere, but here, not sure where to put it at the moment, hopefully by the time I get here I will know (global settings? User settings?)
	- Do not rely on the server's time zone setting, for example a docker container will be utc even if the server hosting it is pacific time
	- Instead, use UTC for everything and have configurable value for timezone offset

### NFR	

	- UPDATE SWASHBUCKLE / SWAGGER to support testing file upload if not too onerous
		- https://github.com/domaindrivendev/Swashbuckle/issues/280
		- http://www.talkingdotnet.com/how-to-upload-file-via-swagger-in-asp-net-core-web-api/

	- IMPORT / EXPORT
		- biz object should import from v7, make a dummy import for widgets from something I've already exported in v7 (units? something with at least a name)	
		- Make a route for import to upload an import file?  Then it runs the import via the biz objects and the correct ordering?
		- OPS Functionality?? (maybe just biz admin only since it's dealing with actual biz data)
		- OPS can import ops related stuff??(notification email server settings etc)

	- BACKUP and RESTORE and COPY automatically to storage offsite
		- Backup and restore data (widget, users etc)
		- Close AyaNova server, erase db(optionally?? maybe user wants to combine two separate db's), restore the data
		- See Discourse, they have some kind of AWS thing
		- Also maybe this is handy: http://www.talkingdotnet.com/webhooks-with-asp-net-core-dropbox-and-github/
		- Download backup, upload backup file
		- FTP automatically?

	
	- Need api speed test route (to independently of any particular object know how fast the connection is, for choosing a host site and troubleshooting)
		- Some kind of static test list that is perfectly reproducible on demand
		- Maybe a set routine of items to generate and return but in a way to disambiguate between slow server and slow connection
		- don't re-invent the wheel
		- What to test:
			- compute performance
			- DB performance
			- thoughput? Speed of network

	- Need some way to know if AyaNova is taking longer than it should to process requests so it can be an alert of some kind
		- research how to time api avg running total or something, graph it for ops
		- keep data by class of operation or tag it somehow
		- Don't want it to actually slow performance
		- Maybe have a benchmark time for various ops gathered during debugging tests, then hard code in that benchmark and if it takes longer then it logs it
		- http://www.neekgreen.com/2017/11/06/easy-way-measure-execution-time-aspnetcore-action-method/
		- https://weblogs.asp.net/jeff/asp-net-core-middleware-to-measure-request-processing-time


- SSL / TLS
	- Need to look into how to support this
	- Look into how the 2.1 dotnet will work with ssl so I do something relatively compatible 


- REPORTING
	- NOTE TO SELF: Don't report off Biz objects, make report specific objects. Better to have a reportclient list object and a selection client list object and etc than just a single client list doing duty as a selection box filler and a reporting object
	And also biz object interfaces ideas:
	ITaggable, ICustomFields, ISearchable, IExportable,IBizAction, IReportable (with sub interfaces for paging, format, report name and biz object for single and list etc,report stuff), ILocaleFields?, Etc
	Your welcome!🤘😎


- CLIENT / UI DEVELOPMENT
	- CLIENT UI "WIDGETS" ("COMPONENTS")
	- Have UI testing scripts for developing UI. Scenario and then I can manually walk through it and see how ui responds to iterate from rough skeletal UI.
	- Make a script for top X scenarios in the work day if each role.  That way can try early rough designs with neutral expectations and reiterate until adequate.
	- This way I won't design out of my ass without good input to riff off of.
	- Orient express is some good shit for the shabs!


- Client: Start initial front end vue.js shell
	- Need way to shut down clients gracefully (added value in api return? Polling [can't recall what the decision was in polling])

- Implement unlicensed server mode in client
	- Request trial key from client, server fetches and installs

- Implement trial mode in client 
	- Seed data, erase db etc


- AFTER APRIL 1st 2018 - Dotnet 2.1 changes I must look into:
	- will be rtm this summer-ish
	- some swagger and webapi affecting changes
	- efcore group by and lazy loading thing, might be relevant, nto sure
	- HTTPS by default
	- Look into it, see if something will be so huge that I should use the beta now for dev.



BUNDLING
- ONCE there is any front end code worthwhile then - Automatic build process Bundling and minification
- Parcel is coming on strong and requires supposedly zero configuration: https://parceljs.org/getting_started.html
- READ THIS: https://docs.microsoft.com/en-us/aspnet/core/client-side/using-gulp
- THEN SET IT UP
- Need automatic file copy script or whatever to copy docs to wwwroot folder somewhere so it can be served by the ayanova server
- Also need to package front end stuff for deployment as well with versioning etc, not webpack but along those lines




- Think about hostname being included with license, maybe a requirement?
	- Localhost only or domain?
	- Or would it be too much hassle with non-domain sites
- Fail2ban?  Will we need that kind of thing incorporated into AyaNova?
	- See again how it works and then look into application level ideas for that or what is smart for hardening, throttling etc

- 2FA Two factor authentication
	- How hard is this to support in AyaNova?
	- What about apps like Authy?
	- It might be important to enable this for ops and biz accounts? Or at least be an option?

- LETS ENCRYPT
	- https://www.humankode.com/ssl/how-to-set-up-free-ssl-certificates-from-lets-encrypt-using-docker-and-nginx
	- https://weblog.west-wind.com/posts/2017/Sep/09/Configuring-LetsEncrypt-for-ASPNET-Core-and-IIS
	- https://stackoverflow.com/questions/48272373/how-do-i-get-letsencrypt-working-in-asp-net-core-razor-pages
	- NGINX: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
		- Review again if need NGINX in front of kestrel still and if so then go this route




- DO WE NEED TO BE ABLE TO admin db from within raven ops route even if can't connect to db?
	- Don't want users to have to use a db admin tool for anything, so should have ability to do whatever is necessary from ops route with db
	- REQUIRED OPS:  See if db exists


DEPLOYMENT AND TESTING
- DOCKER As soon as viable make an automatic build to a docker image for testing and deployment
	- https://docs.microsoft.com/en-us/dotnet/core/docker/building-net-docker-images
	- remote server online testing
		- Better product will come from running it as it will be used as early and often as possible
		- Look into renting the cheapest server on linode or digital ocean for dev testing
		- set it up to pull the latest from repo so it automatically updates (or a docker image maybe)
		- possibly set up integration test that goes off the remote server 
- WINDOWS Automatic installer for testing
	- Need a windows test bed and regular testing on it to confirm multiplatform interoperability
	- Maybe a windows installer or maybe a docker image

- Integration test that can be pointed at any location to run a series of tests



MANUAL
- Add how to use swagger UI and authentication


BOOTSTRAPPING AUTHENTICATION

- Manager account can only login from localhost? - HMM...think on it

- What if can only create new users if manager account is changed from default credentials?
	- that way you start your setup with one account, change it and then it's safe to do remote work


- by default manager account is only one with rights to configure server or user accounts.
	- Doesn't have any rights to business config, only server config and CRUD user accounts
	- So at least one admin user needs to be created locallhy before it can be used remotely to set up users
	- manager account cannot be changed in any way, so always has default password and login
	- JWT token check must check if local when it's the manager account user id 1
		- This is so a user can't copy the creds from browser and use them remotely
		- Test that shit from host
- What if can't run a browser in host for some reason???
 	- need an override that does allow remote manager account

- devise a way to bootstrap with no user accounts and a way to reset back to that




MAKE MVP 

- Has the following features:
	Alpha-0
	- installer for windows and docker container
	- VUE.js Front end that supports at minimum a login / logout and empty shell
		- Shows server and client versions (about)
		- https://vuejs.github.io/vetur/
	- swagger docs and way to view them via the api
	- User manual docs
	- See the tools.txt section search for vue
	
	Alpha-1
	- Can do some minimal config like seed data, erase db etc 
	- Ops interface showing status and can view log etc

	etc



LONG TERM::::::

## MVP and iterate

