jiff for table definition added

This commit is contained in:
Priec
2026-07-18 17:32:41 +02:00
parent f5b826bb8f
commit ef751e241f
7 changed files with 110 additions and 4 deletions

2
client

Submodule client updated: 0fd324cf74...9c8ae0b6fa

View File

@@ -8,6 +8,7 @@ service AuthService {
rpc Register(RegisterRequest) returns (AuthResponse); rpc Register(RegisterRequest) returns (AuthResponse);
rpc Login(LoginRequest) returns (LoginResponse); rpc Login(LoginRequest) returns (LoginResponse);
rpc GetAuthorization(GetAuthorizationRequest) returns (AuthorizationSnapshot); rpc GetAuthorization(GetAuthorizationRequest) returns (AuthorizationSnapshot);
rpc SetTimezone(SetTimezoneRequest) returns (UserPreferences);
} }
message RegisterRequest { message RegisterRequest {
@@ -38,6 +39,15 @@ message LoginResponse {
string role = 5; // User's role string role = 5; // User's role
string username = 6; string username = 6;
AuthorizationSnapshot authorization = 7; AuthorizationSnapshot authorization = 7;
string timezone = 8;
}
message SetTimezoneRequest {
string timezone = 1; // IANA timezone, for example Europe/Bratislava
}
message UserPreferences {
string timezone = 1;
} }
message GetAuthorizationRequest {} message GetAuthorizationRequest {}

View File

@@ -120,11 +120,16 @@ message ColumnDefinition {
// Logical column type. Supported values (case-insensitive): // Logical column type. Supported values (case-insensitive):
// TEXT // TEXT
// BOOLEAN // BOOLEAN
// TIMESTAMPTZ // INSTANT (absolute timestamp, displayed in the viewer timezone)
// USER_DATETIME (local input resolved in the user's timezone)
// RAW_DATETIME (timezone-free civil datetime)
// TIME (timezone-free time of day)
// MONEY (= unconstrained NUMERIC; currency comes from the table) // MONEY (= unconstrained NUMERIC; currency comes from the table)
// INT // INT
// BIGINT // BIGINT
// DATE // DATE
// DURATION
// PERIOD
// DECIMAL(p,s) → NUMERIC(p,s) // DECIMAL(p,s) → NUMERIC(p,s)
// DECIMAL args must be integers (no sign, no dot, no leading zeros); // DECIMAL args must be integers (no sign, no dot, no leading zeros);
// s ≤ p and p ≥ 1. // s ≤ p and p ≥ 1.

Binary file not shown.

View File

@@ -56,6 +56,19 @@ pub struct LoginResponse {
pub username: ::prost::alloc::string::String, pub username: ::prost::alloc::string::String,
#[prost(message, optional, tag = "7")] #[prost(message, optional, tag = "7")]
pub authorization: ::core::option::Option<AuthorizationSnapshot>, pub authorization: ::core::option::Option<AuthorizationSnapshot>,
#[prost(string, tag = "8")]
pub timezone: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetTimezoneRequest {
/// IANA timezone, for example Europe/Bratislava
#[prost(string, tag = "1")]
pub timezone: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UserPreferences {
#[prost(string, tag = "1")]
pub timezone: ::prost::alloc::string::String,
} }
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAuthorizationRequest {} pub struct GetAuthorizationRequest {}
@@ -230,6 +243,30 @@ pub mod auth_service_client {
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "GetAuthorization")); .insert(GrpcMethod::new("komp_ac.auth.AuthService", "GetAuthorization"));
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
pub async fn set_timezone(
&mut self,
request: impl tonic::IntoRequest<super::SetTimezoneRequest>,
) -> std::result::Result<
tonic::Response<super::UserPreferences>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/SetTimezone",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "SetTimezone"));
self.inner.unary(req, path, codec).await
}
} }
} }
/// Generated server implementations. /// Generated server implementations.
@@ -260,6 +297,10 @@ pub mod auth_service_server {
tonic::Response<super::AuthorizationSnapshot>, tonic::Response<super::AuthorizationSnapshot>,
tonic::Status, tonic::Status,
>; >;
async fn set_timezone(
&self,
request: tonic::Request<super::SetTimezoneRequest>,
) -> std::result::Result<tonic::Response<super::UserPreferences>, tonic::Status>;
} }
#[derive(Debug)] #[derive(Debug)]
pub struct AuthServiceServer<T> { pub struct AuthServiceServer<T> {
@@ -470,6 +511,51 @@ pub mod auth_service_server {
}; };
Box::pin(fut) Box::pin(fut)
} }
"/komp_ac.auth.AuthService/SetTimezone" => {
#[allow(non_camel_case_types)]
struct SetTimezoneSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::SetTimezoneRequest>
for SetTimezoneSvc<T> {
type Response = super::UserPreferences;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SetTimezoneRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::set_timezone(&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 = SetTimezoneSvc(inner);
let codec = tonic_prost::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 { Box::pin(async move {
let mut response = http::Response::new( let mut response = http::Response::new(

View File

@@ -82,11 +82,16 @@ pub struct ColumnDefinition {
/// Logical column type. Supported values (case-insensitive): /// Logical column type. Supported values (case-insensitive):
/// TEXT /// TEXT
/// BOOLEAN /// BOOLEAN
/// TIMESTAMPTZ /// INSTANT (absolute timestamp, displayed in the viewer timezone)
/// USER_DATETIME (local input resolved in the user's timezone)
/// RAW_DATETIME (timezone-free civil datetime)
/// TIME (timezone-free time of day)
/// MONEY (= unconstrained NUMERIC; currency comes from the table) /// MONEY (= unconstrained NUMERIC; currency comes from the table)
/// INT /// INT
/// BIGINT /// BIGINT
/// DATE /// DATE
/// DURATION
/// PERIOD
/// DECIMAL(p,s) → NUMERIC(p,s) /// DECIMAL(p,s) → NUMERIC(p,s)
/// DECIMAL args must be integers (no sign, no dot, no leading zeros); /// DECIMAL args must be integers (no sign, no dot, no leading zeros);
/// s ≤ p and p ≥ 1. /// s ≤ p and p ≥ 1.

2
server

Submodule server updated: 23f5feeaa1...cbbf1ac16b