Skip to content

Commit 985750a

Browse files
committed
Fix overriding data on accident
1 parent 5c81985 commit 985750a

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

src/api/routes/organizations.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -462,17 +462,18 @@ const organizationsPlugin: FastifyPluginAsync = async (fastify, _options) => {
462462
TransactItems: [
463463
...(logStatement ? [logStatement] : []),
464464
{
465-
Put: {
465+
Update: {
466466
TableName: genericConfig.SigInfoTableName,
467-
Item: marshall(
468-
{
469-
primaryKey: `DEFINE#${request.params.orgId}`,
470-
entryId: "0",
471-
leadsEntraGroupId: entraGroupId,
472-
updatedAt: new Date().toISOString(),
473-
},
474-
{ removeUndefinedValues: true },
475-
),
467+
Key: marshall({
468+
primaryKey: `DEFINE#${request.params.orgId}`,
469+
entryId: "0",
470+
}),
471+
UpdateExpression:
472+
"SET leadsEntraGroupId = :entraGroupId, updatedAt = :updatedAt",
473+
ExpressionAttributeValues: marshall({
474+
":entraGroupId": entraGroupId,
475+
":updatedAt": new Date().toISOString(),
476+
}),
476477
},
477478
},
478479
],
@@ -542,17 +543,18 @@ const organizationsPlugin: FastifyPluginAsync = async (fastify, _options) => {
542543
TransactItems: [
543544
...(logStatement ? [logStatement] : []),
544545
{
545-
Put: {
546+
Update: {
546547
TableName: genericConfig.SigInfoTableName,
547-
Item: marshall(
548-
{
549-
primaryKey: `DEFINE#${request.params.orgId}`,
550-
entryId: "0",
551-
leadsGithubTeamId: githubTeamId,
552-
updatedAt: new Date().toISOString(),
553-
},
554-
{ removeUndefinedValues: true },
555-
),
548+
Key: marshall({
549+
primaryKey: `DEFINE#${request.params.orgId}`,
550+
entryId: "0",
551+
}),
552+
UpdateExpression:
553+
"SET leadsGithubTeamId = :githubTeamId, updatedAt = :updatedAt",
554+
ExpressionAttributeValues: marshall({
555+
":githubTeamId": githubTeamId,
556+
":updatedAt": new Date().toISOString(),
557+
}),
556558
},
557559
},
558560
],

0 commit comments

Comments
 (0)