feat: add support for multiselect in python

This commit is contained in:
Ruben Fiszel
2024-01-10 13:12:20 +01:00
parent 224f18915d
commit 45a794b1b3
20 changed files with 226 additions and 84 deletions
+11 -10
View File
@@ -6,7 +6,7 @@
* LICENSE-AGPL for a copy of the license.
*/
#[cfg(feature = "enterprise")]
#[cfg(feature = "stripe")]
use std::str::FromStr;
use crate::db::ApiAuthed;
@@ -21,7 +21,7 @@ use crate::{
variables::build_crypt,
webhook_util::{InstanceEvent, WebhookShared},
};
#[cfg(feature = "enterprise")]
#[cfg(feature = "stripe")]
use axum::response::Redirect;
use axum::{
body::StreamBody,
@@ -32,10 +32,10 @@ use axum::{
Json, Router,
};
use chrono::Utc;
#[cfg(feature = "enterprise")]
#[cfg(feature = "stripe")]
use chrono::{Datelike, TimeZone, Timelike};
use magic_crypt::MagicCryptTrait;
#[cfg(feature = "enterprise")]
#[cfg(feature = "stripe")]
use stripe::CustomerId;
use uuid::Uuid;
use windmill_audit::{audit_log, ActionKind};
@@ -83,7 +83,6 @@ pub fn workspaced_service() -> Router {
.route("/edit_deploy_to", post(edit_deploy_to))
.route("/tarball", get(tarball_workspace))
.route("/is_premium", get(is_premium))
.route("/premium_info", get(premium_info))
.route("/edit_copilot_config", post(edit_copilot_config))
.route("/get_copilot_info", get(get_copilot_info))
.route("/edit_error_handler", post(edit_error_handler))
@@ -94,7 +93,7 @@ pub fn workspaced_service() -> Router {
.route("/edit_git_sync_config", post(edit_git_sync_config))
.route("/leave", post(leave_workspace));
#[cfg(feature = "enterprise")]
#[cfg(feature = "stripe")]
{
if STRIPE_KEY.is_none() {
return router;
@@ -102,12 +101,13 @@ pub fn workspaced_service() -> Router {
tracing::info!("stripe enabled");
return router
.route("/premium_info", get(premium_info))
.route("/checkout", get(stripe_checkout))
.route("/billing_portal", get(stripe_portal));
}
}
#[cfg(not(feature = "enterprise"))]
#[cfg(not(feature = "stripe"))]
router
}
pub fn global_service() -> Router {
@@ -324,6 +324,7 @@ pub struct PremiumWorkspaceInfo {
pub usage: Option<i32>,
pub seats: Option<i32>,
}
#[cfg(feature = "stripe")]
async fn premium_info(
authed: ApiAuthed,
Extension(db): Extension<DB>,
@@ -395,14 +396,14 @@ async fn premium_info(
Ok(Json(result))
}
#[cfg(feature = "enterprise")]
#[cfg(feature = "stripe")]
#[derive(Deserialize)]
struct PlanQuery {
plan: String,
seats: Option<i32>,
}
#[cfg(feature = "enterprise")]
#[cfg(feature = "stripe")]
async fn stripe_checkout(
authed: ApiAuthed,
Path(w_id): Path<String>,
@@ -491,7 +492,7 @@ async fn stripe_checkout(
}
}
#[cfg(feature = "enterprise")]
#[cfg(feature = "stripe")]
async fn stripe_portal(
authed: ApiAuthed,
Path(w_id): Path<String>,