Skip to content

Instantly share code, notes, and snippets.

@borovan
Created April 14, 2022 09:57
Show Gist options
  • Save borovan/697dc7c58fccc5bc85f15499e732898b to your computer and use it in GitHub Desktop.
Save borovan/697dc7c58fccc5bc85f15499e732898b to your computer and use it in GitHub Desktop.
dragginz main.mo
import Buffer "mo:base/Buffer";
import Debug "mo:base/Debug";
import Iter "mo:base/Iter";
import Nat "mo:base/Nat";
import Principal "mo:base/Principal";
import Cycles "mo:base/ExperimentalCycles";
import Random "Random";
import Result "Result";
import Fixtures "orm/Fixtures";
import ORM "orm/ORM";
import DB "orm/gen/DB";
import T "orm/Types";
import E "orm/gen/Entity";
import M "orm/gen/Metadata";
import R "orm/gen/Record";
import V "orm/gen/Validator";
import Player "game/Player";
shared ({caller = owner}) actor class Dragginz() = this {
// shortcuts
type Result = Result.Result;
type Entity<R, M> = ORM.Entity<R, M>;
//
// START DRAGGINZ
//
Debug.print("");
Debug.print("*=* starting dragginz v0.1.4 *=*");
Debug.print("");
//
// SERVICES
//
let random = Random.Random();
let db = DB.DB({ random });
//
// FIXTURES
//
let fixtures = Fixtures.Data({
db = db;
random = random;
});
let res = fixtures.save();
if (res != #ok) {
Result.debugPrint(res);
Debug.print("*** VALIDATION ERRORS - PLEASE FIX ***");
};
//
// START TESTING AREA
//
// test
public func test() : async() {
Debug.print("--- start ---");
Debug.print("----- end ------");
};
//
// END TESTING AREA
//
//
// HELPER FUNCS
//
// checkPermission
func checkPermission(caller : Principal, permission : Text) : Result {
ignore do ? {
let player = db.player.loadByPrincipal(caller)!;
let perm = db.aclPermission.loadByName(permission)!;
return Player.Player(player, { db = db }).hasPermission(perm.id);
};
#err("access denied");
};
// auth
// auth is run at the start of every API call
// it runs global commands and then does a permission check
func auth(caller : Principal, permission : Text) : Result {
// init stuff here...
// auth
Debug.print("-----------------------------");
Debug.print("auth: " # permission);
checkPermission(caller, permission);
};
//
// API CALLS
//
// balance
public shared query({ caller }) func balance() : async Nat {
Cycles.balance();
};
// player
public shared query({ caller }) func player() : async ?E.Player {
db.player.loadByPrincipal(caller);
};
// checkPermissions
// for the front end to query many permissions at once
public shared query({ caller }) func checkPermissions(perms : [Text]) : async [Result] {
let size = perms.size();
let buf = Buffer.Buffer<Result>(size);
for (i in Iter.range(0, size-1)) {
buf.add(auth(caller, perms[i]));
};
buf.toArray();
};
//
// QUERY
//
class Query<R, M>(caller : Principal, db : ORM.Store<R, M>, aclPermission : Text) {
// load
public func load(id : Nat) : (Result, ?Entity<R, M>) {
let res = auth(caller, aclPermission);
if (res != #ok) {
return (res, null);
};
(#ok, db.load(id));
};
// loadMany
public func loadMany(ids : [Nat]) : (Result, [Entity<R, M>]) {
let res = auth(caller, aclPermission);
if (res != #ok) {
return (res, []);
};
let rows = db.loadMany(ids);
(#ok, Iter.toArray<Entity<R, M>>(rows));
};
// loadRange
public func loadRange(start : Nat, count : Nat) : (Result, [Entity<R, M>]) {
let res = auth(caller, aclPermission);
if (res != #ok) {
return (res, []);
};
let rows = db.loadRange(start, count);
(#ok, Iter.toArray<Entity<R, M>>(rows));
};
// loadManyByIndex
public func loadManyByIndex<T>(ids : [T], fn : ([T]) -> Iter.Iter<Entity<R, M>>) : (Result, [Entity<R, M>]) {
let res = auth(caller, aclPermission);
if (res != #ok) {
return (res, []);
};
let rows = fn(ids);
(#ok, Iter.toArray<Entity<R, M>>(rows));
};
// create
public func create(r : R, validator : ORM.Validator<R>) : (Result, ?Nat) {
var res : Result = #ok;
// acl check
res := auth(caller, aclPermission);
if (res != #ok) {
return (res, null);
};
// validate
res := validator.fields(r);
if (res != #ok) {
return (res, null);
};
// db
let id = random.nat();
res := db.create(id, r);
if (res != #ok) {
return (res, null);
};
(#ok, ?id);
};
// update
public func update(id : Nat, r : R, validator : ORM.Validator<R>) : Result {
var res : Result = #ok;
// acl check
res := auth(caller, aclPermission);
if (res != #ok) {
return res;
};
// validate
res := validator.fields(r);
if (res != #ok) {
return res;
};
// db
res := db.update(id, r);
if (res != #ok) {
return res;
};
#ok;
};
};
// STARTPASTE
// ACLPermission
public shared query({ caller }) func loadManyACLPermission(ids : [Nat]) : async (Result, [E.ACLPermission]) {
Query<R.ACLPermission, M.ACLPermission>(caller, db.aclPermission, "root").
loadMany(ids);
};
public shared query({ caller }) func loadRangeACLPermission(start : Nat, count : Nat) : async (Result, [E.ACLPermission]) {
Query<R.ACLPermission, M.ACLPermission>(caller, db.aclPermission, "root").
loadRange(start, count);
};
public shared query({ caller }) func loadManyACLPermissionByName(vars : [Text]) : async (Result, [E.ACLPermission]) {
Query<R.ACLPermission, M.ACLPermission>(caller, db.aclPermission, "root").
loadManyByIndex<Text>(vars, db.aclPermission.loadManyByName);
};
public shared({ caller }) func createACLPermission(r : R.ACLPermission) : async (Result, ?Nat) {
Query<R.ACLPermission, M.ACLPermission>(caller, db.aclPermission, "root").
create(r, V.ACLPermission({db = db}));
};
public shared({ caller }) func updateACLPermission(id : Nat, r : R.ACLPermission) : async Result {
Query<R.ACLPermission, M.ACLPermission>(caller, db.aclPermission, "root").
update(id, r, V.ACLPermission({db = db}));
};
// ACLRole
public shared query({ caller }) func loadManyACLRole(ids : [Nat]) : async (Result, [E.ACLRole]) {
Query<R.ACLRole, M.ACLRole>(caller, db.aclRole, "root").
loadMany(ids);
};
public shared query({ caller }) func loadRangeACLRole(start : Nat, count : Nat) : async (Result, [E.ACLRole]) {
Query<R.ACLRole, M.ACLRole>(caller, db.aclRole, "root").
loadRange(start, count);
};
public shared({ caller }) func createACLRole(r : R.ACLRole) : async (Result, ?Nat) {
Query<R.ACLRole, M.ACLRole>(caller, db.aclRole, "root").
create(r, V.ACLRole({db = db}));
};
public shared({ caller }) func updateACLRole(id : Nat, r : R.ACLRole) : async Result {
Query<R.ACLRole, M.ACLRole>(caller, db.aclRole, "root").
update(id, r, V.ACLRole({db = db}));
};
// Ability
public shared query({ caller }) func loadManyAbility(ids : [Nat]) : async (Result, [E.Ability]) {
Query<R.Ability, M.Ability>(caller, db.ability, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeAbility(start : Nat, count : Nat) : async (Result, [E.Ability]) {
Query<R.Ability, M.Ability>(caller, db.ability, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createAbility(r : R.Ability) : async (Result, ?Nat) {
Query<R.Ability, M.Ability>(caller, db.ability, "root.admin.save").
create(r, V.Ability({db = db}));
};
public shared({ caller }) func updateAbility(id : Nat, r : R.Ability) : async Result {
Query<R.Ability, M.Ability>(caller, db.ability, "root.admin.save").
update(id, r, V.Ability({db = db}));
};
// AbilityCategory
public shared query({ caller }) func loadManyAbilityCategory(ids : [Nat]) : async (Result, [E.AbilityCategory]) {
Query<R.AbilityCategory, M.AbilityCategory>(caller, db.abilityCategory, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeAbilityCategory(start : Nat, count : Nat) : async (Result, [E.AbilityCategory]) {
Query<R.AbilityCategory, M.AbilityCategory>(caller, db.abilityCategory, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createAbilityCategory(r : R.AbilityCategory) : async (Result, ?Nat) {
Query<R.AbilityCategory, M.AbilityCategory>(caller, db.abilityCategory, "root.admin.save").
create(r, V.AbilityCategory({db = db}));
};
public shared({ caller }) func updateAbilityCategory(id : Nat, r : R.AbilityCategory) : async Result {
Query<R.AbilityCategory, M.AbilityCategory>(caller, db.abilityCategory, "root.admin.save").
update(id, r, V.AbilityCategory({db = db}));
};
// Acidity
public shared query({ caller }) func loadManyAcidity(ids : [Nat]) : async (Result, [E.Acidity]) {
Query<R.Acidity, M.Acidity>(caller, db.acidity, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeAcidity(start : Nat, count : Nat) : async (Result, [E.Acidity]) {
Query<R.Acidity, M.Acidity>(caller, db.acidity, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createAcidity(r : R.Acidity) : async (Result, ?Nat) {
Query<R.Acidity, M.Acidity>(caller, db.acidity, "root.admin.save").
create(r, V.Acidity({db = db}));
};
public shared({ caller }) func updateAcidity(id : Nat, r : R.Acidity) : async Result {
Query<R.Acidity, M.Acidity>(caller, db.acidity, "root.admin.save").
update(id, r, V.Acidity({db = db}));
};
// AlchemyRecipe
public shared query({ caller }) func loadManyAlchemyRecipe(ids : [Nat]) : async (Result, [E.AlchemyRecipe]) {
Query<R.AlchemyRecipe, M.AlchemyRecipe>(caller, db.alchemyRecipe, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeAlchemyRecipe(start : Nat, count : Nat) : async (Result, [E.AlchemyRecipe]) {
Query<R.AlchemyRecipe, M.AlchemyRecipe>(caller, db.alchemyRecipe, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createAlchemyRecipe(r : R.AlchemyRecipe) : async (Result, ?Nat) {
Query<R.AlchemyRecipe, M.AlchemyRecipe>(caller, db.alchemyRecipe, "root.admin.save").
create(r, V.AlchemyRecipe({db = db}));
};
public shared({ caller }) func updateAlchemyRecipe(id : Nat, r : R.AlchemyRecipe) : async Result {
Query<R.AlchemyRecipe, M.AlchemyRecipe>(caller, db.alchemyRecipe, "root.admin.save").
update(id, r, V.AlchemyRecipe({db = db}));
};
// Animation
public shared query({ caller }) func loadManyAnimation(ids : [Nat]) : async (Result, [E.Animation]) {
Query<R.Animation, M.Animation>(caller, db.animation, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeAnimation(start : Nat, count : Nat) : async (Result, [E.Animation]) {
Query<R.Animation, M.Animation>(caller, db.animation, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createAnimation(r : R.Animation) : async (Result, ?Nat) {
Query<R.Animation, M.Animation>(caller, db.animation, "root.admin.save").
create(r, V.Animation({db = db}));
};
public shared({ caller }) func updateAnimation(id : Nat, r : R.Animation) : async Result {
Query<R.Animation, M.Animation>(caller, db.animation, "root.admin.save").
update(id, r, V.Animation({db = db}));
};
// Area
public shared query({ caller }) func loadManyArea(ids : [Nat]) : async (Result, [E.Area]) {
Query<R.Area, M.Area>(caller, db.area, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeArea(start : Nat, count : Nat) : async (Result, [E.Area]) {
Query<R.Area, M.Area>(caller, db.area, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createArea(r : R.Area) : async (Result, ?Nat) {
Query<R.Area, M.Area>(caller, db.area, "root").
create(r, V.Area({db = db}));
};
public shared({ caller }) func updateArea(id : Nat, r : R.Area) : async Result {
Query<R.Area, M.Area>(caller, db.area, "root").
update(id, r, V.Area({db = db}));
};
// AssetBundle
public shared query({ caller }) func loadManyAssetBundle(ids : [Nat]) : async (Result, [E.AssetBundle]) {
Query<R.AssetBundle, M.AssetBundle>(caller, db.assetBundle, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeAssetBundle(start : Nat, count : Nat) : async (Result, [E.AssetBundle]) {
Query<R.AssetBundle, M.AssetBundle>(caller, db.assetBundle, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createAssetBundle(r : R.AssetBundle) : async (Result, ?Nat) {
Query<R.AssetBundle, M.AssetBundle>(caller, db.assetBundle, "root.admin.save").
create(r, V.AssetBundle({db = db}));
};
public shared({ caller }) func updateAssetBundle(id : Nat, r : R.AssetBundle) : async Result {
Query<R.AssetBundle, M.AssetBundle>(caller, db.assetBundle, "root.admin.save").
update(id, r, V.AssetBundle({db = db}));
};
// Atmosphere
public shared query({ caller }) func loadManyAtmosphere(ids : [Nat]) : async (Result, [E.Atmosphere]) {
Query<R.Atmosphere, M.Atmosphere>(caller, db.atmosphere, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeAtmosphere(start : Nat, count : Nat) : async (Result, [E.Atmosphere]) {
Query<R.Atmosphere, M.Atmosphere>(caller, db.atmosphere, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createAtmosphere(r : R.Atmosphere) : async (Result, ?Nat) {
Query<R.Atmosphere, M.Atmosphere>(caller, db.atmosphere, "root.admin.save").
create(r, V.Atmosphere({db = db}));
};
public shared({ caller }) func updateAtmosphere(id : Nat, r : R.Atmosphere) : async Result {
Query<R.Atmosphere, M.Atmosphere>(caller, db.atmosphere, "root.admin.save").
update(id, r, V.Atmosphere({db = db}));
};
// Biome
public shared query({ caller }) func loadManyBiome(ids : [Nat]) : async (Result, [E.Biome]) {
Query<R.Biome, M.Biome>(caller, db.biome, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeBiome(start : Nat, count : Nat) : async (Result, [E.Biome]) {
Query<R.Biome, M.Biome>(caller, db.biome, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createBiome(r : R.Biome) : async (Result, ?Nat) {
Query<R.Biome, M.Biome>(caller, db.biome, "root.admin.save").
create(r, V.Biome({db = db}));
};
public shared({ caller }) func updateBiome(id : Nat, r : R.Biome) : async Result {
Query<R.Biome, M.Biome>(caller, db.biome, "root.admin.save").
update(id, r, V.Biome({db = db}));
};
// Character
public shared query({ caller }) func loadManyCharacter(ids : [Nat]) : async (Result, [E.Character]) {
Query<R.Character, M.Character>(caller, db.character, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeCharacter(start : Nat, count : Nat) : async (Result, [E.Character]) {
Query<R.Character, M.Character>(caller, db.character, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createCharacter(r : R.Character) : async (Result, ?Nat) {
Query<R.Character, M.Character>(caller, db.character, "root.admin.save").
create(r, V.Character({db = db}));
};
public shared({ caller }) func updateCharacter(id : Nat, r : R.Character) : async Result {
Query<R.Character, M.Character>(caller, db.character, "root.admin.save").
update(id, r, V.Character({db = db}));
};
// CharacterTemplate
public shared query({ caller }) func loadManyCharacterTemplate(ids : [Nat]) : async (Result, [E.CharacterTemplate]) {
Query<R.CharacterTemplate, M.CharacterTemplate>(caller, db.characterTemplate, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeCharacterTemplate(start : Nat, count : Nat) : async (Result, [E.CharacterTemplate]) {
Query<R.CharacterTemplate, M.CharacterTemplate>(caller, db.characterTemplate, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createCharacterTemplate(r : R.CharacterTemplate) : async (Result, ?Nat) {
Query<R.CharacterTemplate, M.CharacterTemplate>(caller, db.characterTemplate, "root.admin.save").
create(r, V.CharacterTemplate({db = db}));
};
public shared({ caller }) func updateCharacterTemplate(id : Nat, r : R.CharacterTemplate) : async Result {
Query<R.CharacterTemplate, M.CharacterTemplate>(caller, db.characterTemplate, "root.admin.save").
update(id, r, V.CharacterTemplate({db = db}));
};
// Climate
public shared query({ caller }) func loadManyClimate(ids : [Nat]) : async (Result, [E.Climate]) {
Query<R.Climate, M.Climate>(caller, db.climate, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeClimate(start : Nat, count : Nat) : async (Result, [E.Climate]) {
Query<R.Climate, M.Climate>(caller, db.climate, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createClimate(r : R.Climate) : async (Result, ?Nat) {
Query<R.Climate, M.Climate>(caller, db.climate, "root.admin.save").
create(r, V.Climate({db = db}));
};
public shared({ caller }) func updateClimate(id : Nat, r : R.Climate) : async Result {
Query<R.Climate, M.Climate>(caller, db.climate, "root.admin.save").
update(id, r, V.Climate({db = db}));
};
// Colour
public shared query({ caller }) func loadManyColour(ids : [Nat]) : async (Result, [E.Colour]) {
Query<R.Colour, M.Colour>(caller, db.colour, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeColour(start : Nat, count : Nat) : async (Result, [E.Colour]) {
Query<R.Colour, M.Colour>(caller, db.colour, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createColour(r : R.Colour) : async (Result, ?Nat) {
Query<R.Colour, M.Colour>(caller, db.colour, "root.admin.save").
create(r, V.Colour({db = db}));
};
public shared({ caller }) func updateColour(id : Nat, r : R.Colour) : async Result {
Query<R.Colour, M.Colour>(caller, db.colour, "root.admin.save").
update(id, r, V.Colour({db = db}));
};
// CookingCategory
public shared query({ caller }) func loadManyCookingCategory(ids : [Nat]) : async (Result, [E.CookingCategory]) {
Query<R.CookingCategory, M.CookingCategory>(caller, db.cookingCategory, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeCookingCategory(start : Nat, count : Nat) : async (Result, [E.CookingCategory]) {
Query<R.CookingCategory, M.CookingCategory>(caller, db.cookingCategory, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createCookingCategory(r : R.CookingCategory) : async (Result, ?Nat) {
Query<R.CookingCategory, M.CookingCategory>(caller, db.cookingCategory, "root.admin.save").
create(r, V.CookingCategory({db = db}));
};
public shared({ caller }) func updateCookingCategory(id : Nat, r : R.CookingCategory) : async Result {
Query<R.CookingCategory, M.CookingCategory>(caller, db.cookingCategory, "root.admin.save").
update(id, r, V.CookingCategory({db = db}));
};
// CookingRecipe
public shared query({ caller }) func loadManyCookingRecipe(ids : [Nat]) : async (Result, [E.CookingRecipe]) {
Query<R.CookingRecipe, M.CookingRecipe>(caller, db.cookingRecipe, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeCookingRecipe(start : Nat, count : Nat) : async (Result, [E.CookingRecipe]) {
Query<R.CookingRecipe, M.CookingRecipe>(caller, db.cookingRecipe, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createCookingRecipe(r : R.CookingRecipe) : async (Result, ?Nat) {
Query<R.CookingRecipe, M.CookingRecipe>(caller, db.cookingRecipe, "root.admin.save").
create(r, V.CookingRecipe({db = db}));
};
public shared({ caller }) func updateCookingRecipe(id : Nat, r : R.CookingRecipe) : async Result {
Query<R.CookingRecipe, M.CookingRecipe>(caller, db.cookingRecipe, "root.admin.save").
update(id, r, V.CookingRecipe({db = db}));
};
// Cooldown
public shared query({ caller }) func loadManyCooldown(ids : [Nat]) : async (Result, [E.Cooldown]) {
Query<R.Cooldown, M.Cooldown>(caller, db.cooldown, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeCooldown(start : Nat, count : Nat) : async (Result, [E.Cooldown]) {
Query<R.Cooldown, M.Cooldown>(caller, db.cooldown, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createCooldown(r : R.Cooldown) : async (Result, ?Nat) {
Query<R.Cooldown, M.Cooldown>(caller, db.cooldown, "root.admin.save").
create(r, V.Cooldown({db = db}));
};
public shared({ caller }) func updateCooldown(id : Nat, r : R.Cooldown) : async Result {
Query<R.Cooldown, M.Cooldown>(caller, db.cooldown, "root.admin.save").
update(id, r, V.Cooldown({db = db}));
};
// Cover
public shared query({ caller }) func loadManyCover(ids : [Nat]) : async (Result, [E.Cover]) {
Query<R.Cover, M.Cover>(caller, db.cover, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeCover(start : Nat, count : Nat) : async (Result, [E.Cover]) {
Query<R.Cover, M.Cover>(caller, db.cover, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createCover(r : R.Cover) : async (Result, ?Nat) {
Query<R.Cover, M.Cover>(caller, db.cover, "root.admin.save").
create(r, V.Cover({db = db}));
};
public shared({ caller }) func updateCover(id : Nat, r : R.Cover) : async Result {
Query<R.Cover, M.Cover>(caller, db.cover, "root.admin.save").
update(id, r, V.Cover({db = db}));
};
// Culture
public shared query({ caller }) func loadManyCulture(ids : [Nat]) : async (Result, [E.Culture]) {
Query<R.Culture, M.Culture>(caller, db.culture, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeCulture(start : Nat, count : Nat) : async (Result, [E.Culture]) {
Query<R.Culture, M.Culture>(caller, db.culture, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createCulture(r : R.Culture) : async (Result, ?Nat) {
Query<R.Culture, M.Culture>(caller, db.culture, "root.admin.save").
create(r, V.Culture({db = db}));
};
public shared({ caller }) func updateCulture(id : Nat, r : R.Culture) : async Result {
Query<R.Culture, M.Culture>(caller, db.culture, "root.admin.save").
update(id, r, V.Culture({db = db}));
};
// DamageResist
public shared query({ caller }) func loadManyDamageResist(ids : [Nat]) : async (Result, [E.DamageResist]) {
Query<R.DamageResist, M.DamageResist>(caller, db.damageResist, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeDamageResist(start : Nat, count : Nat) : async (Result, [E.DamageResist]) {
Query<R.DamageResist, M.DamageResist>(caller, db.damageResist, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createDamageResist(r : R.DamageResist) : async (Result, ?Nat) {
Query<R.DamageResist, M.DamageResist>(caller, db.damageResist, "root").
create(r, V.DamageResist({db = db}));
};
public shared({ caller }) func updateDamageResist(id : Nat, r : R.DamageResist) : async Result {
Query<R.DamageResist, M.DamageResist>(caller, db.damageResist, "root").
update(id, r, V.DamageResist({db = db}));
};
// DamageType
public shared query({ caller }) func loadManyDamageType(ids : [Nat]) : async (Result, [E.DamageType]) {
Query<R.DamageType, M.DamageType>(caller, db.damageType, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeDamageType(start : Nat, count : Nat) : async (Result, [E.DamageType]) {
Query<R.DamageType, M.DamageType>(caller, db.damageType, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createDamageType(r : R.DamageType) : async (Result, ?Nat) {
Query<R.DamageType, M.DamageType>(caller, db.damageType, "root").
create(r, V.DamageType({db = db}));
};
public shared({ caller }) func updateDamageType(id : Nat, r : R.DamageType) : async Result {
Query<R.DamageType, M.DamageType>(caller, db.damageType, "root").
update(id, r, V.DamageType({db = db}));
};
// Density
public shared query({ caller }) func loadManyDensity(ids : [Nat]) : async (Result, [E.Density]) {
Query<R.Density, M.Density>(caller, db.density, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeDensity(start : Nat, count : Nat) : async (Result, [E.Density]) {
Query<R.Density, M.Density>(caller, db.density, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createDensity(r : R.Density) : async (Result, ?Nat) {
Query<R.Density, M.Density>(caller, db.density, "root").
create(r, V.Density({db = db}));
};
public shared({ caller }) func updateDensity(id : Nat, r : R.Density) : async Result {
Query<R.Density, M.Density>(caller, db.density, "root").
update(id, r, V.Density({db = db}));
};
// Direction
public shared query({ caller }) func loadManyDirection(ids : [Nat]) : async (Result, [E.Direction]) {
Query<R.Direction, M.Direction>(caller, db.direction, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeDirection(start : Nat, count : Nat) : async (Result, [E.Direction]) {
Query<R.Direction, M.Direction>(caller, db.direction, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createDirection(r : R.Direction) : async (Result, ?Nat) {
Query<R.Direction, M.Direction>(caller, db.direction, "root").
create(r, V.Direction({db = db}));
};
public shared({ caller }) func updateDirection(id : Nat, r : R.Direction) : async Result {
Query<R.Direction, M.Direction>(caller, db.direction, "root").
update(id, r, V.Direction({db = db}));
};
// Discovery
public shared query({ caller }) func loadManyDiscovery(ids : [Nat]) : async (Result, [E.Discovery]) {
Query<R.Discovery, M.Discovery>(caller, db.discovery, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeDiscovery(start : Nat, count : Nat) : async (Result, [E.Discovery]) {
Query<R.Discovery, M.Discovery>(caller, db.discovery, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createDiscovery(r : R.Discovery) : async (Result, ?Nat) {
Query<R.Discovery, M.Discovery>(caller, db.discovery, "root").
create(r, V.Discovery({db = db}));
};
public shared({ caller }) func updateDiscovery(id : Nat, r : R.Discovery) : async Result {
Query<R.Discovery, M.Discovery>(caller, db.discovery, "root").
update(id, r, V.Discovery({db = db}));
};
// Distance
public shared query({ caller }) func loadManyDistance(ids : [Nat]) : async (Result, [E.Distance]) {
Query<R.Distance, M.Distance>(caller, db.distance, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeDistance(start : Nat, count : Nat) : async (Result, [E.Distance]) {
Query<R.Distance, M.Distance>(caller, db.distance, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createDistance(r : R.Distance) : async (Result, ?Nat) {
Query<R.Distance, M.Distance>(caller, db.distance, "root").
create(r, V.Distance({db = db}));
};
public shared({ caller }) func updateDistance(id : Nat, r : R.Distance) : async Result {
Query<R.Distance, M.Distance>(caller, db.distance, "root").
update(id, r, V.Distance({db = db}));
};
// Domain
public shared query({ caller }) func loadManyDomain(ids : [Nat]) : async (Result, [E.Domain]) {
Query<R.Domain, M.Domain>(caller, db.domain, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeDomain(start : Nat, count : Nat) : async (Result, [E.Domain]) {
Query<R.Domain, M.Domain>(caller, db.domain, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createDomain(r : R.Domain) : async (Result, ?Nat) {
Query<R.Domain, M.Domain>(caller, db.domain, "root").
create(r, V.Domain({db = db}));
};
public shared({ caller }) func updateDomain(id : Nat, r : R.Domain) : async Result {
Query<R.Domain, M.Domain>(caller, db.domain, "root").
update(id, r, V.Domain({db = db}));
};
// Duration
public shared query({ caller }) func loadManyDuration(ids : [Nat]) : async (Result, [E.Duration]) {
Query<R.Duration, M.Duration>(caller, db.duration, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeDuration(start : Nat, count : Nat) : async (Result, [E.Duration]) {
Query<R.Duration, M.Duration>(caller, db.duration, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createDuration(r : R.Duration) : async (Result, ?Nat) {
Query<R.Duration, M.Duration>(caller, db.duration, "root").
create(r, V.Duration({db = db}));
};
public shared({ caller }) func updateDuration(id : Nat, r : R.Duration) : async Result {
Query<R.Duration, M.Duration>(caller, db.duration, "root").
update(id, r, V.Duration({db = db}));
};
// Event
public shared query({ caller }) func loadManyEvent(ids : [Nat]) : async (Result, [E.Event]) {
Query<R.Event, M.Event>(caller, db.event, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeEvent(start : Nat, count : Nat) : async (Result, [E.Event]) {
Query<R.Event, M.Event>(caller, db.event, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createEvent(r : R.Event) : async (Result, ?Nat) {
Query<R.Event, M.Event>(caller, db.event, "root.admin.save").
create(r, V.Event({db = db}));
};
public shared({ caller }) func updateEvent(id : Nat, r : R.Event) : async Result {
Query<R.Event, M.Event>(caller, db.event, "root.admin.save").
update(id, r, V.Event({db = db}));
};
// Footprint
public shared query({ caller }) func loadManyFootprint(ids : [Nat]) : async (Result, [E.Footprint]) {
Query<R.Footprint, M.Footprint>(caller, db.footprint, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeFootprint(start : Nat, count : Nat) : async (Result, [E.Footprint]) {
Query<R.Footprint, M.Footprint>(caller, db.footprint, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createFootprint(r : R.Footprint) : async (Result, ?Nat) {
Query<R.Footprint, M.Footprint>(caller, db.footprint, "root").
create(r, V.Footprint({db = db}));
};
public shared({ caller }) func updateFootprint(id : Nat, r : R.Footprint) : async Result {
Query<R.Footprint, M.Footprint>(caller, db.footprint, "root").
update(id, r, V.Footprint({db = db}));
};
// Gender
public shared query({ caller }) func loadManyGender(ids : [Nat]) : async (Result, [E.Gender]) {
Query<R.Gender, M.Gender>(caller, db.gender, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeGender(start : Nat, count : Nat) : async (Result, [E.Gender]) {
Query<R.Gender, M.Gender>(caller, db.gender, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createGender(r : R.Gender) : async (Result, ?Nat) {
Query<R.Gender, M.Gender>(caller, db.gender, "root").
create(r, V.Gender({db = db}));
};
public shared({ caller }) func updateGender(id : Nat, r : R.Gender) : async Result {
Query<R.Gender, M.Gender>(caller, db.gender, "root").
update(id, r, V.Gender({db = db}));
};
// Geology
public shared query({ caller }) func loadManyGeology(ids : [Nat]) : async (Result, [E.Geology]) {
Query<R.Geology, M.Geology>(caller, db.geology, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeGeology(start : Nat, count : Nat) : async (Result, [E.Geology]) {
Query<R.Geology, M.Geology>(caller, db.geology, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createGeology(r : R.Geology) : async (Result, ?Nat) {
Query<R.Geology, M.Geology>(caller, db.geology, "root.admin.save").
create(r, V.Geology({db = db}));
};
public shared({ caller }) func updateGeology(id : Nat, r : R.Geology) : async Result {
Query<R.Geology, M.Geology>(caller, db.geology, "root.admin.save").
update(id, r, V.Geology({db = db}));
};
// Hardness
public shared query({ caller }) func loadManyHardness(ids : [Nat]) : async (Result, [E.Hardness]) {
Query<R.Hardness, M.Hardness>(caller, db.hardness, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeHardness(start : Nat, count : Nat) : async (Result, [E.Hardness]) {
Query<R.Hardness, M.Hardness>(caller, db.hardness, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createHardness(r : R.Hardness) : async (Result, ?Nat) {
Query<R.Hardness, M.Hardness>(caller, db.hardness, "root").
create(r, V.Hardness({db = db}));
};
public shared({ caller }) func updateHardness(id : Nat, r : R.Hardness) : async Result {
Query<R.Hardness, M.Hardness>(caller, db.hardness, "root").
update(id, r, V.Hardness({db = db}));
};
// Icon
public shared query({ caller }) func loadManyIcon(ids : [Nat]) : async (Result, [E.Icon]) {
Query<R.Icon, M.Icon>(caller, db.icon, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeIcon(start : Nat, count : Nat) : async (Result, [E.Icon]) {
Query<R.Icon, M.Icon>(caller, db.icon, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createIcon(r : R.Icon) : async (Result, ?Nat) {
Query<R.Icon, M.Icon>(caller, db.icon, "root.admin.save").
create(r, V.Icon({db = db}));
};
public shared({ caller }) func updateIcon(id : Nat, r : R.Icon) : async Result {
Query<R.Icon, M.Icon>(caller, db.icon, "root.admin.save").
update(id, r, V.Icon({db = db}));
};
// Item
public shared query({ caller }) func loadManyItem(ids : [Nat]) : async (Result, [E.Item]) {
Query<R.Item, M.Item>(caller, db.item, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeItem(start : Nat, count : Nat) : async (Result, [E.Item]) {
Query<R.Item, M.Item>(caller, db.item, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createItem(r : R.Item) : async (Result, ?Nat) {
Query<R.Item, M.Item>(caller, db.item, "root.admin.save").
create(r, V.Item({db = db}));
};
public shared({ caller }) func updateItem(id : Nat, r : R.Item) : async Result {
Query<R.Item, M.Item>(caller, db.item, "root.admin.save").
update(id, r, V.Item({db = db}));
};
// ItemMass
public shared query({ caller }) func loadManyItemMass(ids : [Nat]) : async (Result, [E.ItemMass]) {
Query<R.ItemMass, M.ItemMass>(caller, db.itemMass, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeItemMass(start : Nat, count : Nat) : async (Result, [E.ItemMass]) {
Query<R.ItemMass, M.ItemMass>(caller, db.itemMass, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createItemMass(r : R.ItemMass) : async (Result, ?Nat) {
Query<R.ItemMass, M.ItemMass>(caller, db.itemMass, "root").
create(r, V.ItemMass({db = db}));
};
public shared({ caller }) func updateItemMass(id : Nat, r : R.ItemMass) : async Result {
Query<R.ItemMass, M.ItemMass>(caller, db.itemMass, "root").
update(id, r, V.ItemMass({db = db}));
};
// ItemSet
public shared query({ caller }) func loadManyItemSet(ids : [Nat]) : async (Result, [E.ItemSet]) {
Query<R.ItemSet, M.ItemSet>(caller, db.itemSet, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeItemSet(start : Nat, count : Nat) : async (Result, [E.ItemSet]) {
Query<R.ItemSet, M.ItemSet>(caller, db.itemSet, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createItemSet(r : R.ItemSet) : async (Result, ?Nat) {
Query<R.ItemSet, M.ItemSet>(caller, db.itemSet, "root").
create(r, V.ItemSet({db = db}));
};
public shared({ caller }) func updateItemSet(id : Nat, r : R.ItemSet) : async Result {
Query<R.ItemSet, M.ItemSet>(caller, db.itemSet, "root").
update(id, r, V.ItemSet({db = db}));
};
// ItemShape
public shared query({ caller }) func loadManyItemShape(ids : [Nat]) : async (Result, [E.ItemShape]) {
Query<R.ItemShape, M.ItemShape>(caller, db.itemShape, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeItemShape(start : Nat, count : Nat) : async (Result, [E.ItemShape]) {
Query<R.ItemShape, M.ItemShape>(caller, db.itemShape, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createItemShape(r : R.ItemShape) : async (Result, ?Nat) {
Query<R.ItemShape, M.ItemShape>(caller, db.itemShape, "root").
create(r, V.ItemShape({db = db}));
};
public shared({ caller }) func updateItemShape(id : Nat, r : R.ItemShape) : async Result {
Query<R.ItemShape, M.ItemShape>(caller, db.itemShape, "root").
update(id, r, V.ItemShape({db = db}));
};
// ItemStack
public shared query({ caller }) func loadManyItemStack(ids : [Nat]) : async (Result, [E.ItemStack]) {
Query<R.ItemStack, M.ItemStack>(caller, db.itemStack, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeItemStack(start : Nat, count : Nat) : async (Result, [E.ItemStack]) {
Query<R.ItemStack, M.ItemStack>(caller, db.itemStack, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createItemStack(r : R.ItemStack) : async (Result, ?Nat) {
Query<R.ItemStack, M.ItemStack>(caller, db.itemStack, "root").
create(r, V.ItemStack({db = db}));
};
public shared({ caller }) func updateItemStack(id : Nat, r : R.ItemStack) : async Result {
Query<R.ItemStack, M.ItemStack>(caller, db.itemStack, "root").
update(id, r, V.ItemStack({db = db}));
};
// ItemWarmth
public shared query({ caller }) func loadManyItemWarmth(ids : [Nat]) : async (Result, [E.ItemWarmth]) {
Query<R.ItemWarmth, M.ItemWarmth>(caller, db.itemWarmth, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeItemWarmth(start : Nat, count : Nat) : async (Result, [E.ItemWarmth]) {
Query<R.ItemWarmth, M.ItemWarmth>(caller, db.itemWarmth, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createItemWarmth(r : R.ItemWarmth) : async (Result, ?Nat) {
Query<R.ItemWarmth, M.ItemWarmth>(caller, db.itemWarmth, "root").
create(r, V.ItemWarmth({db = db}));
};
public shared({ caller }) func updateItemWarmth(id : Nat, r : R.ItemWarmth) : async Result {
Query<R.ItemWarmth, M.ItemWarmth>(caller, db.itemWarmth, "root").
update(id, r, V.ItemWarmth({db = db}));
};
// LootAlchemy
public shared query({ caller }) func loadManyLootAlchemy(ids : [Nat]) : async (Result, [E.LootAlchemy]) {
Query<R.LootAlchemy, M.LootAlchemy>(caller, db.lootAlchemy, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeLootAlchemy(start : Nat, count : Nat) : async (Result, [E.LootAlchemy]) {
Query<R.LootAlchemy, M.LootAlchemy>(caller, db.lootAlchemy, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createLootAlchemy(r : R.LootAlchemy) : async (Result, ?Nat) {
Query<R.LootAlchemy, M.LootAlchemy>(caller, db.lootAlchemy, "root.admin.save").
create(r, V.LootAlchemy({db = db}));
};
public shared({ caller }) func updateLootAlchemy(id : Nat, r : R.LootAlchemy) : async Result {
Query<R.LootAlchemy, M.LootAlchemy>(caller, db.lootAlchemy, "root.admin.save").
update(id, r, V.LootAlchemy({db = db}));
};
// LootCombat
public shared query({ caller }) func loadManyLootCombat(ids : [Nat]) : async (Result, [E.LootCombat]) {
Query<R.LootCombat, M.LootCombat>(caller, db.lootCombat, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeLootCombat(start : Nat, count : Nat) : async (Result, [E.LootCombat]) {
Query<R.LootCombat, M.LootCombat>(caller, db.lootCombat, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createLootCombat(r : R.LootCombat) : async (Result, ?Nat) {
Query<R.LootCombat, M.LootCombat>(caller, db.lootCombat, "root.admin.save").
create(r, V.LootCombat({db = db}));
};
public shared({ caller }) func updateLootCombat(id : Nat, r : R.LootCombat) : async Result {
Query<R.LootCombat, M.LootCombat>(caller, db.lootCombat, "root.admin.save").
update(id, r, V.LootCombat({db = db}));
};
// LootForage
public shared query({ caller }) func loadManyLootForage(ids : [Nat]) : async (Result, [E.LootForage]) {
Query<R.LootForage, M.LootForage>(caller, db.lootForage, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeLootForage(start : Nat, count : Nat) : async (Result, [E.LootForage]) {
Query<R.LootForage, M.LootForage>(caller, db.lootForage, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createLootForage(r : R.LootForage) : async (Result, ?Nat) {
Query<R.LootForage, M.LootForage>(caller, db.lootForage, "root.admin.save").
create(r, V.LootForage({db = db}));
};
public shared({ caller }) func updateLootForage(id : Nat, r : R.LootForage) : async Result {
Query<R.LootForage, M.LootForage>(caller, db.lootForage, "root.admin.save").
update(id, r, V.LootForage({db = db}));
};
// LootFrequency
public shared query({ caller }) func loadManyLootFrequency(ids : [Nat]) : async (Result, [E.LootFrequency]) {
Query<R.LootFrequency, M.LootFrequency>(caller, db.lootFrequency, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeLootFrequency(start : Nat, count : Nat) : async (Result, [E.LootFrequency]) {
Query<R.LootFrequency, M.LootFrequency>(caller, db.lootFrequency, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createLootFrequency(r : R.LootFrequency) : async (Result, ?Nat) {
Query<R.LootFrequency, M.LootFrequency>(caller, db.lootFrequency, "root").
create(r, V.LootFrequency({db = db}));
};
public shared({ caller }) func updateLootFrequency(id : Nat, r : R.LootFrequency) : async Result {
Query<R.LootFrequency, M.LootFrequency>(caller, db.lootFrequency, "root").
update(id, r, V.LootFrequency({db = db}));
};
// Map
public shared query({ caller }) func loadManyMap(ids : [Nat]) : async (Result, [E.Map]) {
Query<R.Map, M.Map>(caller, db.map, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeMap(start : Nat, count : Nat) : async (Result, [E.Map]) {
Query<R.Map, M.Map>(caller, db.map, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createMap(r : R.Map) : async (Result, ?Nat) {
Query<R.Map, M.Map>(caller, db.map, "root.admin.save").
create(r, V.Map({db = db}));
};
public shared({ caller }) func updateMap(id : Nat, r : R.Map) : async Result {
Query<R.Map, M.Map>(caller, db.map, "root.admin.save").
update(id, r, V.Map({db = db}));
};
// Mass
public shared query({ caller }) func loadManyMass(ids : [Nat]) : async (Result, [E.Mass]) {
Query<R.Mass, M.Mass>(caller, db.mass, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeMass(start : Nat, count : Nat) : async (Result, [E.Mass]) {
Query<R.Mass, M.Mass>(caller, db.mass, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createMass(r : R.Mass) : async (Result, ?Nat) {
Query<R.Mass, M.Mass>(caller, db.mass, "root").
create(r, V.Mass({db = db}));
};
public shared({ caller }) func updateMass(id : Nat, r : R.Mass) : async Result {
Query<R.Mass, M.Mass>(caller, db.mass, "root").
update(id, r, V.Mass({db = db}));
};
// Material
public shared query({ caller }) func loadManyMaterial(ids : [Nat]) : async (Result, [E.Material]) {
Query<R.Material, M.Material>(caller, db.material, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeMaterial(start : Nat, count : Nat) : async (Result, [E.Material]) {
Query<R.Material, M.Material>(caller, db.material, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createMaterial(r : R.Material) : async (Result, ?Nat) {
Query<R.Material, M.Material>(caller, db.material, "root.admin.save").
create(r, V.Material({db = db}));
};
public shared({ caller }) func updateMaterial(id : Nat, r : R.Material) : async Result {
Query<R.Material, M.Material>(caller, db.material, "root.admin.save").
update(id, r, V.Material({db = db}));
};
// Matter
public shared query({ caller }) func loadManyMatter(ids : [Nat]) : async (Result, [E.Matter]) {
Query<R.Matter, M.Matter>(caller, db.matter, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeMatter(start : Nat, count : Nat) : async (Result, [E.Matter]) {
Query<R.Matter, M.Matter>(caller, db.matter, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createMatter(r : R.Matter) : async (Result, ?Nat) {
Query<R.Matter, M.Matter>(caller, db.matter, "root").
create(r, V.Matter({db = db}));
};
public shared({ caller }) func updateMatter(id : Nat, r : R.Matter) : async Result {
Query<R.Matter, M.Matter>(caller, db.matter, "root").
update(id, r, V.Matter({db = db}));
};
// Mob
public shared query({ caller }) func loadManyMob(ids : [Nat]) : async (Result, [E.Mob]) {
Query<R.Mob, M.Mob>(caller, db.mob, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeMob(start : Nat, count : Nat) : async (Result, [E.Mob]) {
Query<R.Mob, M.Mob>(caller, db.mob, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createMob(r : R.Mob) : async (Result, ?Nat) {
Query<R.Mob, M.Mob>(caller, db.mob, "root.admin.save").
create(r, V.Mob({db = db}));
};
public shared({ caller }) func updateMob(id : Nat, r : R.Mob) : async Result {
Query<R.Mob, M.Mob>(caller, db.mob, "root.admin.save").
update(id, r, V.Mob({db = db}));
};
// MobPart
public shared query({ caller }) func loadManyMobPart(ids : [Nat]) : async (Result, [E.MobPart]) {
Query<R.MobPart, M.MobPart>(caller, db.mobPart, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeMobPart(start : Nat, count : Nat) : async (Result, [E.MobPart]) {
Query<R.MobPart, M.MobPart>(caller, db.mobPart, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createMobPart(r : R.MobPart) : async (Result, ?Nat) {
Query<R.MobPart, M.MobPart>(caller, db.mobPart, "root").
create(r, V.MobPart({db = db}));
};
public shared({ caller }) func updateMobPart(id : Nat, r : R.MobPart) : async Result {
Query<R.MobPart, M.MobPart>(caller, db.mobPart, "root").
update(id, r, V.MobPart({db = db}));
};
// Model
public shared query({ caller }) func loadManyModel(ids : [Nat]) : async (Result, [E.Model]) {
Query<R.Model, M.Model>(caller, db.model, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeModel(start : Nat, count : Nat) : async (Result, [E.Model]) {
Query<R.Model, M.Model>(caller, db.model, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createModel(r : R.Model) : async (Result, ?Nat) {
Query<R.Model, M.Model>(caller, db.model, "root.admin.save").
create(r, V.Model({db = db}));
};
public shared({ caller }) func updateModel(id : Nat, r : R.Model) : async Result {
Query<R.Model, M.Model>(caller, db.model, "root.admin.save").
update(id, r, V.Model({db = db}));
};
// Palette
public shared query({ caller }) func loadManyPalette(ids : [Nat]) : async (Result, [E.Palette]) {
Query<R.Palette, M.Palette>(caller, db.palette, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangePalette(start : Nat, count : Nat) : async (Result, [E.Palette]) {
Query<R.Palette, M.Palette>(caller, db.palette, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createPalette(r : R.Palette) : async (Result, ?Nat) {
Query<R.Palette, M.Palette>(caller, db.palette, "root.admin.save").
create(r, V.Palette({db = db}));
};
public shared({ caller }) func updatePalette(id : Nat, r : R.Palette) : async Result {
Query<R.Palette, M.Palette>(caller, db.palette, "root.admin.save").
update(id, r, V.Palette({db = db}));
};
// Pet
public shared query({ caller }) func loadManyPet(ids : [Nat]) : async (Result, [E.Pet]) {
Query<R.Pet, M.Pet>(caller, db.pet, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangePet(start : Nat, count : Nat) : async (Result, [E.Pet]) {
Query<R.Pet, M.Pet>(caller, db.pet, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createPet(r : R.Pet) : async (Result, ?Nat) {
Query<R.Pet, M.Pet>(caller, db.pet, "root.admin.save").
create(r, V.Pet({db = db}));
};
public shared({ caller }) func updatePet(id : Nat, r : R.Pet) : async Result {
Query<R.Pet, M.Pet>(caller, db.pet, "root.admin.save").
update(id, r, V.Pet({db = db}));
};
// PetStage
public shared query({ caller }) func loadManyPetStage(ids : [Nat]) : async (Result, [E.PetStage]) {
Query<R.PetStage, M.PetStage>(caller, db.petStage, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangePetStage(start : Nat, count : Nat) : async (Result, [E.PetStage]) {
Query<R.PetStage, M.PetStage>(caller, db.petStage, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createPetStage(r : R.PetStage) : async (Result, ?Nat) {
Query<R.PetStage, M.PetStage>(caller, db.petStage, "root.admin.save").
create(r, V.PetStage({db = db}));
};
public shared({ caller }) func updatePetStage(id : Nat, r : R.PetStage) : async Result {
Query<R.PetStage, M.PetStage>(caller, db.petStage, "root.admin.save").
update(id, r, V.PetStage({db = db}));
};
// PetTemplate
public shared query({ caller }) func loadManyPetTemplate(ids : [Nat]) : async (Result, [E.PetTemplate]) {
Query<R.PetTemplate, M.PetTemplate>(caller, db.petTemplate, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangePetTemplate(start : Nat, count : Nat) : async (Result, [E.PetTemplate]) {
Query<R.PetTemplate, M.PetTemplate>(caller, db.petTemplate, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createPetTemplate(r : R.PetTemplate) : async (Result, ?Nat) {
Query<R.PetTemplate, M.PetTemplate>(caller, db.petTemplate, "root.admin.save").
create(r, V.PetTemplate({db = db}));
};
public shared({ caller }) func updatePetTemplate(id : Nat, r : R.PetTemplate) : async Result {
Query<R.PetTemplate, M.PetTemplate>(caller, db.petTemplate, "root.admin.save").
update(id, r, V.PetTemplate({db = db}));
};
// PlantSize
public shared query({ caller }) func loadManyPlantSize(ids : [Nat]) : async (Result, [E.PlantSize]) {
Query<R.PlantSize, M.PlantSize>(caller, db.plantSize, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangePlantSize(start : Nat, count : Nat) : async (Result, [E.PlantSize]) {
Query<R.PlantSize, M.PlantSize>(caller, db.plantSize, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createPlantSize(r : R.PlantSize) : async (Result, ?Nat) {
Query<R.PlantSize, M.PlantSize>(caller, db.plantSize, "root").
create(r, V.PlantSize({db = db}));
};
public shared({ caller }) func updatePlantSize(id : Nat, r : R.PlantSize) : async Result {
Query<R.PlantSize, M.PlantSize>(caller, db.plantSize, "root").
update(id, r, V.PlantSize({db = db}));
};
// Player
public shared query({ caller }) func loadManyPlayer(ids : [Nat]) : async (Result, [E.Player]) {
Query<R.Player, M.Player>(caller, db.player, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangePlayer(start : Nat, count : Nat) : async (Result, [E.Player]) {
Query<R.Player, M.Player>(caller, db.player, "root.admin.load").
loadRange(start, count);
};
public shared query({ caller }) func loadManyPlayerByPrincipal(vars : [Principal]) : async (Result, [E.Player]) {
Query<R.Player, M.Player>(caller, db.player, "root.admin.load").
loadManyByIndex<Principal>(vars, db.player.loadManyByPrincipal);
};
public shared({ caller }) func createPlayer(r : R.Player) : async (Result, ?Nat) {
Query<R.Player, M.Player>(caller, db.player, "root.admin.save").
create(r, V.Player({db = db}));
};
public shared({ caller }) func updatePlayer(id : Nat, r : R.Player) : async Result {
Query<R.Player, M.Player>(caller, db.player, "root.admin.save").
update(id, r, V.Player({db = db}));
};
// Population
public shared query({ caller }) func loadManyPopulation(ids : [Nat]) : async (Result, [E.Population]) {
Query<R.Population, M.Population>(caller, db.population, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangePopulation(start : Nat, count : Nat) : async (Result, [E.Population]) {
Query<R.Population, M.Population>(caller, db.population, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createPopulation(r : R.Population) : async (Result, ?Nat) {
Query<R.Population, M.Population>(caller, db.population, "root.admin.save").
create(r, V.Population({db = db}));
};
public shared({ caller }) func updatePopulation(id : Nat, r : R.Population) : async Result {
Query<R.Population, M.Population>(caller, db.population, "root.admin.save").
update(id, r, V.Population({db = db}));
};
// Prop
public shared query({ caller }) func loadManyProp(ids : [Nat]) : async (Result, [E.Prop]) {
Query<R.Prop, M.Prop>(caller, db.prop, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeProp(start : Nat, count : Nat) : async (Result, [E.Prop]) {
Query<R.Prop, M.Prop>(caller, db.prop, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createProp(r : R.Prop) : async (Result, ?Nat) {
Query<R.Prop, M.Prop>(caller, db.prop, "root.admin.save").
create(r, V.Prop({db = db}));
};
public shared({ caller }) func updateProp(id : Nat, r : R.Prop) : async Result {
Query<R.Prop, M.Prop>(caller, db.prop, "root.admin.save").
update(id, r, V.Prop({db = db}));
};
// PropSet
public shared query({ caller }) func loadManyPropSet(ids : [Nat]) : async (Result, [E.PropSet]) {
Query<R.PropSet, M.PropSet>(caller, db.propSet, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangePropSet(start : Nat, count : Nat) : async (Result, [E.PropSet]) {
Query<R.PropSet, M.PropSet>(caller, db.propSet, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createPropSet(r : R.PropSet) : async (Result, ?Nat) {
Query<R.PropSet, M.PropSet>(caller, db.propSet, "root.admin.save").
create(r, V.PropSet({db = db}));
};
public shared({ caller }) func updatePropSet(id : Nat, r : R.PropSet) : async Result {
Query<R.PropSet, M.PropSet>(caller, db.propSet, "root.admin.save").
update(id, r, V.PropSet({db = db}));
};
// Quality
public shared query({ caller }) func loadManyQuality(ids : [Nat]) : async (Result, [E.Quality]) {
Query<R.Quality, M.Quality>(caller, db.quality, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeQuality(start : Nat, count : Nat) : async (Result, [E.Quality]) {
Query<R.Quality, M.Quality>(caller, db.quality, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createQuality(r : R.Quality) : async (Result, ?Nat) {
Query<R.Quality, M.Quality>(caller, db.quality, "root").
create(r, V.Quality({db = db}));
};
public shared({ caller }) func updateQuality(id : Nat, r : R.Quality) : async Result {
Query<R.Quality, M.Quality>(caller, db.quality, "root").
update(id, r, V.Quality({db = db}));
};
// Quest
public shared query({ caller }) func loadManyQuest(ids : [Nat]) : async (Result, [E.Quest]) {
Query<R.Quest, M.Quest>(caller, db.quest, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeQuest(start : Nat, count : Nat) : async (Result, [E.Quest]) {
Query<R.Quest, M.Quest>(caller, db.quest, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createQuest(r : R.Quest) : async (Result, ?Nat) {
Query<R.Quest, M.Quest>(caller, db.quest, "root.admin.save").
create(r, V.Quest({db = db}));
};
public shared({ caller }) func updateQuest(id : Nat, r : R.Quest) : async Result {
Query<R.Quest, M.Quest>(caller, db.quest, "root.admin.save").
update(id, r, V.Quest({db = db}));
};
// Rarity
public shared query({ caller }) func loadManyRarity(ids : [Nat]) : async (Result, [E.Rarity]) {
Query<R.Rarity, M.Rarity>(caller, db.rarity, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeRarity(start : Nat, count : Nat) : async (Result, [E.Rarity]) {
Query<R.Rarity, M.Rarity>(caller, db.rarity, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createRarity(r : R.Rarity) : async (Result, ?Nat) {
Query<R.Rarity, M.Rarity>(caller, db.rarity, "root").
create(r, V.Rarity({db = db}));
};
public shared({ caller }) func updateRarity(id : Nat, r : R.Rarity) : async Result {
Query<R.Rarity, M.Rarity>(caller, db.rarity, "root").
update(id, r, V.Rarity({db = db}));
};
// Resonance
public shared query({ caller }) func loadManyResonance(ids : [Nat]) : async (Result, [E.Resonance]) {
Query<R.Resonance, M.Resonance>(caller, db.resonance, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeResonance(start : Nat, count : Nat) : async (Result, [E.Resonance]) {
Query<R.Resonance, M.Resonance>(caller, db.resonance, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createResonance(r : R.Resonance) : async (Result, ?Nat) {
Query<R.Resonance, M.Resonance>(caller, db.resonance, "root").
create(r, V.Resonance({db = db}));
};
public shared({ caller }) func updateResonance(id : Nat, r : R.Resonance) : async Result {
Query<R.Resonance, M.Resonance>(caller, db.resonance, "root").
update(id, r, V.Resonance({db = db}));
};
// Rig
public shared query({ caller }) func loadManyRig(ids : [Nat]) : async (Result, [E.Rig]) {
Query<R.Rig, M.Rig>(caller, db.rig, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeRig(start : Nat, count : Nat) : async (Result, [E.Rig]) {
Query<R.Rig, M.Rig>(caller, db.rig, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createRig(r : R.Rig) : async (Result, ?Nat) {
Query<R.Rig, M.Rig>(caller, db.rig, "root.admin.save").
create(r, V.Rig({db = db}));
};
public shared({ caller }) func updateRig(id : Nat, r : R.Rig) : async Result {
Query<R.Rig, M.Rig>(caller, db.rig, "root.admin.save").
update(id, r, V.Rig({db = db}));
};
// Role
public shared query({ caller }) func loadManyRole(ids : [Nat]) : async (Result, [E.Role]) {
Query<R.Role, M.Role>(caller, db.role, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeRole(start : Nat, count : Nat) : async (Result, [E.Role]) {
Query<R.Role, M.Role>(caller, db.role, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createRole(r : R.Role) : async (Result, ?Nat) {
Query<R.Role, M.Role>(caller, db.role, "root.admin.save").
create(r, V.Role({db = db}));
};
public shared({ caller }) func updateRole(id : Nat, r : R.Role) : async Result {
Query<R.Role, M.Role>(caller, db.role, "root.admin.save").
update(id, r, V.Role({db = db}));
};
// RoleCategory
public shared query({ caller }) func loadManyRoleCategory(ids : [Nat]) : async (Result, [E.RoleCategory]) {
Query<R.RoleCategory, M.RoleCategory>(caller, db.roleCategory, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeRoleCategory(start : Nat, count : Nat) : async (Result, [E.RoleCategory]) {
Query<R.RoleCategory, M.RoleCategory>(caller, db.roleCategory, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createRoleCategory(r : R.RoleCategory) : async (Result, ?Nat) {
Query<R.RoleCategory, M.RoleCategory>(caller, db.roleCategory, "root.admin.save").
create(r, V.RoleCategory({db = db}));
};
public shared({ caller }) func updateRoleCategory(id : Nat, r : R.RoleCategory) : async Result {
Query<R.RoleCategory, M.RoleCategory>(caller, db.roleCategory, "root.admin.save").
update(id, r, V.RoleCategory({db = db}));
};
// Sap
public shared query({ caller }) func loadManySap(ids : [Nat]) : async (Result, [E.Sap]) {
Query<R.Sap, M.Sap>(caller, db.sap, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeSap(start : Nat, count : Nat) : async (Result, [E.Sap]) {
Query<R.Sap, M.Sap>(caller, db.sap, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createSap(r : R.Sap) : async (Result, ?Nat) {
Query<R.Sap, M.Sap>(caller, db.sap, "root").
create(r, V.Sap({db = db}));
};
public shared({ caller }) func updateSap(id : Nat, r : R.Sap) : async Result {
Query<R.Sap, M.Sap>(caller, db.sap, "root").
update(id, r, V.Sap({db = db}));
};
// Shop
public shared query({ caller }) func loadManyShop(ids : [Nat]) : async (Result, [E.Shop]) {
Query<R.Shop, M.Shop>(caller, db.shop, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeShop(start : Nat, count : Nat) : async (Result, [E.Shop]) {
Query<R.Shop, M.Shop>(caller, db.shop, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createShop(r : R.Shop) : async (Result, ?Nat) {
Query<R.Shop, M.Shop>(caller, db.shop, "root.admin.save").
create(r, V.Shop({db = db}));
};
public shared({ caller }) func updateShop(id : Nat, r : R.Shop) : async Result {
Query<R.Shop, M.Shop>(caller, db.shop, "root.admin.save").
update(id, r, V.Shop({db = db}));
};
// Size
public shared query({ caller }) func loadManySize(ids : [Nat]) : async (Result, [E.Size]) {
Query<R.Size, M.Size>(caller, db.size, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeSize(start : Nat, count : Nat) : async (Result, [E.Size]) {
Query<R.Size, M.Size>(caller, db.size, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createSize(r : R.Size) : async (Result, ?Nat) {
Query<R.Size, M.Size>(caller, db.size, "root").
create(r, V.Size({db = db}));
};
public shared({ caller }) func updateSize(id : Nat, r : R.Size) : async Result {
Query<R.Size, M.Size>(caller, db.size, "root").
update(id, r, V.Size({db = db}));
};
// Skill
public shared query({ caller }) func loadManySkill(ids : [Nat]) : async (Result, [E.Skill]) {
Query<R.Skill, M.Skill>(caller, db.skill, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeSkill(start : Nat, count : Nat) : async (Result, [E.Skill]) {
Query<R.Skill, M.Skill>(caller, db.skill, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createSkill(r : R.Skill) : async (Result, ?Nat) {
Query<R.Skill, M.Skill>(caller, db.skill, "root").
create(r, V.Skill({db = db}));
};
public shared({ caller }) func updateSkill(id : Nat, r : R.Skill) : async Result {
Query<R.Skill, M.Skill>(caller, db.skill, "root").
update(id, r, V.Skill({db = db}));
};
// Sound
public shared query({ caller }) func loadManySound(ids : [Nat]) : async (Result, [E.Sound]) {
Query<R.Sound, M.Sound>(caller, db.sound, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeSound(start : Nat, count : Nat) : async (Result, [E.Sound]) {
Query<R.Sound, M.Sound>(caller, db.sound, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createSound(r : R.Sound) : async (Result, ?Nat) {
Query<R.Sound, M.Sound>(caller, db.sound, "root.admin.save").
create(r, V.Sound({db = db}));
};
public shared({ caller }) func updateSound(id : Nat, r : R.Sound) : async Result {
Query<R.Sound, M.Sound>(caller, db.sound, "root.admin.save").
update(id, r, V.Sound({db = db}));
};
// Species
public shared query({ caller }) func loadManySpecies(ids : [Nat]) : async (Result, [E.Species]) {
Query<R.Species, M.Species>(caller, db.species, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeSpecies(start : Nat, count : Nat) : async (Result, [E.Species]) {
Query<R.Species, M.Species>(caller, db.species, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createSpecies(r : R.Species) : async (Result, ?Nat) {
Query<R.Species, M.Species>(caller, db.species, "root.admin.save").
create(r, V.Species({db = db}));
};
public shared({ caller }) func updateSpecies(id : Nat, r : R.Species) : async Result {
Query<R.Species, M.Species>(caller, db.species, "root.admin.save").
update(id, r, V.Species({db = db}));
};
// Spell
public shared query({ caller }) func loadManySpell(ids : [Nat]) : async (Result, [E.Spell]) {
Query<R.Spell, M.Spell>(caller, db.spell, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeSpell(start : Nat, count : Nat) : async (Result, [E.Spell]) {
Query<R.Spell, M.Spell>(caller, db.spell, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createSpell(r : R.Spell) : async (Result, ?Nat) {
Query<R.Spell, M.Spell>(caller, db.spell, "root.admin.save").
create(r, V.Spell({db = db}));
};
public shared({ caller }) func updateSpell(id : Nat, r : R.Spell) : async Result {
Query<R.Spell, M.Spell>(caller, db.spell, "root.admin.save").
update(id, r, V.Spell({db = db}));
};
// SpellCategory
public shared query({ caller }) func loadManySpellCategory(ids : [Nat]) : async (Result, [E.SpellCategory]) {
Query<R.SpellCategory, M.SpellCategory>(caller, db.spellCategory, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeSpellCategory(start : Nat, count : Nat) : async (Result, [E.SpellCategory]) {
Query<R.SpellCategory, M.SpellCategory>(caller, db.spellCategory, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createSpellCategory(r : R.SpellCategory) : async (Result, ?Nat) {
Query<R.SpellCategory, M.SpellCategory>(caller, db.spellCategory, "root.admin.save").
create(r, V.SpellCategory({db = db}));
};
public shared({ caller }) func updateSpellCategory(id : Nat, r : R.SpellCategory) : async Result {
Query<R.SpellCategory, M.SpellCategory>(caller, db.spellCategory, "root.admin.save").
update(id, r, V.SpellCategory({db = db}));
};
// SpellSet
public shared query({ caller }) func loadManySpellSet(ids : [Nat]) : async (Result, [E.SpellSet]) {
Query<R.SpellSet, M.SpellSet>(caller, db.spellSet, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeSpellSet(start : Nat, count : Nat) : async (Result, [E.SpellSet]) {
Query<R.SpellSet, M.SpellSet>(caller, db.spellSet, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createSpellSet(r : R.SpellSet) : async (Result, ?Nat) {
Query<R.SpellSet, M.SpellSet>(caller, db.spellSet, "root.admin.save").
create(r, V.SpellSet({db = db}));
};
public shared({ caller }) func updateSpellSet(id : Nat, r : R.SpellSet) : async Result {
Query<R.SpellSet, M.SpellSet>(caller, db.spellSet, "root.admin.save").
update(id, r, V.SpellSet({db = db}));
};
// Stat
public shared query({ caller }) func loadManyStat(ids : [Nat]) : async (Result, [E.Stat]) {
Query<R.Stat, M.Stat>(caller, db.stat, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeStat(start : Nat, count : Nat) : async (Result, [E.Stat]) {
Query<R.Stat, M.Stat>(caller, db.stat, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createStat(r : R.Stat) : async (Result, ?Nat) {
Query<R.Stat, M.Stat>(caller, db.stat, "root").
create(r, V.Stat({db = db}));
};
public shared({ caller }) func updateStat(id : Nat, r : R.Stat) : async Result {
Query<R.Stat, M.Stat>(caller, db.stat, "root").
update(id, r, V.Stat({db = db}));
};
// Team
public shared query({ caller }) func loadManyTeam(ids : [Nat]) : async (Result, [E.Team]) {
Query<R.Team, M.Team>(caller, db.team, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeTeam(start : Nat, count : Nat) : async (Result, [E.Team]) {
Query<R.Team, M.Team>(caller, db.team, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createTeam(r : R.Team) : async (Result, ?Nat) {
Query<R.Team, M.Team>(caller, db.team, "root.admin.save").
create(r, V.Team({db = db}));
};
public shared({ caller }) func updateTeam(id : Nat, r : R.Team) : async Result {
Query<R.Team, M.Team>(caller, db.team, "root.admin.save").
update(id, r, V.Team({db = db}));
};
// Temperature
public shared query({ caller }) func loadManyTemperature(ids : [Nat]) : async (Result, [E.Temperature]) {
Query<R.Temperature, M.Temperature>(caller, db.temperature, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeTemperature(start : Nat, count : Nat) : async (Result, [E.Temperature]) {
Query<R.Temperature, M.Temperature>(caller, db.temperature, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createTemperature(r : R.Temperature) : async (Result, ?Nat) {
Query<R.Temperature, M.Temperature>(caller, db.temperature, "root").
create(r, V.Temperature({db = db}));
};
public shared({ caller }) func updateTemperature(id : Nat, r : R.Temperature) : async Result {
Query<R.Temperature, M.Temperature>(caller, db.temperature, "root").
update(id, r, V.Temperature({db = db}));
};
// Terrain
public shared query({ caller }) func loadManyTerrain(ids : [Nat]) : async (Result, [E.Terrain]) {
Query<R.Terrain, M.Terrain>(caller, db.terrain, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeTerrain(start : Nat, count : Nat) : async (Result, [E.Terrain]) {
Query<R.Terrain, M.Terrain>(caller, db.terrain, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createTerrain(r : R.Terrain) : async (Result, ?Nat) {
Query<R.Terrain, M.Terrain>(caller, db.terrain, "root.admin.save").
create(r, V.Terrain({db = db}));
};
public shared({ caller }) func updateTerrain(id : Nat, r : R.Terrain) : async Result {
Query<R.Terrain, M.Terrain>(caller, db.terrain, "root.admin.save").
update(id, r, V.Terrain({db = db}));
};
// TerrainSet
public shared query({ caller }) func loadManyTerrainSet(ids : [Nat]) : async (Result, [E.TerrainSet]) {
Query<R.TerrainSet, M.TerrainSet>(caller, db.terrainSet, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeTerrainSet(start : Nat, count : Nat) : async (Result, [E.TerrainSet]) {
Query<R.TerrainSet, M.TerrainSet>(caller, db.terrainSet, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createTerrainSet(r : R.TerrainSet) : async (Result, ?Nat) {
Query<R.TerrainSet, M.TerrainSet>(caller, db.terrainSet, "root.admin.save").
create(r, V.TerrainSet({db = db}));
};
public shared({ caller }) func updateTerrainSet(id : Nat, r : R.TerrainSet) : async Result {
Query<R.TerrainSet, M.TerrainSet>(caller, db.terrainSet, "root.admin.save").
update(id, r, V.TerrainSet({db = db}));
};
// Texture
public shared query({ caller }) func loadManyTexture(ids : [Nat]) : async (Result, [E.Texture]) {
Query<R.Texture, M.Texture>(caller, db.texture, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeTexture(start : Nat, count : Nat) : async (Result, [E.Texture]) {
Query<R.Texture, M.Texture>(caller, db.texture, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createTexture(r : R.Texture) : async (Result, ?Nat) {
Query<R.Texture, M.Texture>(caller, db.texture, "root.admin.save").
create(r, V.Texture({db = db}));
};
public shared({ caller }) func updateTexture(id : Nat, r : R.Texture) : async Result {
Query<R.Texture, M.Texture>(caller, db.texture, "root.admin.save").
update(id, r, V.Texture({db = db}));
};
// TextureMaterial
public shared query({ caller }) func loadManyTextureMaterial(ids : [Nat]) : async (Result, [E.TextureMaterial]) {
Query<R.TextureMaterial, M.TextureMaterial>(caller, db.textureMaterial, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeTextureMaterial(start : Nat, count : Nat) : async (Result, [E.TextureMaterial]) {
Query<R.TextureMaterial, M.TextureMaterial>(caller, db.textureMaterial, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createTextureMaterial(r : R.TextureMaterial) : async (Result, ?Nat) {
Query<R.TextureMaterial, M.TextureMaterial>(caller, db.textureMaterial, "root.admin.save").
create(r, V.TextureMaterial({db = db}));
};
public shared({ caller }) func updateTextureMaterial(id : Nat, r : R.TextureMaterial) : async Result {
Query<R.TextureMaterial, M.TextureMaterial>(caller, db.textureMaterial, "root.admin.save").
update(id, r, V.TextureMaterial({db = db}));
};
// Theme
public shared query({ caller }) func loadManyTheme(ids : [Nat]) : async (Result, [E.Theme]) {
Query<R.Theme, M.Theme>(caller, db.theme, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeTheme(start : Nat, count : Nat) : async (Result, [E.Theme]) {
Query<R.Theme, M.Theme>(caller, db.theme, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createTheme(r : R.Theme) : async (Result, ?Nat) {
Query<R.Theme, M.Theme>(caller, db.theme, "root.admin.save").
create(r, V.Theme({db = db}));
};
public shared({ caller }) func updateTheme(id : Nat, r : R.Theme) : async Result {
Query<R.Theme, M.Theme>(caller, db.theme, "root.admin.save").
update(id, r, V.Theme({db = db}));
};
// Token
public shared query({ caller }) func loadManyToken(ids : [Nat]) : async (Result, [E.Token]) {
Query<R.Token, M.Token>(caller, db.token, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeToken(start : Nat, count : Nat) : async (Result, [E.Token]) {
Query<R.Token, M.Token>(caller, db.token, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createToken(r : R.Token) : async (Result, ?Nat) {
Query<R.Token, M.Token>(caller, db.token, "root.admin.save").
create(r, V.Token({db = db}));
};
public shared({ caller }) func updateToken(id : Nat, r : R.Token) : async Result {
Query<R.Token, M.Token>(caller, db.token, "root.admin.save").
update(id, r, V.Token({db = db}));
};
// Unit
public shared query({ caller }) func loadManyUnit(ids : [Nat]) : async (Result, [E.Unit]) {
Query<R.Unit, M.Unit>(caller, db.unit, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeUnit(start : Nat, count : Nat) : async (Result, [E.Unit]) {
Query<R.Unit, M.Unit>(caller, db.unit, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createUnit(r : R.Unit) : async (Result, ?Nat) {
Query<R.Unit, M.Unit>(caller, db.unit, "root").
create(r, V.Unit({db = db}));
};
public shared({ caller }) func updateUnit(id : Nat, r : R.Unit) : async Result {
Query<R.Unit, M.Unit>(caller, db.unit, "root").
update(id, r, V.Unit({db = db}));
};
// Velocity
public shared query({ caller }) func loadManyVelocity(ids : [Nat]) : async (Result, [E.Velocity]) {
Query<R.Velocity, M.Velocity>(caller, db.velocity, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeVelocity(start : Nat, count : Nat) : async (Result, [E.Velocity]) {
Query<R.Velocity, M.Velocity>(caller, db.velocity, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createVelocity(r : R.Velocity) : async (Result, ?Nat) {
Query<R.Velocity, M.Velocity>(caller, db.velocity, "root").
create(r, V.Velocity({db = db}));
};
public shared({ caller }) func updateVelocity(id : Nat, r : R.Velocity) : async Result {
Query<R.Velocity, M.Velocity>(caller, db.velocity, "root").
update(id, r, V.Velocity({db = db}));
};
// Volume
public shared query({ caller }) func loadManyVolume(ids : [Nat]) : async (Result, [E.Volume]) {
Query<R.Volume, M.Volume>(caller, db.volume, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeVolume(start : Nat, count : Nat) : async (Result, [E.Volume]) {
Query<R.Volume, M.Volume>(caller, db.volume, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createVolume(r : R.Volume) : async (Result, ?Nat) {
Query<R.Volume, M.Volume>(caller, db.volume, "root").
create(r, V.Volume({db = db}));
};
public shared({ caller }) func updateVolume(id : Nat, r : R.Volume) : async Result {
Query<R.Volume, M.Volume>(caller, db.volume, "root").
update(id, r, V.Volume({db = db}));
};
// Weather
public shared query({ caller }) func loadManyWeather(ids : [Nat]) : async (Result, [E.Weather]) {
Query<R.Weather, M.Weather>(caller, db.weather, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeWeather(start : Nat, count : Nat) : async (Result, [E.Weather]) {
Query<R.Weather, M.Weather>(caller, db.weather, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createWeather(r : R.Weather) : async (Result, ?Nat) {
Query<R.Weather, M.Weather>(caller, db.weather, "root.admin.save").
create(r, V.Weather({db = db}));
};
public shared({ caller }) func updateWeather(id : Nat, r : R.Weather) : async Result {
Query<R.Weather, M.Weather>(caller, db.weather, "root.admin.save").
update(id, r, V.Weather({db = db}));
};
// Zone
public shared query({ caller }) func loadManyZone(ids : [Nat]) : async (Result, [E.Zone]) {
Query<R.Zone, M.Zone>(caller, db.zone, "root.admin.load").
loadMany(ids);
};
public shared query({ caller }) func loadRangeZone(start : Nat, count : Nat) : async (Result, [E.Zone]) {
Query<R.Zone, M.Zone>(caller, db.zone, "root.admin.load").
loadRange(start, count);
};
public shared({ caller }) func createZone(r : R.Zone) : async (Result, ?Nat) {
Query<R.Zone, M.Zone>(caller, db.zone, "root.admin.save").
create(r, V.Zone({db = db}));
};
public shared({ caller }) func updateZone(id : Nat, r : R.Zone) : async Result {
Query<R.Zone, M.Zone>(caller, db.zone, "root.admin.save").
update(id, r, V.Zone({db = db}));
};
// ENDPASTE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment