Skip to content

Commit f475780

Browse files
fixed code format and linting; added commit hooks
1 parent 480514c commit f475780

24 files changed

Lines changed: 1009 additions & 552 deletions

.claude/CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,11 @@ Always get Arrow types from the library's `get_schema()` during discovery — th
5252
- Discovery jobs: one active job per datasource enforced by `JobStore.active_by_ds`; cancellation via `CancellationToken` passed through all `DiscoveryProvider` methods
5353
- Catalog UUID v5 key format: `"{parent_uuid}:{child_name}"` — same natural key → same ID → re-discovery is a safe upsert
5454

55+
## Pre-commit Hook
56+
A `.githooks/pre-commit` script runs `cargo fmt --check` and `cargo clippy -p proxy -- -D warnings`. Enable it once per clone:
57+
```bash
58+
git config core.hooksPath .githooks
59+
```
60+
5561
## Known Issues
5662
- **JSONB / regclass / regproc not supported**`datafusion-table-providers` silently drops these columns (`UnsupportedTypeAction::Warn`). Catalog stores `arrow_type = NULL`; `build_arrow_schema` skips them.

.githooks/pre-commit

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
echo "→ cargo fmt --check"
5+
cargo fmt --check
6+
7+
echo "→ cargo clippy -p proxy"
8+
cargo clippy -p proxy -- -D warnings

migration/src/m20260220_000003_create_user_data_sources.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ impl MigrationTrait for Migration {
1717
.not_null()
1818
.primary_key(),
1919
)
20-
.col(
21-
ColumnDef::new(UserDataSource::UserId)
22-
.uuid()
23-
.not_null(),
24-
)
20+
.col(ColumnDef::new(UserDataSource::UserId).uuid().not_null())
2521
.col(
2622
ColumnDef::new(UserDataSource::DataSourceId)
2723
.uuid()

migration/src/m20260221_000004_create_catalog_tables.rs

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ impl MigrationTrait for Migration {
1818
.not_null()
1919
.primary_key(),
2020
)
21-
.col(ColumnDef::new(DiscoveredSchema::DataSourceId).uuid().not_null())
22-
.col(ColumnDef::new(DiscoveredSchema::SchemaName).string().not_null())
21+
.col(
22+
ColumnDef::new(DiscoveredSchema::DataSourceId)
23+
.uuid()
24+
.not_null(),
25+
)
26+
.col(
27+
ColumnDef::new(DiscoveredSchema::SchemaName)
28+
.string()
29+
.not_null(),
30+
)
2331
.col(
2432
ColumnDef::new(DiscoveredSchema::IsSelected)
2533
.boolean()
@@ -66,9 +74,21 @@ impl MigrationTrait for Migration {
6674
.not_null()
6775
.primary_key(),
6876
)
69-
.col(ColumnDef::new(DiscoveredTable::DiscoveredSchemaId).uuid().not_null())
70-
.col(ColumnDef::new(DiscoveredTable::TableName).string().not_null())
71-
.col(ColumnDef::new(DiscoveredTable::TableType).string().not_null())
77+
.col(
78+
ColumnDef::new(DiscoveredTable::DiscoveredSchemaId)
79+
.uuid()
80+
.not_null(),
81+
)
82+
.col(
83+
ColumnDef::new(DiscoveredTable::TableName)
84+
.string()
85+
.not_null(),
86+
)
87+
.col(
88+
ColumnDef::new(DiscoveredTable::TableType)
89+
.string()
90+
.not_null(),
91+
)
7292
.col(
7393
ColumnDef::new(DiscoveredTable::IsSelected)
7494
.boolean()
@@ -115,17 +135,37 @@ impl MigrationTrait for Migration {
115135
.not_null()
116136
.primary_key(),
117137
)
118-
.col(ColumnDef::new(DiscoveredColumn::DiscoveredTableId).uuid().not_null())
119-
.col(ColumnDef::new(DiscoveredColumn::ColumnName).string().not_null())
120-
.col(ColumnDef::new(DiscoveredColumn::OrdinalPosition).integer().not_null())
121-
.col(ColumnDef::new(DiscoveredColumn::DataType).string().not_null())
138+
.col(
139+
ColumnDef::new(DiscoveredColumn::DiscoveredTableId)
140+
.uuid()
141+
.not_null(),
142+
)
143+
.col(
144+
ColumnDef::new(DiscoveredColumn::ColumnName)
145+
.string()
146+
.not_null(),
147+
)
148+
.col(
149+
ColumnDef::new(DiscoveredColumn::OrdinalPosition)
150+
.integer()
151+
.not_null(),
152+
)
153+
.col(
154+
ColumnDef::new(DiscoveredColumn::DataType)
155+
.string()
156+
.not_null(),
157+
)
122158
.col(
123159
ColumnDef::new(DiscoveredColumn::IsNullable)
124160
.boolean()
125161
.not_null()
126162
.default(true),
127163
)
128-
.col(ColumnDef::new(DiscoveredColumn::ColumnDefault).text().null())
164+
.col(
165+
ColumnDef::new(DiscoveredColumn::ColumnDefault)
166+
.text()
167+
.null(),
168+
)
129169
.col(ColumnDef::new(DiscoveredColumn::ArrowType).string().null())
130170
.col(
131171
ColumnDef::new(DiscoveredColumn::DiscoveredAt)

proxy/src/admin/auth_handlers.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
use axum::{
2-
extract::State,
3-
http::StatusCode,
4-
response::Json,
5-
};
1+
use axum::{extract::State, http::StatusCode, response::Json};
62
use chrono::Utc;
73
use sea_orm::EntityTrait;
84

95
use crate::entity::proxy_user;
106

117
use super::{
12-
dto::{LoginRequest, LoginResponse, UserResponse},
13-
jwt::{encode_jwt, AuthClaims, Claims},
148
AdminState, ApiErr,
9+
dto::{LoginRequest, LoginResponse, UserResponse},
10+
jwt::{AuthClaims, Claims, encode_jwt},
1511
};
1612

1713
pub async fn login(

0 commit comments

Comments
 (0)