Skip to content

Commit

Permalink
Merge pull request #928 from OpenSourceFellows/add_merge_vars_to_lett…
Browse files Browse the repository at this point in the history
…er_table

Added merge_variable column to letters table
  • Loading branch information
DietBepis1 authored May 28, 2024
2 parents 2515f2b + 0d0ddc5 commit 608f27f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"db:create": "npm run db:create:dev && npm run db:create:test",
"db:create:dev": "node script/create-db.js --env development",
"db:create:test": "node script/drop-db.js --env test && node script/create-db.js --env test",
"db:migrate:create": "knex migrate:make --name",
"db:migrate:create": "knex migrate:make",
"db:migrate": "npm run db:migrate:dev && npm run db:migrate:test",
"db:migrate:dev": "knex migrate:latest --verbose --env development",
"db:migrate:test": "knex migrate:latest --verbose --env test",
Expand Down
13 changes: 13 additions & 0 deletions server/db/migrations/20240528021821_add_letter_merge_vars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
async up(knex) {
await knex.schema.alterTable('letters', (table) => {
table.jsonb('merge_variables').nullable()
})
},

async down(knex) {
await knex.schema.alterTable('letters', (table) => {
table.dropColumn('merge_variables')
})
}
}
4 changes: 3 additions & 1 deletion src/components/DonateMoney.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default {
const letterId = this.$store.state.letterId
const letterVersion = this.$store.state.letterVersion
const returnAddressId = this.$store.state.lobReturnAddressId
const mergeVariables = this.$store.state.mergeVariables
return {
letterTemplate: letterId,
Expand All @@ -114,7 +115,8 @@ export default {
state: rep.address_state,
city: rep.address_city,
zip: rep.address_zip,
returnAddress: returnAddressId
returnAddress: returnAddressId,
mergeVariables
}
},
styledCustomDonation() {
Expand Down
3 changes: 2 additions & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export default new Vuex.Store({
state: '',
zip: '',
email: ''
}
},
mergeVariables: {}
},
mutations: {
// TODO: Do we really need two setters here?
Expand Down

0 comments on commit 608f27f

Please sign in to comment.