I'm getting this error error: null value in column "reimb_amount" violates not-null constraint
All my columns are actually returning null. detail:
'Failing row contains (23, null, null, null, null, null, null, null, null).',
but in my Postman I am making sure I have all the columns filled in to send to the database like this.
{
"reimb_amount": 400,
"reimb_submitted": {{$timestamp}},
"reimb_resolved": {{$timestamp}},
"reimb_description": "Travel to Alaska",
"reimb_author": 8,
"reimb_resolver": 1,
"reimb_status_id": 1,
"reimb_type_id": 2
}
My DAO looks like this
// * @param reimbursement
export async function createReimbursement(reimbursement:
ReimbRequest): Promise<number> {
const client = await connectionPool.connect();
try {
const res = await client.query(
`INSERT INTO expense_reimbursement.ers_reimbursement
(reimb_amount, reimb_submitted, reimb_description, reimb_author,
reimb_status_id, reimb_type_id )
VALUES ($1, $2, $3, $4, $5, $6, $7)
RETURNING reimb_id`,[
reimbursement.amount,
reimbursement.submitted,
reimbursement.description,
reimbursement.author,
reimbursement.resolver,
reimbursement.status,
reimbursement.type
]
);
return res.rows[0].reimb_id;
} finally {
client.release();
}
}
If you need to see anything else let me know. Thanks for any help.
You should have just amount instead of reimbursement.reimb_amount in Postman