mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-20 07:41:22 +02:00
Add back environment.base (#260)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||||
import type { Environment, Folder, GrpcRequest, HttpRequest, WebsocketRequest, Workspace } from "./gen_models";
|
import type { Environment, Folder, GrpcRequest, HttpRequest, WebsocketRequest, Workspace } from "./gen_models.js";
|
||||||
|
|
||||||
export type BatchUpsertResult = { workspaces: Array<Workspace>, environments: Array<Environment>, folders: Array<Folder>, httpRequests: Array<HttpRequest>, grpcRequests: Array<GrpcRequest>, websocketRequests: Array<WebsocketRequest>, };
|
export type BatchUpsertResult = { workspaces: Array<Workspace>, environments: Array<Environment>, folders: Array<Folder>, httpRequests: Array<HttpRequest>, grpcRequests: Array<GrpcRequest>, websocketRequests: Array<WebsocketRequest>, };
|
||||||
|
|||||||
@@ -541,10 +541,15 @@ pub struct Environment {
|
|||||||
|
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub public: bool,
|
pub public: bool,
|
||||||
pub variables: Vec<EnvironmentVariable>,
|
#[deprecated(
|
||||||
pub color: Option<String>,
|
note = "parent_model is used instead. This field will be removed when schema field is added for sync/export."
|
||||||
|
)]
|
||||||
|
#[ts(skip)]
|
||||||
|
pub base: bool,
|
||||||
pub parent_model: String,
|
pub parent_model: String,
|
||||||
pub parent_id: Option<String>,
|
pub parent_id: Option<String>,
|
||||||
|
pub variables: Vec<EnvironmentVariable>,
|
||||||
|
pub color: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UpsertModelInfo for Environment {
|
impl UpsertModelInfo for Environment {
|
||||||
@@ -603,6 +608,8 @@ impl UpsertModelInfo for Environment {
|
|||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
let variables: String = row.get("variables")?;
|
let variables: String = row.get("variables")?;
|
||||||
|
let parent_model = row.get("parent_model")?;
|
||||||
|
let base = parent_model == "workspace";
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
id: row.get("id")?,
|
id: row.get("id")?,
|
||||||
model: row.get("model")?,
|
model: row.get("model")?,
|
||||||
@@ -610,11 +617,16 @@ impl UpsertModelInfo for Environment {
|
|||||||
created_at: row.get("created_at")?,
|
created_at: row.get("created_at")?,
|
||||||
updated_at: row.get("updated_at")?,
|
updated_at: row.get("updated_at")?,
|
||||||
parent_id: row.get("parent_id")?,
|
parent_id: row.get("parent_id")?,
|
||||||
parent_model: row.get("parent_model")?,
|
parent_model,
|
||||||
color: row.get("color")?,
|
color: row.get("color")?,
|
||||||
name: row.get("name")?,
|
name: row.get("name")?,
|
||||||
public: row.get("public")?,
|
public: row.get("public")?,
|
||||||
variables: serde_json::from_str(variables.as_str()).unwrap_or_default(),
|
variables: serde_json::from_str(variables.as_str()).unwrap_or_default(),
|
||||||
|
|
||||||
|
// Deprecated field, but we need to keep it around for a couple of versions
|
||||||
|
// for compatibility because sync/export don't have a schema field
|
||||||
|
#[allow(deprecated)]
|
||||||
|
base,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user