Merge pull request #30 from shumaiOne/feat/rename-metadata-field-key

refactor(metadata): rename field_id to field_key in AssetMetadataValue
This commit is contained in:
Yiling-J
2026-05-28 12:39:49 +08:00
committed by GitHub
15 changed files with 597 additions and 881 deletions
@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "asset_metadata_values" RENAME COLUMN "field_id" TO "field_key";
-- RenameIndex
ALTER INDEX "asset_metadata_values_asset_id_field_id_key" RENAME TO "asset_metadata_values_asset_id_field_key_key";
+2 -2
View File
@@ -424,7 +424,7 @@ model StorageKey {
model AssetMetadataValue {
id String @id @default(ulid())
assetId String @map("asset_id")
fieldId String @map("field_id") // key from MetadataField
fieldKey String @map("field_key") // key from MetadataField
stringValue String? @map("string_value")
numberValue Float? @map("number_value")
@@ -434,7 +434,7 @@ model AssetMetadataValue {
asset Asset @relation("AssetToMetadataValues", fields: [assetId], references: [id], onDelete: Cascade)
@@unique([assetId, fieldId])
@@unique([assetId, fieldKey])
@@index([numberValue])
@@index([stringValue])
@@index([booleanValue])
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -3050,7 +3050,7 @@ export type StorageKeyScalarFieldEnum = (typeof StorageKeyScalarFieldEnum)[keyof
export const AssetMetadataValueScalarFieldEnum = {
id: 'id',
assetId: 'assetId',
fieldId: 'fieldId',
fieldKey: 'fieldKey',
stringValue: 'stringValue',
numberValue: 'numberValue',
booleanValue: 'booleanValue',
+1 -1
View File
@@ -309,7 +309,7 @@ export type StorageKeyScalarFieldEnum = (typeof StorageKeyScalarFieldEnum)[keyof
export const AssetMetadataValueScalarFieldEnum = {
id: 'id',
assetId: 'assetId',
fieldId: 'fieldId',
fieldKey: 'fieldKey',
stringValue: 'stringValue',
numberValue: 'numberValue',
booleanValue: 'booleanValue',
+40 -40
View File
@@ -39,7 +39,7 @@ export type AssetMetadataValueSumAggregateOutputType = {
export type AssetMetadataValueMinAggregateOutputType = {
id: string | null
assetId: string | null
fieldId: string | null
fieldKey: string | null
stringValue: string | null
numberValue: number | null
booleanValue: boolean | null
@@ -49,7 +49,7 @@ export type AssetMetadataValueMinAggregateOutputType = {
export type AssetMetadataValueMaxAggregateOutputType = {
id: string | null
assetId: string | null
fieldId: string | null
fieldKey: string | null
stringValue: string | null
numberValue: number | null
booleanValue: boolean | null
@@ -59,7 +59,7 @@ export type AssetMetadataValueMaxAggregateOutputType = {
export type AssetMetadataValueCountAggregateOutputType = {
id: number
assetId: number
fieldId: number
fieldKey: number
stringValue: number
numberValue: number
booleanValue: number
@@ -80,7 +80,7 @@ export type AssetMetadataValueSumAggregateInputType = {
export type AssetMetadataValueMinAggregateInputType = {
id?: true
assetId?: true
fieldId?: true
fieldKey?: true
stringValue?: true
numberValue?: true
booleanValue?: true
@@ -90,7 +90,7 @@ export type AssetMetadataValueMinAggregateInputType = {
export type AssetMetadataValueMaxAggregateInputType = {
id?: true
assetId?: true
fieldId?: true
fieldKey?: true
stringValue?: true
numberValue?: true
booleanValue?: true
@@ -100,7 +100,7 @@ export type AssetMetadataValueMaxAggregateInputType = {
export type AssetMetadataValueCountAggregateInputType = {
id?: true
assetId?: true
fieldId?: true
fieldKey?: true
stringValue?: true
numberValue?: true
booleanValue?: true
@@ -198,7 +198,7 @@ export type AssetMetadataValueGroupByArgs<ExtArgs extends runtime.Types.Extensio
export type AssetMetadataValueGroupByOutputType = {
id: string
assetId: string
fieldId: string
fieldKey: string
stringValue: string | null
numberValue: number | null
booleanValue: boolean | null
@@ -232,7 +232,7 @@ export type AssetMetadataValueWhereInput = {
NOT?: Prisma.AssetMetadataValueWhereInput | Prisma.AssetMetadataValueWhereInput[]
id?: Prisma.StringFilter<"AssetMetadataValue"> | string
assetId?: Prisma.StringFilter<"AssetMetadataValue"> | string
fieldId?: Prisma.StringFilter<"AssetMetadataValue"> | string
fieldKey?: Prisma.StringFilter<"AssetMetadataValue"> | string
stringValue?: Prisma.StringNullableFilter<"AssetMetadataValue"> | string | null
numberValue?: Prisma.FloatNullableFilter<"AssetMetadataValue"> | number | null
booleanValue?: Prisma.BoolNullableFilter<"AssetMetadataValue"> | boolean | null
@@ -244,7 +244,7 @@ export type AssetMetadataValueWhereInput = {
export type AssetMetadataValueOrderByWithRelationInput = {
id?: Prisma.SortOrder
assetId?: Prisma.SortOrder
fieldId?: Prisma.SortOrder
fieldKey?: Prisma.SortOrder
stringValue?: Prisma.SortOrderInput | Prisma.SortOrder
numberValue?: Prisma.SortOrderInput | Prisma.SortOrder
booleanValue?: Prisma.SortOrderInput | Prisma.SortOrder
@@ -255,24 +255,24 @@ export type AssetMetadataValueOrderByWithRelationInput = {
export type AssetMetadataValueWhereUniqueInput = Prisma.AtLeast<{
id?: string
assetId_fieldId?: Prisma.AssetMetadataValueAssetIdFieldIdCompoundUniqueInput
assetId_fieldKey?: Prisma.AssetMetadataValueAssetIdFieldKeyCompoundUniqueInput
AND?: Prisma.AssetMetadataValueWhereInput | Prisma.AssetMetadataValueWhereInput[]
OR?: Prisma.AssetMetadataValueWhereInput[]
NOT?: Prisma.AssetMetadataValueWhereInput | Prisma.AssetMetadataValueWhereInput[]
assetId?: Prisma.StringFilter<"AssetMetadataValue"> | string
fieldId?: Prisma.StringFilter<"AssetMetadataValue"> | string
fieldKey?: Prisma.StringFilter<"AssetMetadataValue"> | string
stringValue?: Prisma.StringNullableFilter<"AssetMetadataValue"> | string | null
numberValue?: Prisma.FloatNullableFilter<"AssetMetadataValue"> | number | null
booleanValue?: Prisma.BoolNullableFilter<"AssetMetadataValue"> | boolean | null
jsonValue?: Prisma.JsonNullableFilter<"AssetMetadataValue">
dateValue?: Prisma.DateTimeNullableFilter<"AssetMetadataValue"> | Date | string | null
asset?: Prisma.XOR<Prisma.AssetScalarRelationFilter, Prisma.AssetWhereInput>
}, "id" | "assetId_fieldId">
}, "id" | "assetId_fieldKey">
export type AssetMetadataValueOrderByWithAggregationInput = {
id?: Prisma.SortOrder
assetId?: Prisma.SortOrder
fieldId?: Prisma.SortOrder
fieldKey?: Prisma.SortOrder
stringValue?: Prisma.SortOrderInput | Prisma.SortOrder
numberValue?: Prisma.SortOrderInput | Prisma.SortOrder
booleanValue?: Prisma.SortOrderInput | Prisma.SortOrder
@@ -291,7 +291,7 @@ export type AssetMetadataValueScalarWhereWithAggregatesInput = {
NOT?: Prisma.AssetMetadataValueScalarWhereWithAggregatesInput | Prisma.AssetMetadataValueScalarWhereWithAggregatesInput[]
id?: Prisma.StringWithAggregatesFilter<"AssetMetadataValue"> | string
assetId?: Prisma.StringWithAggregatesFilter<"AssetMetadataValue"> | string
fieldId?: Prisma.StringWithAggregatesFilter<"AssetMetadataValue"> | string
fieldKey?: Prisma.StringWithAggregatesFilter<"AssetMetadataValue"> | string
stringValue?: Prisma.StringNullableWithAggregatesFilter<"AssetMetadataValue"> | string | null
numberValue?: Prisma.FloatNullableWithAggregatesFilter<"AssetMetadataValue"> | number | null
booleanValue?: Prisma.BoolNullableWithAggregatesFilter<"AssetMetadataValue"> | boolean | null
@@ -301,7 +301,7 @@ export type AssetMetadataValueScalarWhereWithAggregatesInput = {
export type AssetMetadataValueCreateInput = {
id?: string
fieldId: string
fieldKey: string
stringValue?: string | null
numberValue?: number | null
booleanValue?: boolean | null
@@ -313,7 +313,7 @@ export type AssetMetadataValueCreateInput = {
export type AssetMetadataValueUncheckedCreateInput = {
id?: string
assetId: string
fieldId: string
fieldKey: string
stringValue?: string | null
numberValue?: number | null
booleanValue?: boolean | null
@@ -323,7 +323,7 @@ export type AssetMetadataValueUncheckedCreateInput = {
export type AssetMetadataValueUpdateInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
fieldId?: Prisma.StringFieldUpdateOperationsInput | string
fieldKey?: Prisma.StringFieldUpdateOperationsInput | string
stringValue?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
numberValue?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
booleanValue?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
@@ -335,7 +335,7 @@ export type AssetMetadataValueUpdateInput = {
export type AssetMetadataValueUncheckedUpdateInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
fieldId?: Prisma.StringFieldUpdateOperationsInput | string
fieldKey?: Prisma.StringFieldUpdateOperationsInput | string
stringValue?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
numberValue?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
booleanValue?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
@@ -346,7 +346,7 @@ export type AssetMetadataValueUncheckedUpdateInput = {
export type AssetMetadataValueCreateManyInput = {
id?: string
assetId: string
fieldId: string
fieldKey: string
stringValue?: string | null
numberValue?: number | null
booleanValue?: boolean | null
@@ -356,7 +356,7 @@ export type AssetMetadataValueCreateManyInput = {
export type AssetMetadataValueUpdateManyMutationInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
fieldId?: Prisma.StringFieldUpdateOperationsInput | string
fieldKey?: Prisma.StringFieldUpdateOperationsInput | string
stringValue?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
numberValue?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
booleanValue?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
@@ -367,7 +367,7 @@ export type AssetMetadataValueUpdateManyMutationInput = {
export type AssetMetadataValueUncheckedUpdateManyInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
assetId?: Prisma.StringFieldUpdateOperationsInput | string
fieldId?: Prisma.StringFieldUpdateOperationsInput | string
fieldKey?: Prisma.StringFieldUpdateOperationsInput | string
stringValue?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
numberValue?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
booleanValue?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
@@ -385,15 +385,15 @@ export type AssetMetadataValueOrderByRelationAggregateInput = {
_count?: Prisma.SortOrder
}
export type AssetMetadataValueAssetIdFieldIdCompoundUniqueInput = {
export type AssetMetadataValueAssetIdFieldKeyCompoundUniqueInput = {
assetId: string
fieldId: string
fieldKey: string
}
export type AssetMetadataValueCountOrderByAggregateInput = {
id?: Prisma.SortOrder
assetId?: Prisma.SortOrder
fieldId?: Prisma.SortOrder
fieldKey?: Prisma.SortOrder
stringValue?: Prisma.SortOrder
numberValue?: Prisma.SortOrder
booleanValue?: Prisma.SortOrder
@@ -408,7 +408,7 @@ export type AssetMetadataValueAvgOrderByAggregateInput = {
export type AssetMetadataValueMaxOrderByAggregateInput = {
id?: Prisma.SortOrder
assetId?: Prisma.SortOrder
fieldId?: Prisma.SortOrder
fieldKey?: Prisma.SortOrder
stringValue?: Prisma.SortOrder
numberValue?: Prisma.SortOrder
booleanValue?: Prisma.SortOrder
@@ -418,7 +418,7 @@ export type AssetMetadataValueMaxOrderByAggregateInput = {
export type AssetMetadataValueMinOrderByAggregateInput = {
id?: Prisma.SortOrder
assetId?: Prisma.SortOrder
fieldId?: Prisma.SortOrder
fieldKey?: Prisma.SortOrder
stringValue?: Prisma.SortOrder
numberValue?: Prisma.SortOrder
booleanValue?: Prisma.SortOrder
@@ -485,7 +485,7 @@ export type NullableBoolFieldUpdateOperationsInput = {
export type AssetMetadataValueCreateWithoutAssetInput = {
id?: string
fieldId: string
fieldKey: string
stringValue?: string | null
numberValue?: number | null
booleanValue?: boolean | null
@@ -495,7 +495,7 @@ export type AssetMetadataValueCreateWithoutAssetInput = {
export type AssetMetadataValueUncheckedCreateWithoutAssetInput = {
id?: string
fieldId: string
fieldKey: string
stringValue?: string | null
numberValue?: number | null
booleanValue?: boolean | null
@@ -535,7 +535,7 @@ export type AssetMetadataValueScalarWhereInput = {
NOT?: Prisma.AssetMetadataValueScalarWhereInput | Prisma.AssetMetadataValueScalarWhereInput[]
id?: Prisma.StringFilter<"AssetMetadataValue"> | string
assetId?: Prisma.StringFilter<"AssetMetadataValue"> | string
fieldId?: Prisma.StringFilter<"AssetMetadataValue"> | string
fieldKey?: Prisma.StringFilter<"AssetMetadataValue"> | string
stringValue?: Prisma.StringNullableFilter<"AssetMetadataValue"> | string | null
numberValue?: Prisma.FloatNullableFilter<"AssetMetadataValue"> | number | null
booleanValue?: Prisma.BoolNullableFilter<"AssetMetadataValue"> | boolean | null
@@ -545,7 +545,7 @@ export type AssetMetadataValueScalarWhereInput = {
export type AssetMetadataValueCreateManyAssetInput = {
id?: string
fieldId: string
fieldKey: string
stringValue?: string | null
numberValue?: number | null
booleanValue?: boolean | null
@@ -555,7 +555,7 @@ export type AssetMetadataValueCreateManyAssetInput = {
export type AssetMetadataValueUpdateWithoutAssetInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
fieldId?: Prisma.StringFieldUpdateOperationsInput | string
fieldKey?: Prisma.StringFieldUpdateOperationsInput | string
stringValue?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
numberValue?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
booleanValue?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
@@ -565,7 +565,7 @@ export type AssetMetadataValueUpdateWithoutAssetInput = {
export type AssetMetadataValueUncheckedUpdateWithoutAssetInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
fieldId?: Prisma.StringFieldUpdateOperationsInput | string
fieldKey?: Prisma.StringFieldUpdateOperationsInput | string
stringValue?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
numberValue?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
booleanValue?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
@@ -575,7 +575,7 @@ export type AssetMetadataValueUncheckedUpdateWithoutAssetInput = {
export type AssetMetadataValueUncheckedUpdateManyWithoutAssetInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
fieldId?: Prisma.StringFieldUpdateOperationsInput | string
fieldKey?: Prisma.StringFieldUpdateOperationsInput | string
stringValue?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
numberValue?: Prisma.NullableFloatFieldUpdateOperationsInput | number | null
booleanValue?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
@@ -588,7 +588,7 @@ export type AssetMetadataValueUncheckedUpdateManyWithoutAssetInput = {
export type AssetMetadataValueSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
assetId?: boolean
fieldId?: boolean
fieldKey?: boolean
stringValue?: boolean
numberValue?: boolean
booleanValue?: boolean
@@ -600,7 +600,7 @@ export type AssetMetadataValueSelect<ExtArgs extends runtime.Types.Extensions.In
export type AssetMetadataValueSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
assetId?: boolean
fieldId?: boolean
fieldKey?: boolean
stringValue?: boolean
numberValue?: boolean
booleanValue?: boolean
@@ -612,7 +612,7 @@ export type AssetMetadataValueSelectCreateManyAndReturn<ExtArgs extends runtime.
export type AssetMetadataValueSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
assetId?: boolean
fieldId?: boolean
fieldKey?: boolean
stringValue?: boolean
numberValue?: boolean
booleanValue?: boolean
@@ -624,7 +624,7 @@ export type AssetMetadataValueSelectUpdateManyAndReturn<ExtArgs extends runtime.
export type AssetMetadataValueSelectScalar = {
id?: boolean
assetId?: boolean
fieldId?: boolean
fieldKey?: boolean
stringValue?: boolean
numberValue?: boolean
booleanValue?: boolean
@@ -632,7 +632,7 @@ export type AssetMetadataValueSelectScalar = {
dateValue?: boolean
}
export type AssetMetadataValueOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "assetId" | "fieldId" | "stringValue" | "numberValue" | "booleanValue" | "jsonValue" | "dateValue", ExtArgs["result"]["assetMetadataValue"]>
export type AssetMetadataValueOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "assetId" | "fieldKey" | "stringValue" | "numberValue" | "booleanValue" | "jsonValue" | "dateValue", ExtArgs["result"]["assetMetadataValue"]>
export type AssetMetadataValueInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
asset?: boolean | Prisma.AssetDefaultArgs<ExtArgs>
}
@@ -651,7 +651,7 @@ export type $AssetMetadataValuePayload<ExtArgs extends runtime.Types.Extensions.
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
assetId: string
fieldId: string
fieldKey: string
stringValue: string | null
numberValue: number | null
booleanValue: boolean | null
@@ -1083,7 +1083,7 @@ export interface Prisma__AssetMetadataValueClient<T, Null = never, ExtArgs exten
export interface AssetMetadataValueFieldRefs {
readonly id: Prisma.FieldRef<"AssetMetadataValue", 'String'>
readonly assetId: Prisma.FieldRef<"AssetMetadataValue", 'String'>
readonly fieldId: Prisma.FieldRef<"AssetMetadataValue", 'String'>
readonly fieldKey: Prisma.FieldRef<"AssetMetadataValue", 'String'>
readonly stringValue: Prisma.FieldRef<"AssetMetadataValue", 'String'>
readonly numberValue: Prisma.FieldRef<"AssetMetadataValue", 'Float'>
readonly booleanValue: Prisma.FieldRef<"AssetMetadataValue", 'Boolean'>
+527 -816
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1520,7 +1520,7 @@ export class AssetService {
} else if (mv.booleanValue !== null) {
value = mv.booleanValue
}
fieldValues.push({ fieldId: mv.fieldId, value })
fieldValues.push({ fieldId: mv.fieldKey, value })
}
}
+4 -4
View File
@@ -151,9 +151,9 @@ describe('MetadataService', () => {
where: { assetId: asset.id },
})
expect(values).toHaveLength(2)
const width = values.find((v) => v.fieldId === 'resolution_width')
const width = values.find((v) => v.fieldKey === 'resolution_width')
expect(width?.numberValue).toBe(1920)
const height = values.find((v) => v.fieldId === 'resolution_height')
const height = values.find((v) => v.fieldKey === 'resolution_height')
expect(height?.numberValue).toBe(1080)
})
@@ -196,9 +196,9 @@ describe('MetadataService', () => {
const val = await prisma.assetMetadataValue.findUnique({
where: {
// eslint-disable-next-line @typescript-eslint/naming-convention
assetId_fieldId: {
assetId_fieldKey: {
assetId: asset.id,
fieldId: field.key,
fieldKey: field.key,
},
},
})
+3 -3
View File
@@ -309,14 +309,14 @@ export class MetadataService {
await tx.assetMetadataValue.upsert({
where: {
// eslint-disable-next-line @typescript-eslint/naming-convention
assetId_fieldId: {
assetId_fieldKey: {
assetId: resolvedAssetId,
fieldId: req.key,
fieldKey: req.key,
},
},
create: {
assetId: resolvedAssetId,
fieldId: req.key,
fieldKey: req.key,
stringValue,
numberValue,
booleanValue,
+2 -2
View File
@@ -330,7 +330,7 @@ describe('ProjectService', () => {
await prisma.assetMetadataValue.create({
data: {
assetId: fileC.id,
fieldId: 'test-field',
fieldKey: 'test-field',
stringValue: 'test-value',
},
})
@@ -370,7 +370,7 @@ describe('ProjectService', () => {
expect(
await prisma.assetMetadataValue.findUnique({
// eslint-disable-next-line @typescript-eslint/naming-convention
where: { assetId_fieldId: { assetId: fileC.id, fieldId: 'test-field' } },
where: { assetId_fieldKey: { assetId: fileC.id, fieldKey: 'test-field' } },
}),
).toBeNull()
expect(await prisma.assetComment.findUnique({ where: { id: comment.id } })).toBeNull()
+1 -1
View File
@@ -81,7 +81,7 @@ describe('SearchService', () => {
await prisma.assetMetadataValue.create({
data: {
assetId: file2.id,
fieldId: 'status',
fieldKey: 'status',
stringValue: 'approved',
},
})
+5 -5
View File
@@ -235,14 +235,14 @@ export class SearchService {
}
// EAV queries on metadataValues
const baseFilter = { fieldId: field }
const baseFilter = { fieldKey: field }
// Handle Empty/NotEmpty globally for EAV
if (operator === 'isEmpty') {
return { metadataValues: { none: { fieldId: field } } }
return { metadataValues: { none: { fieldKey: field } } }
}
if (operator === 'isNotEmpty') {
return { metadataValues: { some: { fieldId: field } } }
return { metadataValues: { some: { fieldKey: field } } }
}
const valuePredicate = (): Prisma.AssetMetadataValueWhereInput => {
@@ -295,11 +295,11 @@ export class SearchService {
// "is not" in EAV context: either the field doesn't exist,
// OR it exists but has a different value.
OR: [
{ metadataValues: { none: { fieldId: field } } },
{ metadataValues: { none: { fieldKey: field } } },
{
metadataValues: {
some: {
fieldId: field,
fieldKey: field,
NOT: valuePredicate(),
},
},
@@ -68,7 +68,7 @@ describe('Agent Autofill Workflow', () => {
})
mockActivities.extractAiMetadataActivity.mockResolvedValue(['/tmp/1.webp'])
mockActivities.getProjectAutofillFieldsActivity.mockResolvedValue([
{ id: 'f1', config: { name: 'F1', type: 'text' } },
{ id: 'f1', key: 'f1', config: { name: 'F1', type: 'text' } },
])
mockActivities.getAgentAutofillContextActivity.mockResolvedValue({ agent: { id: 'b1' } })
mockActivities.getAgentWorkerQueueActivity.mockResolvedValue('agent_queue')
+1 -1
View File
@@ -121,7 +121,7 @@ export async function agentAutofillMedia(task: WorkflowTask): Promise<void> {
teamId,
images: generatedFiles,
fields: fields.map((f) => ({
id: f.id,
id: f.key,
config: f.config as unknown as PrismaJson.FieldConfig,
description: f.description,
})),