살다보면 SQL 배열 길이가 필요할 때가 온다. 그게 바로 지금이다.
https://atotw.tistory.com/302
https://neon.tech/postgresql/postgresql-json-functions/postgresql-jsonb_array_length
https://logical-code.tistory.com/44
https://mine-it-record.tistory.com/418
https://dog-developers.tistory.com/172
UPDATE "MY_RECIPE_TABLE"
SET recipe_level = CASE
WHEN jsonb_array_length(recipe_ingredients) > 0 AND jsonb_array_length(recipe_ingredients)<=3 THEN '하'
WHEN jsonb_array_length(recipe_ingredients) >= 4 AND jsonb_array_length(recipe_ingredients)<=6 THEN '중'
WHEN jsonb_array_length(recipe_ingredients) >= 7 THEN '상'
END
WHERE recipe_level IS NULL
const getEnumKeyByEnumValue = <TEnumKey extends string, TEnumVal extends string | number>(
myEnum: { [key in TEnumKey]: TEnumVal },
enumValue: TEnumVal
): string => {
const keys = (Object.keys(myEnum) as TEnumKey[]).filter((x) => myEnum[x] === enumValue);
return keys.length > 0 ? keys[0] : "";
};
이것저것 해봤는데 이게 제일 확실한 듯! 감사합니다 선배림들.

그리고 여기서도 as Enum 안 해주면 타입에러남
대체 이게 뭐라고 시간 날린건지......
웬만하면 Enum은 다시 마주치고 싶지 않다 😮