Stub searchable functionality and start to restore login/auth

This commit is contained in:
Mike Dalessio
2025-11-10 10:57:25 -05:00
parent d6c7fc9e0a
commit 4ad1718d86
3 changed files with 24 additions and 22 deletions
+20 -17
View File
@@ -42,32 +42,35 @@ module Searchable
private
def create_in_search_index
fields_sql = [ "rowid", *search_fields ].join(", ")
placeholders = ([ "?" ] * (search_fields.size + 1)).join(", ")
values = [ id, *search_values ]
# # TODO:PLANB: need to replace SQLite FTS
# fields_sql = [ "rowid", *search_fields ].join(", ")
# placeholders = ([ "?" ] * (search_fields.size + 1)).join(", ")
# values = [ id, *search_values ]
execute_sql_with_binds(
"insert into #{search_table}(#{fields_sql}) values (#{placeholders})",
*values
)
# execute_sql_with_binds(
# "insert into #{search_table}(#{fields_sql}) values (#{placeholders})",
# *values
# )
end
def update_in_search_index
transaction do
set_clause = search_fields.map { |field| "#{field} = ?" }.join(", ")
binds = search_values + [ id ]
# # TODO:PLANB: need to replace SQLite FTS
# transaction do
# set_clause = search_fields.map { |field| "#{field} = ?" }.join(", ")
# binds = search_values + [ id ]
updated = execute_sql_with_binds(
"update #{search_table} set #{set_clause} where rowid = ?",
*binds
)
# updated = execute_sql_with_binds(
# "update #{search_table} set #{set_clause} where rowid = ?",
# *binds
# )
create_in_search_index unless updated
end
# create_in_search_index unless updated
# end
end
def remove_from_search_index
execute_sql_with_binds "delete from #{search_table} where rowid = ?", id
# # TODO:PLANB: need to replace SQLite FTS
# execute_sql_with_binds "delete from #{search_table} where rowid = ?", id
end
def execute_sql_with_binds(*statement)
+3 -4
View File
@@ -8,9 +8,8 @@ class Current < ActiveSupport::CurrentAttributes
def session=(value)
super(value)
# # TODO:PLANB: not sure how to patch this up right now
# unless value.nil?
# self.membership = identity.memberships.find_by(tenant: ApplicationRecord.current_tenant)
# end
if value.present? && Current.account.present?
self.membership = identity.memberships.find_by(tenant: Current.account.external_account_id)
end
end
end
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
bin/rails runner - <<EOF
puts "Login with david@37signals.com to:"
puts "Login with david@37signals.com to: http://fizzy.localhost:3006/"
EOF
if [ -f tmp/solid-queue.txt ]; then