diff --git a/server/services/astro/around-list.get.js b/server/services/astro/around-list.get.js
new file mode 100644
index 0000000..fce861b
--- /dev/null
+++ b/server/services/astro/around-list.get.js
@@ -0,0 +1,72 @@
+// DEBUG... COMENTAR DEPOIS
+_log.info('service called...');
+
+//const astroType = _req.getString("astroType");
+//_log.info(astroType)
+const aroundAstroUid = _req.getString("aroundAstroUid");
+_log.info("AroundAstroUid: ", aroundAstroUid);
+
+/*
+const page = _req.getInt("page", 1);
+let offset = (page - 1) * 8;
+if (offset < 0) {
+ offset = 0;
+}
+
+let filterWhere = "";
+const filterParams = _val.list()
+if (astroType != "" && astroType != "all") {
+ filterWhere = " AND astro_type.uid = CAST(? AS UUID) ";
+ filterParams.add(astroType);
+}
+*/
+/*
+if (aroundAstroUid && aroundAstroUid != "") {
+ filterWhere = " AND around.uid = CAST(? AS UUID) ";
+ filterParams.add(aroundAstroUid);
+}
+_log.info("Filter params:", filterParams);
+
+const dbAstros = _db.query(`
+ SELECT
+ astro.uid,
+ --astro.id,
+ astro.name
+ ,astro_type.name AS "astro_type"
+ --,astro_type.id AS "astro_type_code"
+ --astro.equatorial_radius,
+ --astro.rotation_velocity,
+ --,astro.around_astro_id
+ --,around.uid as "around_astro_uid"
+ --astro.periapsis,
+ --astro.apoapsis,
+ --astro.image
+ FROM astro
+ INNER JOIN astro_type
+ ON astro.type_id = astro_type.id
+ LEFT JOIN ( SELECT id,uid FROM astro ) AS around
+ ON astro.around_astro_id = around.id
+ WHERE
+ astro.active = TRUE
+ AND astro_type.active = TRUE
+ ${filterWhere}
+ --LIMIT 8
+ --OFFSET ${offset}
+`, filterParams);
+
+const astros = _val.list()
+for (const dbAstro of dbAstros) {
+ astros.add(
+ _val.map()
+ .set('id', dbAstro.getString('uid'))
+ .set('name', dbAstro.getString('name'))
+ )
+}
+
+// DEBUG...COMENTAR DEPOIS!
+//_log.info( 'Server return...', astros );
+
+_out.json(astros)
+*/
+// DEBUG...COMENTAR DEPOIS!
+_log.info('service ended!');
\ No newline at end of file
diff --git a/server/services/astro/get.js b/server/services/astro/get.js
new file mode 100644
index 0000000..1f27ca1
--- /dev/null
+++ b/server/services/astro/get.js
@@ -0,0 +1,68 @@
+// DEBUG... COMENTAR DEPOIS
+//_log.info("service called...");
+
+const astroUid = _req.getString("uid");
+
+if (astroUid && astroUid != "") {
+ const dbAstro = _db.queryFirst(`
+ SELECT
+ astro.uid,
+ --astro.id,
+ astro.name,
+ astro_type.name AS "astro_type",
+ astro_type.id AS "astro_type_code",
+ astro.equatorial_radius,
+ astro.rotation_velocity,
+ --astro.around_astro_id,
+ around.uid as "around_astro_uid",
+ around.name as "around_astro_name",
+ astro.periapsis,
+ astro.apoapsis
+ --,astro.image
+ FROM astro
+ INNER JOIN astro_type
+ ON astro.type_id = astro_type.id
+ LEFT JOIN ( SELECT id,uid,name FROM astro ) AS around
+ ON astro.around_astro_id = around.id
+ WHERE
+ astro.active = TRUE
+ AND astro_type.active = TRUE
+ AND astro.uid = CAST(? AS UUID)
+ `, astroUid);
+
+ if (dbAstro == null) {
+ _header.status(404);
+ _exec.stop();
+ }
+ const astro =
+ _val.map()
+ .set("uid", dbAstro.getString("uid"))
+ .set("name", dbAstro.getString("name"))
+ .set(
+ "type",
+ _val.map()
+ .set("name", dbAstro.getString("astro_type") )
+ .set("code", dbAstro.getString("astro_type_code")))
+ .set("equatorialRadius", dbAstro.getDouble("equatorial_radius"))
+ .set("rotationVelocity", dbAstro.getDouble("rotation_velocity"))
+ .set(
+ "aroundAstro",
+ _val.map()
+ .set("uid", dbAstro.getString("around_astro_uid"))
+ .set("name", dbAstro.getString("around_astro_name")))
+ .set("periapsis", dbAstro.getDouble("periapsis"))
+ .set("apoapsis", dbAstro.getDouble("apoapsis"))
+ ;
+
+ // DEBUG...COMENTAR DEPOIS!
+ //_log.info('Server return...', astro);
+
+ _out.json(astro);
+
+ // DEBUG...COMENTAR DEPOIS!
+ //_log.info('service ended!');
+}
+else {
+ _header.status(400);
+ _exec.stop();
+}
\ No newline at end of file
diff --git a/server/services/astro/image.get.js b/server/services/astro/image.get.js
index 886d18a..46c24af 100644
--- a/server/services/astro/image.get.js
+++ b/server/services/astro/image.get.js
@@ -2,11 +2,12 @@ const dbAstro = _db.get('astro', _req.getString('uid'))
if (dbAstro) {
const dbAstroImageName = dbAstro.getString('image')
- _log.info( dbAstroImageName );
- const storageAstroImageFile = _storage.database(
- 'astro',
- 'image',
- dbAstroImageName
+ //_log.info( dbAstroImageName );
+ const storageAstroImageFile =
+ _storage.database(
+ 'astro',
+ 'image',
+ dbAstroImageName
)
switch (storageAstroImageFile.extension()){
case 'jpg':
diff --git a/server/services/astro/list.get.js b/server/services/astro/list.get.js
index 5222459..cff5c4d 100644
--- a/server/services/astro/list.get.js
+++ b/server/services/astro/list.get.js
@@ -1,23 +1,24 @@
// DEBUG... COMENTAR DEPOIS
//_log.info('service called...');
-const astroType = _req.getString(`astroType`)
+const astroType = _req.getString("astroType");
+// DEBUG... COMENTAR DEPOIS
//_log.info(astroType)
-const page = _req.getInt('page', 1)
-let offset = (page - 1) * 8
+const page = _req.getInt("page", 1);
+let offset = (page - 1) * 8;
if (offset < 0) {
- offset = 0
+ offset = 0;
}
-
-let filterWhere = ""
+let filterWhere = "";
const filterParams = _val.list()
if (astroType != "" && astroType != "all") {
filterWhere = " AND astro_type.uid = CAST(? AS UUID) ";
filterParams.add(astroType);
- //_log.info("Params", filterParams)
}
+// DEBUG... COMENTAR DEPOIS
+//_log.info("Filter params:", filterParams);
const dbAstros = _db.query(`
SELECT
@@ -28,7 +29,7 @@ const dbAstros = _db.query(`
--astro_type.id AS "astro_type_code",
--astro.equatorial_radius,
--astro.rotation_velocity,
- --astro.around_astro_id,
+ --,astro.around_astro_id
--astro.periapsis,
--astro.apoapsis,
--astro.image
@@ -43,8 +44,6 @@ const dbAstros = _db.query(`
OFFSET ${offset}
`, filterParams);
-
-
const astros = _val.list()
for (const dbAstro of dbAstros) {
astros.add(
diff --git a/website/src/components/functionality/AstroList/Filter/index.jsx b/website/src/components/functionality/AstroList/Filter/index.jsx
index d8d8dbf..badd1e8 100644
--- a/website/src/components/functionality/AstroList/Filter/index.jsx
+++ b/website/src/components/functionality/AstroList/Filter/index.jsx
@@ -57,4 +57,4 @@ function Filter({onAstroTypeChange}) {
);
}
-export default Filter;
+export default Filter;
\ No newline at end of file
diff --git a/website/src/pages/AstroDetails/OtherAstros/index.jsx b/website/src/pages/AstroDetails/OtherAstros/index.jsx
new file mode 100644
index 0000000..3cbb185
--- /dev/null
+++ b/website/src/pages/AstroDetails/OtherAstros/index.jsx
@@ -0,0 +1,50 @@
+import React, { useState, useEffect } from "react";
+import { Spin } from "antd";
+import _service from "@netuno/service-client";
+
+import './index.less';
+
+function OtherAstros({aroundAstroUid}) {
+ const servicePrefix = _service.config().prefix;
+ const [list, setList] = useState([]);
+ const [loading, setLoading] = useState(true);
+
+ /*
+ useEffect( () => {
+ setLoading(true);
+ _service({
+ url: "/astro/list",
+ data: {aroundAstroUid},
+ success: (response) => {
+ setList([response.json]);
+ setLoading(false);
+ },
+ fail: (e) => {
+ console.error("Service Error", e);
+ notification.error({
+ message:"Erro",
+ description:"Não foi possível encontrar o astro."
+ });
+ setLoading(false);
+ },
+ });
+ }, []);
+ */
+ /*
+ if( loading ){
+ return(
Não foi possível carregar os detalhes do astro.
+