/* * Copyright 2026 Oleg Borodin * * This work is published and licensed under a Creative Commons * Attribution-NonCommercial-NoDerivatives 4.0 International License. * * Distribution of this work is permitted, but commercial use and * modifications are strictly prohibited. */ package handler import ( "mstore/app/logger" "mstore/app/maindb" "mstore/app/router" "mstore/app/accoper" "mstore/app/fileoper" "mstore/app/imageoper" yaml "go.yaml.in/yaml/v4" ) type HandlerParams struct { MainDB *maindb.Database FileOper *fileoper.Operator AccOper *accoper.Operator ImageOper *imageoper.Operator } type Handler struct { mdb *maindb.Database logg *logger.Logger fiop *fileoper.Operator acop *accoper.Operator imop *imageoper.Operator } func NewHandler(params *HandlerParams) (*Handler, error) { var err error hand := &Handler{ mdb: params.MainDB, fiop: params.FileOper, acop: params.AccOper, imop: params.ImageOper, } hand.logg = logger.NewLoggerWithSubject("handler") return hand, err } func (hand *Handler) DumpHeaders(label string, rctx *router.Context) { headers := rctx.GetHeaders() yamlData, _ := yaml.Marshal(headers) hand.logg.Debugf("%s:\n%s\n", label, string(yamlData)) }