arming/README.md

125 lines
4.3 KiB
Markdown
Executable File

# huesos
Basis for developing chat-robots with "Web App" technology for Telegram
## Installation
### AnangoDB
1. Create a Graph with the specified values
**Name:** catalog<br>
<br>
* Relatin 1
**edgeDefinition:** entry<br>
**fromCollections:** categoy, product<br>
**toCollections:** category
* Relation 2
**edgeDefinition:** reservation<br>
**fromCollections:** product<br>
**toCollections:** cart
2. Create a Graph with the specified values
**Name:** users<br>
<br>
* Relation 1
**edgeDefinition:** connect<br>
**fromCollections:** cart, session<br>
**toCollections:** account, session
**Orphan Collections:** product
3. Create indexes for the "product" collection
**Type:** "Inverted Index"<br>
**Fields:** name.ru<br>
**Analyzer:** "text_ru"<br>
**Search field:** true<br>
**Name:** name_ru<br>
<br>
*Add indexes for all search parameters and for all languages (search language is selected based on the user's language, <br>
otherwise from the default language specified in the active settings from **settings** collection document)*<br>
<br>
*See fields in the `mirzaev/arming_bot/models/product`<br>
**name.ru**, **description.ru** and **compatibility.ru***
4. Create a View with the specified values
**type:** search-alias (you can also use "arangosearch")<br>
**name:** **product**s_search<br>
**indexes:**<br>
<br>
You can copy an example of view file from here: `/examples/arangodb/views/products_search.json`
```json
"indexes": [
{
"collection": "product",
"index": "title_ru" # THIS IS AN EXAMPLE
}
]
```
### NGINX
1. Create a NGINX server
You can copy an example of server file from here: `/examples/nginx/server.conf`
2. Add support for javascript modules
Edit the file `/etc/nginx/mime.types`<br>
`application/javascript js;` -> `application/javascript js mjs;`
### SystemD (or any alternative you like)
You can copy an example of systemd file from here: `/examples/systemd/huesos.service`<br>
<br>
**Execute:** `sudo cp huesos.service /etc/systemd/system/huesos.service && sudo chmod +x /etc/systemd/system/huesos.service`<br>
<br>
*before you execute the command think about **what it does** and whether the **paths** are specified correctly*<br>
*the configuration file is very simple and you can remake it for any alternative to SystemD that you like*
## Settings
Settings of chat-robot and Web App<br>
<br>
Make sure you have a **settings** collection (can be created automatically) and at least one document with the "status" parameter set to "active"<br>
You can copy a clean settings document without comments from here: `/examples/arangodb/collections/settings.json`
```json
{
"status": "active",
"project": {
"name": "PROJECT"
},
"language": "en", // Will be converted to an instance of enumeration `mirzaev\arming_bot\models\enumerations\language`
"currency": "usd", // Will be converted to an instance of enumeration `mirzaev\arming_bot\models\enumerations\currency`
"company": {
"identifier": null, // Example: "000000000000000" (string|null) (if `null` it will not be displayed)
"tax": null, // Example: "000000000000" (string|null) (if `null` it will not be displayed)
"name": null, // Example: "COMPANY" (string|null) (if `null` it will not be displayed)
"offer": false, // Display the data of a public offer in the footer? (bool) (does not affect the `/offer` page generation)
"sim": null, // Examples: "+7 000 000-00-00", "70000000000" (string|null) (if `null` it will not be displayed)
"mail": null // Example: "name@domain.zone" (string|null) (if `null` it will not be displayed)
}
}
```
## Suspensions
System of suspensions of chat-robot and Web App<br>
<br>
Make sure you have a **suspension** collection (can be created automatically)<br>
You can copy a clean suspension document without comments from here: `/examples/arangodb/collections/suspension.json`
```json
{
"end": 1726068961, // Unixtime
"targets": {
"chat-robot": true, // Block chat-robot
"web app": true // Block "Web App"
},
"access": {
"tester": true, // Account with `"tester": true`
"developer": true // Account with `"developer": true`
},
"description": {
"ru": "Разрабатываю каталог, поиск и корзину",
"en": "I am developing a catalog, search and cart"
}
}
```