Skip to content

Commit

Permalink
rename hook func
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Dec 5, 2024
1 parent 9572d88 commit 028a860
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/api/src/router/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const releaseJobTriggerRouter = createTRPCRouter({
and(
eq(schema.system.workspaceId, input.workspaceId),
isNull(schema.resource.deletedAt),
schema.jobMatchesCondition(ctx.db, input.filter),
schema.releaseJobMatchesCondition(ctx.db, input.filter),
),
)
.orderBy(asc(schema.releaseJobTrigger.createdAt))
Expand Down Expand Up @@ -220,7 +220,7 @@ const releaseJobTriggerRouter = createTRPCRouter({
and(
eq(schema.system.workspaceId, input.workspaceId),
isNull(schema.resource.deletedAt),
schema.jobMatchesCondition(ctx.db, input.filter),
schema.releaseJobMatchesCondition(ctx.db, input.filter),
),
)
.then(takeFirst)
Expand Down Expand Up @@ -365,7 +365,7 @@ const releaseJobTriggerRouter = createTRPCRouter({
and(
eq(schema.release.id, input.releaseId),
isNull(schema.resource.deletedAt),
schema.jobMatchesCondition(ctx.db, input.filter),
schema.releaseJobMatchesCondition(ctx.db, input.filter),
),
)
.orderBy(desc(schema.releaseJobTrigger.createdAt))
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/router/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import {
environmentPolicyReleaseChannel,
environmentReleaseChannel,
job,
jobMatchesCondition,
jobMetadata,
release,
releaseChannel,
releaseDependency,
releaseJobMatchesCondition,
releaseJobTrigger,
releaseMatchesCondition,
releaseMetadata,
Expand Down Expand Up @@ -116,7 +116,7 @@ export const releaseRouter = createTRPCRouter({
and(
eq(releaseJobTrigger.resourceId, resource.id),
isNull(resource.deletedAt),
jobMatchesCondition(ctx.db, input.jobFilter),
releaseJobMatchesCondition(ctx.db, input.jobFilter),
),
)
.where(
Expand Down
3 changes: 2 additions & 1 deletion packages/db/src/schema/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ const buildVersionCondition = (cond: VersionCondition): SQL => {
return ilike(release.version, `%${cond.value}%`);
return sql`${release.version} ~ ${cond.value}`;
};

const buildCondition = (tx: Tx, cond: JobCondition): SQL => {
if (cond.type === FilterType.Metadata)
return buildMetadataCondition(tx, cond);
Expand Down Expand Up @@ -267,7 +268,7 @@ const buildRunbookCondition = (tx: Tx, cond: JobCondition): SQL | undefined => {
return cond.not ? not(con) : con;
};

export function jobMatchesCondition(
export function releaseJobMatchesCondition(
tx: Tx,
condition?: JobCondition,
): SQL<unknown> | undefined {
Expand Down

0 comments on commit 028a860

Please sign in to comment.