class SaveTranscompileTask

Overview

Check the input of the user and and save it to the database.

This class inherits most of its functionality from SaveOperation. The provided logic here is only there to permit the user to actually save certain variables via permit_columns, to change priority if the user is logged in, to check validicity of #inp_lang and #outp_lang and to check that #inp_lang and #outp_lang are not the same.

Defined in:

operations/save_transcompile_task.cr

Constant Summary

ATTRIBUTES = [] of Nil
COLUMN_ATTRIBUTES = [{name: id, type: Int64, nilable: false, autogenerated: true, value: nil, serialized: false}, {name: created_at, type: Time, nilable: false, autogenerated: true, value: nil, serialized: false}, {name: updated_at, type: Time, nilable: false, autogenerated: true, value: nil, serialized: false}, {name: input_code, type: String, nilable: false, autogenerated: false, value: "", serialized: false}, {name: output_code, type: String, nilable: true, autogenerated: false, value: "", serialized: false}, {name: completed, type: Bool, nilable: false, autogenerated: false, value: false, serialized: false}, {name: priority, type: Int32, nilable: false, autogenerated: false, value: 2, serialized: false}, {name: inp_lang, type: String, nilable: false, autogenerated: false, value: "none", serialized: false}, {name: outp_lang, type: String, nilable: false, autogenerated: false, value: "none", serialized: false}, {name: id, type: Int64, nilable: false, autogenerated: true, value: nil, serialized: false}, {name: created_at, type: Time, nilable: false, autogenerated: true, value: nil, serialized: false}, {name: updated_at, type: Time, nilable: false, autogenerated: true, value: nil, serialized: false}, {name: input_code, type: String, nilable: false, autogenerated: false, value: "", serialized: false}, {name: output_code, type: String, nilable: true, autogenerated: false, value: "", serialized: false}, {name: completed, type: Bool, nilable: false, autogenerated: false, value: false, serialized: false}, {name: priority, type: Int32, nilable: false, autogenerated: false, value: 2, serialized: false}, {name: inp_lang, type: String, nilable: false, autogenerated: false, value: "none", serialized: false}, {name: outp_lang, type: String, nilable: false, autogenerated: false, value: "none", serialized: false}] of Nil
FOREIGN_KEY = "transcompile_task_id"

Check the input of the user and and save it to the database.

This class inherits most of its functionality from SaveOperation. The provided logic here is only there to permit the user to actually save certain variables via permit_columns, to change priority if the user is logged in, to check validicity of #inp_lang and #outp_lang and to check that #inp_lang and #outp_lang are not the same.

OPERATION_NEEDS = [current_user : User | ::Nil = nil] of Nil

Constructors

Class Method Summary

Instance Method Summary

Macro Summary

Instance methods inherited from class TranscompileTask::SaveOperation

attributes attributes, completed completed, completed=(_value) completed=, created_at created_at, created_at=(_value) created_at=, id id, id=(_value) id=, inp_lang inp_lang, inp_lang=(_value) inp_lang=, input_code input_code, input_code=(_value) input_code=, outp_lang outp_lang, outp_lang=(_value) outp_lang=, output_code output_code, output_code=(_value) output_code=, permitted_params : Hash(String, Array(String) | String) permitted_params, priority priority, priority=(_value) priority=, required_attributes required_attributes, set_attributes(id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) set_attributes, set_completed_from_param(_value) set_completed_from_param, set_created_at_from_param(_value) set_created_at_from_param, set_id_from_param(_value) set_id_from_param, set_inp_lang_from_param(_value) set_inp_lang_from_param, set_input_code_from_param(_value) set_input_code_from_param, set_outp_lang_from_param(_value) set_outp_lang_from_param, set_output_code_from_param(_value) set_output_code_from_param, set_priority_from_param(_value) set_priority_from_param, set_updated_at_from_param(_value) set_updated_at_from_param, updated_at updated_at, updated_at=(_value) updated_at=

Constructor methods inherited from class TranscompileTask::SaveOperation

new(record : T, params : Avram::Paramable, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new)
new(params : Avram::Paramable, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new)
new(record : T, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new)
new(id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new)
new

Class methods inherited from class TranscompileTask::SaveOperation

create(params, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new, &)
create(id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new, &)
create(params : Hash, **named_args, &)
create
, create!(params, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new)
create!(id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new)
create!(params : Hash, **named_args)
create!
, update(record : T, with params, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new, &)
update(record : T, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new, &)
update(record : T, params : Hash, **named_args, &)
update
, update!(record : T, with params, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new)
update!(record : T, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new)
update!(record : T, params : Hash, **named_args)
update!

Constructor Detail

def self.new(record : T, params : Avram::Paramable, current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.new(params : Avram::Paramable, current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.new(record : T, current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.new(current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


Class Method Detail

def self.create(params, current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new, &) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.create(current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new, &) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.create(params : Hash, **named_args, &) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.create!(params, current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.create!(current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.create!(params : Hash, **named_args) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.update(record : T, with params, current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new, &) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.update(record : T, current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new, &) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.update(record : T, params : Hash, **named_args, &) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.update!(record : T, with params, current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.update!(record : T, current_user : User | Nil = nil, id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


def self.update!(record : T, params : Hash, **named_args) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


Instance Method Detail

def before_save #

[View source]
def current_user : User? #

def current_user=(current_user : Nil | User) #

def inp_lang #

[View source]
def input_code #

[View source]
def outp_lang #

[View source]
def set_attributes(id : Int64 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, input_code : String | Avram::Nothing = Avram::Nothing.new, output_code : String | Avram::Nothing | Nil = Avram::Nothing.new, completed : Bool | Avram::Nothing = Avram::Nothing.new, priority : Int32 | Avram::Nothing = Avram::Nothing.new, inp_lang : String | Avram::Nothing = Avram::Nothing.new, outp_lang : String | Avram::Nothing = Avram::Nothing.new) #

@type is not correct in this method, but is in the macro we call below That is why this extrac macro was extracted. We need @type to get the attributes for this SaveOperation


Macro Detail

macro param_key(key) #

Check the input of the user and and save it to the database.

This class inherits most of its functionality from SaveOperation. The provided logic here is only there to permit the user to actually save certain variables via permit_columns, to change priority if the user is logged in, to check validicity of #inp_lang and #outp_lang and to check that #inp_lang and #outp_lang are not the same.