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

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

Generated by: LCOV version 2.0-1