feat(freelance): 创建插件 crate 骨架
This commit is contained in:
@@ -13,6 +13,7 @@ members = [
|
|||||||
"crates/erp-plugin",
|
"crates/erp-plugin",
|
||||||
"crates/erp-plugin-crm",
|
"crates/erp-plugin-crm",
|
||||||
"crates/erp-plugin-inventory",
|
"crates/erp-plugin-inventory",
|
||||||
|
"crates/erp-plugin-freelance",
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
|
|||||||
11
crates/erp-plugin-freelance/Cargo.toml
Normal file
11
crates/erp-plugin-freelance/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "erp-plugin-freelance"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
description = "自由职业者工作台 WASM 插件"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
wit-bindgen = "0.55"
|
||||||
26
crates/erp-plugin-freelance/src/lib.rs
Normal file
26
crates/erp-plugin-freelance/src/lib.rs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
//! 自由职业者工作台 WASM 插件
|
||||||
|
|
||||||
|
wit_bindgen::generate!({
|
||||||
|
path: "../erp-plugin-prototype/wit/plugin.wit",
|
||||||
|
world: "plugin-world",
|
||||||
|
});
|
||||||
|
|
||||||
|
use crate::exports::erp::plugin::plugin_api::Guest;
|
||||||
|
|
||||||
|
struct FreelancePlugin;
|
||||||
|
|
||||||
|
impl Guest for FreelancePlugin {
|
||||||
|
fn init() -> Result<(), String> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_tenant_created(_tenant_id: String) -> Result<(), String> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_event(_event_type: String, _payload: Vec<u8>) -> Result<(), String> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export!(FreelancePlugin);
|
||||||
Reference in New Issue
Block a user