cant change logic once data are in that column

This commit is contained in:
Priec
2026-05-19 14:30:56 +02:00
parent dc273506b7
commit 6d8fa0de63
9 changed files with 272 additions and 8 deletions

View File

@@ -43,6 +43,10 @@ pub struct FieldValidation {
/// Field must be provided / treated as required by clients and server enforcement layers.
#[prost(bool, tag = "4")]
pub required: bool,
/// Once locked, this field's validation config cannot be changed.
#[prost(bool, tag = "15")]
#[serde(default)]
pub locked: bool,
}
/// Character limit validation (Validation 1).
/// These rules map directly to canvas CharacterLimits.
@@ -368,6 +372,24 @@ pub struct ApplyValidationSetResponse {
#[prost(message, optional, tag = "3")]
pub validation: ::core::option::Option<FieldValidation>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LockFieldValidationRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub table_name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub data_key: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LockFieldValidationResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
/// Character length counting mode
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
@@ -877,6 +899,36 @@ pub mod table_validation_service_client {
);
self.inner.unary(req, path, codec).await
}
/// Permanently lock one field's validation config.
pub async fn lock_field_validation(
&mut self,
request: impl tonic::IntoRequest<super::LockFieldValidationRequest>,
) -> std::result::Result<
tonic::Response<super::LockFieldValidationResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/LockFieldValidation",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_validation.TableValidationService",
"LockFieldValidation",
),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
@@ -967,6 +1019,14 @@ pub mod table_validation_service_server {
tonic::Response<super::ApplyValidationSetResponse>,
tonic::Status,
>;
/// Permanently lock one field's validation config.
async fn lock_field_validation(
&self,
request: tonic::Request<super::LockFieldValidationRequest>,
) -> std::result::Result<
tonic::Response<super::LockFieldValidationResponse>,
tonic::Status,
>;
}
/// Service for storing and fetching field-validation definitions.
#[derive(Debug)]
@@ -1544,6 +1604,55 @@ pub mod table_validation_service_server {
};
Box::pin(fut)
}
"/komp_ac.table_validation.TableValidationService/LockFieldValidation" => {
#[allow(non_camel_case_types)]
struct LockFieldValidationSvc<T: TableValidationService>(pub Arc<T>);
impl<
T: TableValidationService,
> tonic::server::UnaryService<super::LockFieldValidationRequest>
for LockFieldValidationSvc<T> {
type Response = super::LockFieldValidationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LockFieldValidationRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableValidationService>::lock_field_validation(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = LockFieldValidationSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(