wip: currently rewriting the project as a full stack application tangled.org/kacaii.dev/sigo
gleam
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

:bulb: add documentation to the context type

Kacaii b8ed33dd 608c3ca8

+12 -7
+9 -4
src/app/web/context.gleam
··· 1 - import app/web/socket/message as msg 1 + import app/web/socket/message 2 2 import gleam/erlang/process 3 3 import group_registry 4 4 import pog 5 5 6 6 /// Holds any additional data that the request handlers need in addition to the request: 7 - /// Like API Keys, configurations,  database connections, and others 7 + /// Like configurations, database connections, and others 8 8 pub type Context { 9 9 Context( 10 + ///  BEAM's private directory for static files 10 11 static_directory: String, 12 + ///  Postgres's connection pool 11 13 db: pog.Connection, 14 + ///  Key for encryption and decryption 12 15 secret_key_base: String, 13 - registry_name: process.Name(group_registry.Message(msg.Msg)), 16 + ///  Process registry 17 + registry_name: process.Name(group_registry.Message(message.Msg)), 18 + ///  Enviroment where the code is running on 14 19 env: Enviroment, 15 20 ) 16 21 } 17 22 18 - /// Enviroment where the code is running on 23 + ///  Enviroment where the code is running on 19 24 pub type Enviroment { 20 25 ///  Code is running locally 21 26 Dev
+3 -3
src/app/web/socket.gleam
··· 95 95 user_uuid: uuid.Uuid, 96 96 registry: group_registry.GroupRegistry(msg.Msg), 97 97 ) -> Response { 98 - case fetch_user_data(ctx, user_uuid) { 98 + case build_initial_state(ctx, user_uuid) { 99 99 Error(err) -> handle_error(err) 100 100 Ok(state) -> route_request(req, ctx, registry, state) 101 101 } ··· 344 344 #(state, Some(selector)) 345 345 } 346 346 347 - /// Queries the Database and builds the initial state of the user 348 - fn fetch_user_data( 347 + /// 󰥖 Queries the Database and builds the initial state of the connection 348 + fn build_initial_state( 349 349 ctx: Context, 350 350 user_uuid: uuid.Uuid, 351 351 ) -> Result(State, WebSocketError) {