Hierarchy service
flowchart LR
User -->|HTTP|Deno
Deno -->|Conn pool|MySQL
just ping :) always returns ok and status 200
"ok"
Rewrites current employees hiearchy.
Json shema for request:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"patternProperties": {
".*": { "type": "string" },
},
"additionalProperties": false,
}
Example:
{
"Pete": "Nick",
"Barbara": "Nick",
"Nick": "Sophie",
"Sophie": "Jonas"
}
Document representing unflattened hierarchy.
{"Jonas":{"Sophie":{"Nick":{"Pete":{},"Barbara":{}}}}}
Returns supervisors of :name up to :levels in height.
Params:
- name – case sensitive name of employee;
- levels – integer specifying depth of search.
An unsorted array of supervisors names for :name. Empty array if :name does not exists or has no supervisors.
Example:
[ { "name": "Sophie" }, { "name": "Jonas" } ]
Copy config cp .env.dist .env
VsCode:
- Reopen in container
- Deno: cache depenencies
App is started in watch mode. Logs are in VsCode Terminal.
Some app setting are set in devcontainer.json.
To start debugging session use Attach to remote.
If you need to debug bootstrap, kill terminal process and start with denon run --allow-all --inspect-brk=127.0.0.1:9229 main.ts
then 'Attach to remote'.
deno lint
deno fmt
deno test --allow-read
to watch tests:
denon test
deno test --allow-all -- --update
docker build -t deno-container
helm install deno ./deno-chart
Port fowarding of app container:
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=deno-chart,app.kubernetes.io/instance=deno" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8081/ping to use your application"
kubectl --namespace default port-forward $POD_NAME 8081:$CONTAINER_PORT
located in test.http file. Supported by rest-client vscode extension
- [✅] parse payload, transform
- [✅] store payload in mysql/maria
- [✅] hande syntax errors in payload as 400 json excpetion
- [✅] endopoint for supervisor from storage
- [✅] devcontainer, readme.md
- [✅] tests !
- [✅] basic auth !!
- [✅] helm for mysql and service !!!
- [✅] todo service to mysql connection in k8s !!!!
- [✅] move secrets from deployment to separate file that could be encrypted with sops
- [✅] read sql from file
- [] devcontainer with kind, helm. support for debugger into k8s attachment
- [✅] extract app server from main.ts to separate module
- [✅] int test with superdeno
- [] create test only db for int tests (currently local db is used)
- [] more int test cases
- [✅] make insertion transactional
- [✅] healthcheck handler
- [] helm: mysql as a separate service with pv