feat: release Dever 0.1.5 with direct workers and long transactions
This commit is contained in:
1 parent
89629c2197
commit
a900d7e8db
153 files changed
+3676
-3708
No files matched your search
@@ -14,5 +14,5 @@
|
||||
- 声明:`post upload`
|
||||
|
||||
```dever
|
||||
post upload = app.store
|
||||
long post upload = app.store
|
||||
```
|
||||
@@ -7,10 +7,12 @@
|
||||
- `StoreResult`
|
||||
- 公开方法:
|
||||
- `store`
|
||||
- `record`
|
||||
- `require_ready`
|
||||
- `ready`
|
||||
- 使用:
|
||||
- `media.asset.store(file)`
|
||||
- `media.asset.record(key, filename, content_type, size)`
|
||||
- `media.asset.require_ready(id)`
|
||||
- `media.asset.ready(available)`
|
||||
|
||||
@@ -52,6 +54,25 @@ store(file: Upload) (result: StoreResult) {
|
||||
content_type = dever.api.upload_content_type(file)
|
||||
size = dever.api.upload_size(file)
|
||||
key = port.store(file)
|
||||
result = record(key, filename, content_type, size)
|
||||
}
|
||||
```
|
||||
|
||||
## 保存元数据
|
||||
|
||||
文件传输结束后,在短事务中保存资源元数据与审计记录。
|
||||
|
||||
- 函数:`record`
|
||||
- 输入:
|
||||
- `key: Uuid`:已保存文件的存储标识
|
||||
- `filename: Text`:文件名称
|
||||
- `content_type: Text`:文件类型
|
||||
- `size: Int`:文件大小
|
||||
- 输出:
|
||||
- `result: StoreResult`:资源公开元数据
|
||||
|
||||
```dever
|
||||
transaction record(key: Uuid, filename: Text, content_type: Text, size: Int) (result: StoreResult) {
|
||||
asset = model.create(
|
||||
{
|
||||
storage_key = key
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
- 声明:`cmd bootstrap`
|
||||
|
||||
```dever
|
||||
cmd bootstrap = app.bootstrap
|
||||
long cmd bootstrap = app.bootstrap
|
||||
```
|
||||
@@ -14,7 +14,7 @@
|
||||
- 声明:`post login`
|
||||
|
||||
```dever
|
||||
public post login = app.login
|
||||
public long post login = app.login
|
||||
```
|
||||
|
||||
## 登出
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
- 声明:`post login`
|
||||
|
||||
```dever
|
||||
public post login = app.login
|
||||
public long post login = app.login
|
||||
```
|
||||
|
||||
## 登出
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
- `Identity`
|
||||
- 公开方法:
|
||||
- `bootstrap`
|
||||
- `register_account`
|
||||
- `login`
|
||||
- `establish_login`
|
||||
- `logout`
|
||||
@@ -20,6 +21,7 @@
|
||||
- `require_user`
|
||||
- 使用:
|
||||
- `user.account.bootstrap(tenant_key, tenant_name, email, display_name, password)`
|
||||
- `user.account.register_account(tenant_key, tenant_name, email, display_name, hash)`
|
||||
- `user.account.login(credential_id, password, tenant)`
|
||||
- `user.account.establish_login(credential_id, tenant, site)`
|
||||
- `user.account.logout()`
|
||||
@@ -137,10 +139,36 @@ bootstrap(
|
||||
email: Text,
|
||||
display_name: Text,
|
||||
password: Secret
|
||||
) (result: BootstrapView) {
|
||||
hash = blocking(dever.crypto.password_hash(password))
|
||||
result = register_account(tenant_key, tenant_name, email, display_name, hash)
|
||||
}
|
||||
```
|
||||
|
||||
## 提交平台账户
|
||||
|
||||
密码计算完成后,原子提交租户、账户和成员关系。
|
||||
|
||||
- 函数:`register_account`
|
||||
- 输入:
|
||||
- `tenant_key: Text`:租户键
|
||||
- `tenant_name: Text`:租户名称
|
||||
- `email: Text`:邮箱
|
||||
- `display_name: Text`:显示名
|
||||
- `hash: Text`:密码摘要
|
||||
- 输出:
|
||||
- `result: BootstrapView`:初始化结果
|
||||
|
||||
```dever
|
||||
transaction register_account(
|
||||
tenant_key: Text,
|
||||
tenant_name: Text,
|
||||
email: Text,
|
||||
display_name: Text,
|
||||
hash: Text
|
||||
) (result: BootstrapView) {
|
||||
tenant = platform.tenant.provision(tenant_key, tenant_name)
|
||||
input = domain.prepare(email, display_name)
|
||||
hash = blocking(dever.crypto.password_hash(password))
|
||||
principal = model.principal.create(
|
||||
{
|
||||
display_name = input.name
|
||||
|
||||
Reference in new issue
Block a user