Files
2025-11-09 22:35:16 +03:00

152 lines
5.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# dx4 architecture
<p align='right'>dengi</p>
# fundamental types
## classes
#### db table
| name | meaning |
| ----------------- | ------------------------------------------------------ |
| **classid** | **unique** class id <u>_(uppercase, min 3 max 10)_</u> |
| **userclassname** | use friendly name |
| **caching** | `0 \| 1` toggles caching |
#### example
| classid | userclassname | caching |
| ----------- | ------------- | ------- |
| `9BPLETNEV` | 9б | `1` |
## admins
#### db table
| name | meaning |
| -------------- | ---------------------------------- |
| **adminId** | unique admin id, **it's secret** |
| **adminName** | user friendly admin name |
| **adminClass** | `classid`, that admin belongs to |
| **adminPerms** | admin permisions, look table below |
#### permissions
| val | meaning |
| ---- | ------------------------------------------------ |
| `-1` | **unlimited, full access** |
| `0` | _**preserved for users**_ |
| `1` | allowed to make change for _changes in schedule_ |
| `2` | _bells and permament schedule_ |
| `3` | _change class profile, and notes_ |
| `4` | _create and manage admins_ |
#### > Requests
You can **request** a change, if your level is lower, also you can **accept** those changes if your admin level can do this
#### example
| adminId | adminName | adminClass | adminPerms |
| -------------- | -------------- | ----------- | ---------- |
| `ivanpletnev4` | _Ivan Pletnev_ | `9BPLETNEV` | `-1` |
## schedule _(permanent)_
#### db table
| name | meaning |
| ------------- | ----------------------------------------- |
| **classId** | class belongs to |
| **fromDate** | active from date (DD-MM-YY) |
| **dayOfWeek** | day of week, _num_ **(**`0` **- monday)** |
| **content** | json **list** content, look table below |
#### json content
| key | meaning |
| ----------- | --------------------------------------- |
| **num** | n of lesson in schedule, start with `1` |
| **subject** | lesson subject |
| **cabinet** | lesson cabinet |
#### example
| **classId** | **raspId** | **dayOfWeek** | **content** |
| ----------- | ---------- | ------------- | ------------------------------------------------------- |
| `9BPLETNEV` | `3` | `0` | `[{"num":1, "subject":'физека🤬', "cabinet", 209},...]` |
## changes in schedule _(zameni)_
#### db table
| name | meaning |
| ----------- | ------------------------------------------------------------ |
| **classId** | class belongs to |
| **forDay** | day date `DD-MM-YY` _(i hope there wouldn't be y3k problem)_ |
| **content** | json list content, look table below |
#### json list content
| key | meaning |
| ------------- | ---------------------------------------------------- |
| **num** | n of lesson in schedule, start with `1` |
| **subject** | lesson subject, or `$function`, **look table below** |
| **cabinet** | lesson cabinet, if unused type `0` |
| **t-begin** ? | lesson begin time, if empty same as before |
| **t-end** ? | lesson end time, if empty same as before |
#### changes functions
| function | meaning |
| --------------------- | ---------------------------------------------------------------- |
| **`$rm-bef`** | remove all lessons **before**, _including this_, eq. to old `-3` |
| **`$rm-aft`** | remove all lessons **after**, _including this_, eq. to old `-2` |
| **`$no-lessons`** | permanently sets to no lessons today |
| ~~**`$no-changes`**~~ | ~~says that there is no changes today _(when 100% sure)_~~ |
#### example
ko v toromu
| **classId** | **forDay** | **forRaspId** | **content** |
| ----------- | ---------- | ------------- | ----------------------------------------------------------- |
| `9BPLETNEV` | `20-10-25` | `0` | `[{"num":1, "subject":"`**`$rm-bef`**`", "cabinet":0},...]` |
## rings _(zvonki)_
| name | meaning |
| ------------ | --------------------------------------- |
| **classId** | class belongs to |
| **fromDate** | active from date (DD-MM-YY) |
| **content** | json **list** content, look table below |
#### json list content
| key | meaning |
| ----------- | ----------------- |
| **num** | n of lesson |
| **t-begin** | lesson begin time |
| **t-end** | lesson end time |
#### example
| **classId** | **fromDay** | **content** |
| ----------- | ----------- | ----------------------------------------------- |
| `9BPLETNEV` | `20-10-25` | `[{"num":1, "t-begin:"9:00", t-end:"9:40"}...]` |
# api
## `/req_schedule` **POST**
returns ready to show schedule
#### req
`classId, date`
#### res
`{"num":1, "subject":'физека🤬', "cabinet": 209, "t-begin":"9:00", "t-begin": "9:40"}`