DB restructure, print page

This commit is contained in:
Jason Jordan
2026-03-13 08:47:13 -04:00
parent 6a068243f4
commit 8c885b3e76
73 changed files with 1362 additions and 325 deletions
+13 -7
View File
@@ -1,8 +1,14 @@
class ImageProcessor
ALLOWED_LOGO_TYPES = ['Network', 'Employer'].freeze
def initialize(image_path, new_filename = nil)
def initialize(image_path, logo_type, new_filename = nil)
@image_path = image_path
@logo_type = logo_type.capitalize
@new_filename = new_filename
unless ALLOWED_LOGO_TYPES.include?(@logo_type)
raise ArgumentError, "Invalid logo type: #{@logo_type}. Must be one of: #{ALLOWED_LOGO_TYPES.join(', ')}"
end
end
def call
@@ -17,11 +23,11 @@ class ImageProcessor
# binary_data = File.open(@image_path, 'rb').read
meme_type = Marcel::MimeType.for Pathname.new(@image_path)
CardLogoFile.create(
filename: filename,
image_data: binary_data,
content_type: meme_type,
logo_type: "employer"
)
logo_model = "IdCard::#{@logo_type}Logo".constantize
logo_model.find_or_create_by(filename: filename) do |logo|
logo.image_data = binary_data
logo.content_type = meme_type
end
end
end