0.0.1 • Published 11 months ago

studio-service v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Studio service

Start service

npm install node ./http-server.js

DB back-up / restore

pg_dump -h criya-staging1-db-do-user-12308615-0.b.db.ondigitalocean.com -p 25060 -U doadmin studio_service > studio_service_db.sql

createdb -h localhost -p 55434 -U postgres -T template0 studio_service psql -h localhost -p 55434 -U postgres studio_service < studio_service_db.sql

Environment variables

Server host|port bindings

HOST= PORT=

Database

DB_HOST= DB_PORT= DB_USER= DB_PWD= DB_PB=

authentication

JWT_SECRET=

Database And Migrations

To create database in docker run:

./tools/service-db.sh build &&./tools/service-db.sh start

To apply all the latest migrations:

npm run db:migrate:local:up

To create a new migration:

npm run db:migrate:local:create <migration_name>

sql files will be craeted in ./tools/migrations/sqls

For more insormation about migrations please read

https://db-migrate.readthedocs.io/en/latest/Getting%20Started/configuration/

API

Header: Authorization: Bearer

GET <http://127.0.0.1:8080/api/studios/v1/studios/>

Request: CreateStudioRequest

Response : StudioType

GET <http://127.0.0.1:8080/api/studios/v1/studios/url/<criya_url>>

Response : StudioType

POST http://127.0.0.1:8080/api/studios/v1/studios

Request: StudioType (without studio_id)

Response : StudioType

PUT http://127.0.0.1:8080/api/studios/v1/studios

Request: StudioType

Response : StudioType

GET <http://127.0.0.1:8080/api/studios/v1/studios/url/<criya_url>/availability>

Response : Availability

GROUP SESSION

Feature description

Group session - appointment created in predefined period by Criator

It can can contains several timeslots (sessions) with start and end time intevals

Create Group session

System doesn't check availability for proposed time slots (no internal chekc, no google calendar checks). Slots can owerlaps:

slot 1: start time: "2023-06-01 12:00:00" end time: "2023-06-01 15:00:00"

slot 2: start time: "2023-06-01 13:00:00" end time: "2023-06-01 15:00:00"

Group session created as product. After that google event should be created in Criator calendar

Availability

Group session can be private and public.

Client cannot see provate group session in Criator page.

Client can see group session if has link for this "product"

Banking

Free group sessions

Criator has connected banking account: Created as public product, available for purchase; the same behaviort if banking account is not connected

Non free group sessions

Criator has no connected banking account:

Group session becomes private until banking account is connected. Cannot be purchased untill banking account is connected

Google event calendar is created

Criator has connected banking account:

Group session is created Google calendar event is created

Syncronization

When account is connected - group session product should be sinchronized with payment provider if it's needed stripe should have product on his side paypal - n/a

Purchase

Client can buy group session product. ---- After payment successfully completed calendar event in client calendar is created (send notification with calendar event)

Criator event updated - new attendee is added

Cannot make purchase twice by one client (checking the uniqueness of the email)

View group session events

Studio view

Seaparate tab with group session events

Inside Group session

Criator can view attendies list

Attendie can be removed:

<!-- 1. Client notification is sent -->
2. Criator event is updated - rm attendee
3. update client purchase - change status to 'cancelled'

explore page

group session should be searchable if not started

session should be removed from index if started

Site builder

  1. linked in link proceed ---> 30 sec -> site_id (create record in parsing_task table (site_id))

  2. site_id --> loging (google) ---> f_name + l_name + email
    map studio to site_id (create record in site_studio_link table (site_id, studio_id))

    f_name + l_name + email -> users record
                               studio (blank)  criya_url + criya_version = v2.0
                               criya_url:      sitecustoms.com
  1. spinner processing...

table: parsing_task

id (site_id) | step | status | data_source_id |

site_1 | | processing ||completed || failed | source_id_1 |


table: site_studio_link

site_id | studio_id | date_create

site_1 | studio_1 | now()

Steps:

  1. parsing (linkedin)
  2. create studio data -> about_me 0 - 20 sec products -> >= 10sec criya_url -> valera_243_asdsadas12 studio_name -> 'valera 243'

table: linkedin_user_data

id | linkedin_url | f_name | l_name | location | work_experience | about_me | volunteer_experience | education | html_source (raw linked in html) |

source_id_1 | valera_243 | | valera |

===============================================================================================

table: custom_pages

id | studio_id | slug | body | site_id

custom_page_1 | nullable | / | '{}' | site_1 custom_page_1 | nullable | /about_me | '{}' | site_1

===============================================================================================

TODO:

modules: 1. parser (Alexander K.) 2. SiteBuilderController.compose() 3. Create custom pages 5. SiteBuilderController.createStudioObjects(p.2) 6. link parsed_objects with studio

update token payload - add site_id

Modules

parsing_task

create updateStatus(step, status)

AI generation v2.0

API

Page generation

POST /custom/page/ Request:

{
        sections: [
                {
                        type: 'text',
                        title: 'Fox as pet',
                },
                {
                        type: 'FAQ',
                        title: 'Elephant as pet',
                }
        ]
}