Skip to content

Commit

Permalink
Apply persistence layer transformations to teams type
Browse files Browse the repository at this point in the history
[Re #1611]

* The teams properties are used internally as keywords so before
inserting into the db and before returning to callers we should
transform all the values of teams key into keywords.
  • Loading branch information
lucassousaf committed Oct 6, 2023
1 parent 6c6e0e9 commit 4bf9d7b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions backend/src/gpml/db/plastic_strategy/team.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
[ps-team-member]
(-> ps-team-member
(util/update-if-not-nil :role name)
(util/update-if-not-nil :teams util.pgsql/->JDBCArray "plastic_strategy_team_type")))
(util/update-if-not-nil :teams (comp
#(util.pgsql/->JDBCArray % "plastic_strategy_team_type")
#(map name %)))))

(defn- p-ps-team-member->ps-team-member
[p-ps-team-member]
(util/update-if-not-nil p-ps-team-member :role keyword))
(-> p-ps-team-member
(util/update-if-not-nil :role keyword)
(util/update-if-not-nil :teams #(map keyword %))))

(defn add-ps-team-member
[conn ps-team-member]
Expand Down

0 comments on commit 4bf9d7b

Please # to comment.