Skip to content
Snippets Groups Projects
Commit cdcedcd2 authored by Joe El hajj's avatar Joe El hajj
Browse files

list

parent c4697e78
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,7 @@ type associationStatus =
type association = {
name: string;
coordinate: coordinate;
status: associationStatus;
description: string;
admin: option<address>;
};
......@@ -74,10 +73,26 @@ const changeAdmin = (associationName: string, stor: storage): return_ => {
return [list([]), updatedStorage];
}
//List associations
/*
//details d'une associations
@view
function getAssociationDetails(associationName: string, storage: storage): option<association> {
return Big_map.find_opt(associationName, storage);
const listDetailsAssociations = (associationName:string, stor: storage): association => {
return match(Big_map.find_opt(associationName, stor)){
when(Some(value)): value;
when(None): failwith("No value.")
};
}
// Function to list details of all associations
@view
const listAllAssociations = (stor: storage): list<association> => {
const associations: list<association> = list([]);
const keys = Big_map.of_list(stor);
for (const name of keys) {
const association = Big_map.find_opt(name, stor);
if (Option.is_some(association)) {
associations.push(Option.unopt(association));
}
*/
}
return associations;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment