chocomintapp / chocoserver

This is chocomint server
MIT License
0 stars 1 forks source link

Decide chocoserver api schema #3

Closed taijusanagi closed 3 years ago

taijusanagi commented 3 years ago
taijusanagi commented 3 years ago

v1

This is code first development, so actual development may differ.

only below endpoint is enough for the first development

taijusanagi commented 3 years ago

Chocoserver data

All structure is described here https://github.com/chocomintapp/chocoserver/issues/1#issuecomment-821920631

Chocoserver manage blockchain event and metadata

taijusanagi commented 3 years ago

I need to organize this

Screen Shot 2021-04-18 at 12 24 46

network -> block -> transactions -> logs network -> contract

contract and logs are one to many

actually, required query is just contract, then contract returns all log, and log is just analyzed, that's enough

taijusanagi commented 3 years ago

rename log to event, so that not confusing with logging

taijusanagi commented 3 years ago

Basically using graphQL and have REST wrapper is better

Guide for graphQL

taijusanagi commented 3 years ago
No repository for "Block" was found. Looks like this entity is not registered in current "default" connection? +33ms

nest start and ts-node difference https://stackoverflow.com/questions/45989574/repositorynotfounderror-typeorm/49113172

loading entity for ts-node and nest start is bit different so need to organize it again.

taijusanagi commented 3 years ago

This tutorial says maybe only env value is ok for the migration generation https://blog.theodo.com/2019/05/an-overview-of-nestjs-typeorm-release-your-first-application-in-less-than-30-minutes/

this issue is saying only env is fine https://github.com/typeorm/typeorm/issues/490

But I'm using nestjs/config module pattern, so need to find other way

taijusanagi commented 3 years ago

generating ormconfg.json using env config generate migration and actual migration is done by ormconfig.json nest start is using env config and ts ts-node start

taijusanagi commented 3 years ago

https://docs.nestjs.com/techniques/database

Alternatively, rather than passing a configuration object to forRoot(), we can create an ormconfig.json file in the project root directory.

Ormconfig is only required for the forRoot

taijusanagi commented 3 years ago

I have this provider pattern, but it may not required, just have 1 config is better to manage https://github.com/chocomintapp/chocoserver/blob/a8a781c835baaa0c62b41790a1a9c2ce00730035/src/providers/database/postgres/provider.module.ts

taijusanagi commented 3 years ago

It is better to copy the snapshot in issue to keep tracking

taijusanagi commented 3 years ago

I follow this and config to singleton, without nestjs https://medium.com/@gausmann.simon/nestjs-typeorm-and-postgresql-full-example-development-and-project-setup-working-with-database-c1a2b1b11b8f

taijusanagi commented 3 years ago

How to access relationship ID from Parent's joined field in NestJS/TypeORM https://stackoverflow.com/questions/54163467/how-to-access-relationship-id-from-parents-joined-field-in-nestjs-typeorm

taijusanagi commented 3 years ago

use gRPC for microservice connection and graphql for frontend