64 lines
2.2 KiB
R
64 lines
2.2 KiB
R
db_inspections_list <- function(db, colony_id) {
|
|
api_get(db, "/v1/inspections", list(colony_id = colony_id))
|
|
}
|
|
|
|
db_inspections_get <- function(db, id) {
|
|
api_get_one(db, paste0("/v1/inspections/", id))
|
|
}
|
|
|
|
db_inspections_insert <- function(db, colony_id, date, inspector = NA,
|
|
brood_frames = NA, honey_frames = NA,
|
|
food_stores_kg = NA, colony_strength = NA,
|
|
queen_seen = FALSE, eggs_seen = FALSE,
|
|
queen_cells_count = 0L, notes = NA,
|
|
traits = list()) {
|
|
result <- api_post(db, "/v1/inspections", list(
|
|
colony_id = colony_id,
|
|
date = as.character(date),
|
|
inspector = inspector,
|
|
brood_frames = brood_frames,
|
|
honey_frames = honey_frames,
|
|
food_stores_kg = food_stores_kg,
|
|
colony_strength = colony_strength,
|
|
queen_seen = as.integer(queen_seen),
|
|
eggs_seen = as.integer(eggs_seen),
|
|
queen_cells_count = as.integer(queen_cells_count),
|
|
notes = notes,
|
|
traits = traits
|
|
))
|
|
result$id
|
|
}
|
|
|
|
db_inspections_traits <- function(db, inspection_id) {
|
|
api_get(db, paste0("/v1/inspections/", inspection_id, "/traits"))
|
|
}
|
|
|
|
db_inspections_update <- function(db, id, date, inspector = NA,
|
|
brood_frames = NA, honey_frames = NA,
|
|
food_stores_kg = NA, colony_strength = NA,
|
|
queen_seen = FALSE, eggs_seen = FALSE,
|
|
queen_cells_count = 0L, notes = NA,
|
|
traits = list()) {
|
|
api_put(db, paste0("/v1/inspections/", id), list(
|
|
date = as.character(date),
|
|
inspector = inspector,
|
|
brood_frames = brood_frames,
|
|
honey_frames = honey_frames,
|
|
food_stores_kg = food_stores_kg,
|
|
colony_strength = colony_strength,
|
|
queen_seen = as.integer(queen_seen),
|
|
eggs_seen = as.integer(eggs_seen),
|
|
queen_cells_count = as.integer(queen_cells_count),
|
|
notes = notes,
|
|
traits = traits
|
|
))
|
|
}
|
|
|
|
db_inspections_delete <- function(db, id) {
|
|
api_delete(db, paste0("/v1/inspections/", id))
|
|
}
|
|
|
|
db_inspections_last <- function(db, colony_id) {
|
|
api_get_one(db, "/v1/inspections/last", list(colony_id = colony_id))
|
|
}
|