Project
DearDiary.get_project — Function
get_project(id::Integer)::Optional{Project}Get a Project by id.
Arguments
id::Integer: The id of the project to query.
Returns
A Project object. If the record does not exist, return nothing.
DearDiary.get_projects — Function
DearDiary.create_project — Function
create_project(user_id::Integer, name::AbstractString)::NamedTuple{id::Optional{<:Int64},status::UpsertResult}Create a Project.
Arguments
user_id::Integer: The id of the user creating the project. The user must have admin privileges.name::AbstractString: The name of the project.
Returns
- The created project ID. If an error occurs,
nothingis returned. - An
UpsertResult.Createdif the record was successfully created,Duplicateif the record already exists,Unprocessableif the record violates a constraint, andErrorif an error occurred while creating the record.
create_project(name::AbstractString)::NamedTuple{id::Optional{<:Int64},status::UpsertResult}Create a Project. Uses the "default" user to create the project.
Arguments
name::AbstractString: The name of the project.
Returns
- The created project ID. If an error occurs,
nothingis returned. - An
UpsertResult.Createdif the record was successfully created,Duplicateif the record already exists,Unprocessableif the record violates a constraint, andErrorif an error occurred while creating the record.
DearDiary.update_project — Function
update_project(id::Int, name::Optional{AbstractString}, description::Optional{AbstractString})::UpsertResultUpdate a Project record.
Arguments
id::Integer: The id of the project to update.name::Optional{AbstractString}: The new name for the project.description::Optional{AbstractString}: The new description for the project.
Returns
An UpsertResult. Updated if the record was successfully updated (or no changes were made), Duplicate if the record already exists, Unprocessable if the record violates a constraint, and Error if an error occurred while creating the record.
DearDiary.delete_project — Function
delete_project(id::Integer)::BoolDelete a Project record. Also deletes all associated UserPermission and Experiment records.
Arguments
id::Integer: The id of the project to delete.
Returns
true if the record was successfully deleted, false otherwise.