Last active
September 1, 2023 13:40
-
-
Save Zeko369/c1455d2c84219db3fcbee0ccd67ee6c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const thisIsCsssFunction = (args: string) => { | |
return "foo"; | |
}; | |
// export const { defineAction, defineQuery, defineJob } = thisIsCsssFunction( | |
// /*css*/ `.foo { color: red }` | |
// ); | |
const defineAction = <T extends string, K>(name: T, act: K) => { | |
return { [name]: act } as { [P in T]: K }; | |
}; | |
const defineCrud = <T extends string, K>( | |
name: T, | |
act?: { override: { create: K } } | |
) => { | |
return { [`${name}Create`]: act } as { [`postCreate`]: K }; | |
}; | |
export const { foo } = defineAction("foo", (num: number) => | |
Promise.resolve("Hello") | |
); | |
export const { postCreate } = defineCrud("post", { | |
override: { | |
create: (data: any) => Promise.resolve(data), | |
}, | |
}); | |
/** | |
// action from "wasp-server" { | |
// fn: import { createTask } from "@server/actions.js", | |
// entities: [Task] | |
// } | |
action updateTask { | |
fn: import { updateTask } from "@server/actions.js", | |
entities: [Task, User] | |
} | |
crud posts { | |
entity: Task, | |
operations: { | |
create: { | |
isPublic: false | |
}, | |
} | |
} | |
// newAction foo { | |
// src: "src/server/actions.js", | |
// entities: [Task, User] | |
// } | |
crud post { | |
entity: Task, | |
operations: { | |
create: { | |
isPublic: false, | |
}, | |
} | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment