mentorenwahl/docker/backend/src/backend/worker.cr
Dominic Grimm 3a19d1d8db
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
Fixed file license headers
2022-03-07 14:06:02 +01:00

43 lines
1.3 KiB
Crystal

# Mentorenwahl: A fullstack application for assigning mentors to students based on their whishes.
# Copyright (C) 2022 Dominic Grimm
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
require "mosquito"
module Mosquito::Serializers::Granite
macro serialize_granite_model(klass)
{% method_suffix = klass.resolve.stringify.underscore.gsub(/::/, "__").id %}
def serialize_{{ method_suffix }}(model : {{ klass.id }}) : String
model.id.to_s
end
def deserialize_{{ method_suffix }}(raw : String) : {{ klass.id }}
{{ klass.id }}.find!(raw.to_i)
end
end
end
require "./worker/*"
module Backend
# Worker module
module Worker
Mosquito.configure do |settings|
settings.redis_url = Backend.config.redis.url
end
end
end