def get_body(self): return q.query( q.lambda_( ["input"], q.delete( q.ref(q.collection(self.collection.get_collection_name()), q.select('id', q.var("input"))))))
def get_privileges(self): return [{ "resource": q.collection(self.collection.get_collection_name()), "actions": { 'read': self.get_lambda('read') } }]
def get_body(self): data_dict = { "data": self.get_fields(), } return q.query( q.lambda_(["input"], q.create( q.collection(self.collection.get_collection_name()), data_dict)))
def get_body(self): data_dict = { "data": self.collection.get_fields(), "credentials": { self.collection._credential_field: q.select(self.collection._credential_field, q.var("input")) } } return q.query( q.lambda_( ["input"], q.let( { 'result': q.create( q.collection( self.collection.get_collection_name()), data_dict), 'input': q.var('input') }, # If 'groups' key is an array q.if_( q.is_array(q.select('groups', q.var('input'))), q.foreach( q.lambda_( 'group', q.create( q.collection( self.collection._base_properties.get( 'groups').relation_name), { 'data': { 'userID': q.select('ref', q.var('result')), 'groupID': q.var('group') } })), q.select('groups', q.var('input'))), q.abort('Groups not defined.')))))
def get_privileges(self): return [{ "resource": q.collection(self.collection.get_collection_name()), "actions": { 'read': self.get_lambda('read'), 'write': self.get_lambda('write'), 'create': self.get_lambda('create'), 'delete': self.get_lambda('read'), } }, { "resource": q.index(self.relation_index_name), "actions": { "read": True } }, { "resource": q.index(self.collection.all_index_name()), "actions": { "read": True } }, { "resource": q.function(self.collection.all_function_name()), "actions": { "call": True } }, { "resource": q.function(f'create_{self.collection.get_class_name()}'), "actions": { "call": True } }, { "resource": q.function(f'update_{self.collection.get_class_name()}'), "actions": { "call": True } }, { "resource": q.function(f'delete_{self.collection.get_class_name()}'), "actions": { "call": True } }]