A server app built using [Shelf](https://pub.dev/packages/shelf),
configured to enable running with [Docker](https://www.docker.com/).
## Links
## Links (Don't works anymore :( )
Here is the [API Link](https://codefirst.iut.uca.fr/containers/passworld-api-remiarnal/)
Cheat sheet that i use for the api status code : [HTTP Status Code Cheat Sheet](https://www.websiterating.com/resources/http-status-codes-cheat-sheet/)
awaitconnection.query("SELECT id, hash, salt from \"Account\"");
awaitconnection.query("SELECT mail, hash, salt from \"Account\"");
print("🟥 ADMIN: get all users");
returnres;
}
staticFuture<void>flushUsers()async{
awaitconnection.query("DELETE FROM \"Account\"");
List<List<dynamic>>rows=
awaitconnection.query("SELECT COUNT(*) FROM \"Account\"");
if(rows[0][0]!=0){
throwPostgreSQLException("Flush of users did not succeed",
severity:PostgreSQLSeverity.unknown);
}
print("🟥 ADMIN: all users deleted");
}
staticFuture<void>flushTable()async{
awaitconnection.query("DROP TABLE \"Account\"");
try{
awaitconnection.query("SELECT * FROM \"Account\"");
throwPostgreSQLException('Table Not dropped',
severity:PostgreSQLSeverity.unknown);
}onPostgreSQLException{
print("🟥 ADMIN: tables droped");
}
}
staticFuture<void>createLogsTable()async{
awaitconnection
.query(
"CREATE TABLE IF NOT EXISTS Log(wwhen TIMESTAMP,wwho char(20),whow char(20),wwhat varchar(800));")
.then((value){
print("⬜ ADMIN: Logs table created");
});
}
staticFuture<void>createLogingFunction()async{
awaitconnection
.query(
"CREATE OR REPLACE FUNCTION log()RETURNS TRIGGER AS \$\$ BEGIN IF(TG_OP='DELETE')THEN INSERT INTO Log VALUES(CURRENT_TIMESTAMP,current_role,TG_OP,OLD.id||' '||OLD.hash||' '||OLD.salt); RETURN OLD; ELSEIF(TG_OP='INSERT')THEN INSERT INTO Log VALUES(CURRENT_TIMESTAMP,current_role,TG_OP,NEW.id||' '||NEW.hash||' '||NEW.salt);RETURN NEW; ELSE INSERT INTO Log VALUES(CURRENT_TIMESTAMP,current_role,TG_OP,OLD.id||' '||OLD.hash||' '||OLD.salt||' => '||NEW.id||' '||NEW.hash||' '||NEW.salt); RETURN NEW; END IF; END; \$\$ LANGUAGE plpgsql;")
.then((value){
print("⬜ ADMIN: Logs function created");
});
}
staticFuture<void>createTriggerLogs()async{
awaitconnection
.query(
"CREATE TRIGGER trace_delete BEFORE DELETE OR INSERT OR UPDATE ON \"Account\" FOR EACH ROW EXECUTE FUNCTION log ();")
.then((value){
print("⬜ ADMIN: Logs trigger created");
});
}
staticFuture<void>dropTrggerLogs()async{
awaitconnection
.query("DROP Trigger trace_delete ON \"Account\"")
.then((value){
print("⬛ ADMIN: Logs trigger dropped");
});
}
staticFuture<void>flushLogs()async{
awaitconnection.query("DELETE FROM Log").then((value){