| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 | 
							- import { project } from "./project.js";
 
- import { element } from "./element.js";
 
- import { elements_list } from "./elements_list.js";
 
- import { submission } from "./submission.js";
 
- import { submissions_list } from "./submissions_list.js";
 
- import { parser } from "./parser.js";
 
- class database {
 
-     #project;
 
-     #submissions;
 
-     constructor(content) {
 
-         if (!(content instanceof Object)) {
 
-             throw "Content to into database from must be an object.";
 
-         }
 
-         this.#load(content);
 
-     }
 
-     #load(content) {
 
-         const loader = new parser(content, "root");
 
-         const project = loader.get_parser("project");
 
-         const submissions = loader.get_parser("submissions");
 
-         this.#project = this.#parse_project(project);
 
-         this.#submissions = this.#parse_submissions(submissions);
 
-     }
 
-     #parse_project(content) {
 
-         const name = content.get("name");
 
-         let description = "";
 
-         if (content.exists("description")) {
 
-             description = content.get("description");
 
-         }
 
-         return new project(name, description);
 
-     }
 
-     #parse_elements(content) {
 
-         const list = new elements_list();
 
-         content.properties.forEach(name => {
 
-             const loader = content.get_parser(name);
 
-             const result = new element(
 
-                 name
 
-             );
 
-             list.append(result);
 
-         });
 
-         return list;
 
-     }
 
-     #parse_submissions(content) {
 
-         const list = new submissions_list();
 
-         content.properties.forEach(title => {
 
-             const loader = content.get_parser(title);
 
-             const description = loader.get("description");
 
-             const picture = loader.get("picture");
 
-             const elements_parser = loader.get_parser("elements");
 
-             const elements = this.#parse_elements(elements_parser);
 
-             const result = new submission(
 
-                 title,
 
-                 description,
 
-                 picture,
 
-                 elements
 
-             );
 
-             list.append(result);
 
-         });
 
-         return list;
 
-     }
 
-     get project() {
 
-         return this.#project;
 
-     }
 
- }
 
- export { database };
 
 
  |