Skip to content

Commit

Permalink
feat(core): fix up sqlite issue and add highlight project id
Browse files Browse the repository at this point in the history
feat(frontend): fix up frontend for get databases endpoint and highlight project id
  • Loading branch information
hkdeman committed Oct 28, 2024
1 parent 1742273 commit 7c608c2
Show file tree
Hide file tree
Showing 18 changed files with 6,809 additions and 9,208 deletions.
62 changes: 55 additions & 7 deletions core/graph/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion core/graph/http.resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ func getProfilesHandler(w http.ResponseWriter, r *http.Request) {
}

func getDatabasesHandler(w http.ResponseWriter, r *http.Request) {
databases, err := resolver.Query().Database(r.Context())
typeArg := r.URL.Query().Get("type")
databases, err := resolver.Query().Database(r.Context(), typeArg)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
Expand Down
2 changes: 1 addition & 1 deletion core/graph/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type AIChatMessage {
type Query {
Version: String!
Profiles: [LoginProfile!]!
Database: [String!]!
Database(type: String!): [String!]!
Schema: [String!]!
StorageUnit(schema: String!): [StorageUnit!]!
Row(schema: String!, storageUnit: String!, where: String!, pageSize: Int!, pageOffset: Int!): RowsResult!
Expand Down
6 changes: 3 additions & 3 deletions core/graph/schema.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"metricsEnabled": true
"metricsEnabled": false
}
6 changes: 5 additions & 1 deletion core/src/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ func isAllowed(r *http.Request, body []byte) bool {
return query.Variables["type"] == string(engine.DatabaseType_Sqlite3)
}

return strings.HasPrefix(query.OperationName, "Login") || query.OperationName == "Logout" || query.OperationName == "GetProfiles"
switch query.OperationName {
case "Login", "Logout", "GetProfiles", "UpdateSettings", "SettingsConfig":
return true
}
return false
}

func isTokenValid(token string) bool {
Expand Down
4 changes: 3 additions & 1 deletion core/src/highlight/highlight.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import (
"github.com/highlight/highlight/sdk/highlight-go"
)

const highlightProjectId = "4d7z8oqe"

func InitializeHighlight() {
environment := "production"
if env.IsDevelopment {
environment = "development"
}
highlight.SetProjectID("")
highlight.SetProjectID(highlightProjectId)
highlight.Start(
highlight.WithServiceName("WhoDB-backend"),
highlight.WithEnvironment(environment))
Expand Down
Loading

0 comments on commit 7c608c2

Please sign in to comment.