Commit 56331a6

mo khan <mo@mokhan.ca>
2025-03-27 21:25:34
refactor: split csv files into sub directory to simulate separate databases
1 parent c55e51e
bin/api
@@ -31,7 +31,7 @@ $host = ENV.fetch("HOST", "localhost:#{$port}")
 class Entity
   class << self
     def all
-      @items ||= ::CSV.read(File.join(__dir__, "../db/#{self.name.downcase}s.csv"), headers: true).map do |row|
+      @items ||= ::CSV.read(File.join(__dir__, "../db/api/#{self.name.downcase}s.csv"), headers: true).map do |row|
         new(row.to_h.transform_keys(&:to_sym))
       end
     end
bin/idp
@@ -89,7 +89,7 @@ module Authn
 
     class << self
       def all
-        @all ||= ::CSV.read(File.join(__dir__, "../db/users.csv"), headers: true).map do |row|
+        @all ||= ::CSV.read(File.join(__dir__, "../db/idp/users.csv"), headers: true).map do |row|
           new(row.to_h.transform_keys(&:to_sym))
         end
       end
db/groups.csv → db/api/groups.csv
File renamed without changes
db/organizations.csv → db/api/organizations.csv
File renamed without changes
db/projects.csv → db/api/projects.csv
File renamed without changes
db/users.csv → db/idp/users.csv
File renamed without changes