[bug] enum `@map()` not handled
Closed this issue · 0 comments
cayter commented
We have enums defined like the below
enum CountryCode {
AD
AE
}
enum Religion {
BUDDHISM @map("buddhism")
CATHOLICISM @map("catholicism")
CHRISTIANITY @map("christianity")
}
Existing Behaviour
export type CountryCode = "AD" | "AE";
export const CountryCode = {
AD: "AD",
AE: "AE",
};
export type Religion = "BUDDHISM" | "CATHOLICISM" | "CHRISTIANITY";
export const Religion = {
BUDDHISM: "BUDDHISM",
CATHOLICISM: "CATHOLICISM",
CHRISTIANITY: "CHRISTIANITY",
};
Expected Behaviour
export type CountryCode = "AD" | "AE";
export const CountryCode = {
AD: "AD",
AE: "AE",
};
export type Religion = "BUDDHISM" | "CATHOLICISM" | "CHRISTIANITY";
export const Religion = {
BUDDHISM: "buddhism",
CATHOLICISM: "catholicism",
CHRISTIANITY: "christianity", // the lowercase value is what we need for inserting/updating into the db
};