Rates
Organization rates, rate versions, and effective rate resolution.
externalpermissionstable10 procedures
query
rates.listInferred outputList rates for the organization with optional filters. Returns rates with their current version info (including amount).
Input
{
tags?: Array<string> | undefined;
isDefault?: boolean | undefined;
search?: string | undefined;
limit?: number | undefined;
offset?: number | undefined;
rateType?: "cost" | "billable" | undefined;
}Output
PaginatedResult<RateWithCurrentVersion>query
rates.getByIdInferred outputGet a single rate by ID with current version.
Input
{
id: string;
}Output
RateWithCurrentVersion | nullquery
rates.getByCodeInferred outputGet a single rate by code with current version.
Input
{
code: string;
}Output
RateWithCurrentVersion | nullmutation
rates.createInferred outputCreate a new rate with its initial version.
Input
{
name: string;
amount: number;
effectiveFrom: string;
code?: string | undefined;
description?: string | undefined;
tags?: Array<string> | undefined;
isDefault?: boolean | undefined;
currency?: string | undefined;
rateType?: "cost" | "billable" | undefined;
period?: "year" | "hour" | "day" | "week" | "month" | undefined;
hoursPerPeriod?: number | undefined;
applicableRole?: string | undefined;
effectiveTo?: string | undefined;
changeReason?: string | undefined;
}Output
RateWithCurrentVersionmutation
rates.updateInferred outputUpdate a rate's shell properties (not the version/amount). To change the amount, create a new version.
Input
{
id: string;
name?: string | undefined;
description?: string | null | undefined;
tags?: Array<string> | undefined;
isDefault?: boolean | undefined;
currency?: string | undefined;
rateType?: "cost" | "billable" | undefined;
period?: "year" | "hour" | "day" | "week" | "month" | undefined;
hoursPerPeriod?: number | null | undefined;
applicableRole?: string | null | undefined;
}Output
{
id: string;
code: string | null;
organizationId: string;
name: string;
createdAt: Date;
updatedAt: Date | null;
deletedAt: Date | null;
description: string | null;
tags: Array<string> | null;
isDefault: boolean | null;
currentVersionId: string | null;
currency: string | null;
rateType: "cost" | "billable";
period: "year" | "hour" | "day" | "week" | "month";
hoursPerPeriod: string | null;
applicableRole: string | null;
} | nullmutation
rates.deleteInferred outputSoft delete a rate.
Input
{
id: string;
}Output
{
success: boolean;
error: string;
} | {
success: boolean;
error?: undefined;
}mutation
rates.createVersionInferred outputCreate a new version for a rate. This becomes the current version and the previous version's effectiveTo is updated.
Input
{
rateId: string;
amount: number;
effectiveFrom: string;
effectiveTo?: string | undefined;
changeReason?: string | undefined;
}Output
{
id: string;
organizationId: string;
createdAt: Date;
rateId: string;
amount: string;
version: number;
createdByResourceId: string | null;
effectiveFrom: string;
effectiveTo: string | null;
changeReason: string | null;
previousVersionId: string | null;
}query
rates.listVersionsInferred outputList all versions for a rate, ordered by version number descending.
Input
{
rateId: string;
}Output
Array<{
id: string;
organizationId: string;
createdAt: Date;
rateId: string;
amount: string;
version: number;
createdByResourceId: string | null;
effectiveFrom: string;
effectiveTo: string | null;
changeReason: string | null;
previousVersionId: string | null;
}>query
rates.getVersionInferred outputGet a specific rate version by ID.
Input
{
id: string;
}Output
{
id: string;
organizationId: string;
createdAt: Date;
rateId: string;
amount: string;
version: number;
createdByResourceId: string | null;
effectiveFrom: string;
effectiveTo: string | null;
changeReason: string | null;
previousVersionId: string | null;
} | nullquery
rates.getVersionAtDateInferred outputGet the rate version that was effective at a specific date.
Input
{
date: string;
rateId: string;
}Output
{
id: string;
organizationId: string;
createdAt: Date;
rateId: string;
amount: string;
version: number;
createdByResourceId: string | null;
effectiveFrom: string;
effectiveTo: string | null;
changeReason: string | null;
previousVersionId: string | null;
} | null