Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions lib/artists/__tests__/buildGetArtistsParams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe("buildGetArtistsParams", () => {
it("returns auth accountId for personal key", async () => {
const result = await buildGetArtistsParams({
accountId: "personal-account-123",
orgId: null,
});

expect(result).toEqual({
Expand All @@ -27,7 +26,6 @@ describe("buildGetArtistsParams", () => {
it("returns auth accountId for org key", async () => {
const result = await buildGetArtistsParams({
accountId: "org-owner-123",
orgId: "org-123",
});

expect(result).toEqual({
Expand All @@ -39,7 +37,6 @@ describe("buildGetArtistsParams", () => {
it("defaults orgId to null when orgIdFilter is omitted", async () => {
const result = await buildGetArtistsParams({
accountId: "account-123",
orgId: null,
});

expect(result.params?.orgId).toBeNull();
Expand All @@ -48,7 +45,6 @@ describe("buildGetArtistsParams", () => {
it("passes orgIdFilter through when provided", async () => {
const result = await buildGetArtistsParams({
accountId: "account-123",
orgId: null,
orgIdFilter: "filter-org-456",
});

Expand All @@ -63,7 +59,6 @@ describe("buildGetArtistsParams", () => {

const result = await buildGetArtistsParams({
accountId: "org-owner-123",
orgId: "org-123",
targetAccountId: "target-456",
});

Expand All @@ -82,7 +77,6 @@ describe("buildGetArtistsParams", () => {

const result = await buildGetArtistsParams({
accountId: "org-owner-123",
orgId: "org-123",
targetAccountId: "target-456",
orgIdFilter: "filter-org-789",
});
Expand All @@ -98,7 +92,6 @@ describe("buildGetArtistsParams", () => {

const result = await buildGetArtistsParams({
accountId: "personal-123",
orgId: null,
targetAccountId: "shared-org-member",
});

Expand All @@ -117,7 +110,6 @@ describe("buildGetArtistsParams", () => {

const result = await buildGetArtistsParams({
accountId: "personal-123",
orgId: null,
targetAccountId: "other-account",
});

Expand All @@ -132,7 +124,6 @@ describe("buildGetArtistsParams", () => {

const result = await buildGetArtistsParams({
accountId: "org-owner-123",
orgId: "org-123",
targetAccountId: "not-in-org",
});

Expand Down
8 changes: 3 additions & 5 deletions lib/artists/buildGetArtistsParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import type { GetArtistsOptions } from "@/lib/artists/getArtists";
export interface BuildGetArtistsParamsInput {
/** The authenticated account ID */
accountId: string;
/** The organization ID from the API key (null for personal keys) */
orgId: string | null;
/** Optional target account ID to filter by */
targetAccountId?: string;
/** Optional organization filter for which artists to show */
Expand All @@ -31,7 +29,7 @@ export type BuildGetArtistsParamsResult =
export async function buildGetArtistsParams(
input: BuildGetArtistsParamsInput,
): Promise<BuildGetArtistsParamsResult> {
const { accountId, orgId, targetAccountId, orgIdFilter } = input;
const { accountId, targetAccountId, orgIdFilter } = input;

let effectiveAccountId = accountId;

Expand All @@ -50,8 +48,8 @@ export async function buildGetArtistsParams(
effectiveAccountId = targetAccountId;
}

// When org_id is omitted, default to personal artists (null = personal only)
// When org_id is provided, filter to that organization's artists
// When orgIdFilter is omitted, default to personal artists (null = personal only)
// When orgIdFilter is provided, filter to that organization's artists
const effectiveOrgId = orgIdFilter ?? null;

return {
Expand Down
3 changes: 1 addition & 2 deletions lib/artists/validateGetArtistsRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ export async function validateGetArtistsRequest(
return authResult;
}

const { accountId, orgId } = authResult;
const { accountId } = authResult;

// Use shared function to build params
const { params, error } = await buildGetArtistsParams({
accountId,
orgId,
targetAccountId,
orgIdFilter,
});
Expand Down
Loading
Loading