LCOV - code coverage report
Current view: top level - schemas/domain - bracket_match_slots.clj Coverage Total Hit
Test: lcov.info Lines: 79.4 % 34 27
Test Date: 2026-11-23 18:11:10 Functions: - 0 0

            Line data    Source code
       1            4 : (ns schemas.domain.bracket-match-slots
       2              :   (:require
       3              :    [malli.core :as m]
       4              :    [malli.error :as me]))
       5              : 
       6              : 
       7            4 : (def BracketMatchSlotRecordSchema
       8           28 :   [:map {:swagger/title       "BracketMatchSlotRecord"
       9              :          :swagger/description "Complete bracket match slot record from database"}
      10           20 :    [:uuid [:ref :types/UuidString]]
      11           20 :    [:bracket-match-id [:ref :types/UuidString]]
      12           12 :    [:slot :int]
      13            8 :    [:source-type
      14           28 :     [:string {:description "Slot source type"
      15              :               :example     "seed"}]]
      16           20 :    [:source-seed {:optional true}
      17           12 :     [:maybe :int]]
      18           20 :    [:source-match-id {:optional true}
      19           20 :     [:maybe [:ref :types/UuidString]]]
      20           20 :    [:participant-id {:optional true}
      21           20 :     [:maybe [:ref :types/UuidString]]]
      22           20 :    [:source [:ref :matchscore/source]]])
      23              : 
      24              : 
      25            4 : (defrecord
      26              :   BracketMatchSlotRecord
      27              :   [uuid bracket-match-id slot source-type source-seed source-match-id participant-id source])
      28              : 
      29              : 
      30            4 : (defn make-bracket-match-slot-record
      31              :  "Creates a BracketMatchSlot record with validation.
      32              :    Note: This validation uses the default registry. Ensure schemas.registry/init-registry!
      33              :    has been called before using this function."
      34              :  {:malli/schema [:=> [:cat BracketMatchSlotRecordSchema] BracketMatchSlotRecordSchema]}
      35              :  [{:keys [uuid bracket-match-id slot source-type source-seed source-match-id participant-id source]
      36              :    :as   bracket-match-slot-data}]
      37           20 :  (if (m/validate BracketMatchSlotRecordSchema bracket-match-slot-data)
      38            8 :    (map->BracketMatchSlotRecord
      39           40 :     {:uuid            uuid
      40            4 :      :bracket-match-id bracket-match-id
      41            4 :      :slot            slot
      42            4 :      :source-type     source-type
      43            4 :      :source-seed     source-seed
      44            4 :      :source-match-id source-match-id
      45            4 :      :participant-id  participant-id
      46            4 :      :source          source})
      47            0 :    (throw
      48            0 :     (ex-info
      49              :      "Invalid bracket match slot data"
      50            0 :      {:type   :internal-validation-error
      51            0 :       :schema BracketMatchSlotRecordSchema
      52            0 :       :data   bracket-match-slot-data
      53            0 :       :humanized-errors (me/humanize
      54            0 :                          (m/explain BracketMatchSlotRecordSchema bracket-match-slot-data))}))))
        

Generated by: LCOV version 2.0-1