Skip to content

Commit

Permalink
Cleaning up example actions and adding common ones (Beebole team) (Pi…
Browse files Browse the repository at this point in the history
…pedreamHQ#11615)

* [master] Clean up example services. Added run-report and list-untimed-employees

* [master] es-linted

* [master] versioning update

* Version bumps post-merge

---------

Co-authored-by: GTFalcao <[email protected]>
  • Loading branch information
miguel-beebole and GTFalcao authored Apr 29, 2024
1 parent 857dd22 commit ba17a2c
Show file tree
Hide file tree
Showing 7 changed files with 426 additions and 98 deletions.
33 changes: 0 additions & 33 deletions components/beebole_app/actions/create-company/create-company.mjs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import app from "../../beebole_app.app.mjs";
export default {
key: "beebole_app-list-companies",
name: "List Companies",
description: "List all companies in the Beebole platform. [See the documentation](https://beebole.com/help/api/#list-companies)",
version: "0.0.2",
description: "List all companies in your Beebole account. [See the documentation](https://beebole.com/help/api/#list-companies)",
version: "0.0.3",
type: "action",
props: {
app,
},
async run({ $ }) {
const response = await this.app.manageCompanies({
const response = await this.app.apiRequest({
$,
data: {
service: "company.list",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import app from "../../beebole_app.app.mjs";

export default {
name: "List untimed employees",
description: "Get a list of employees without any time entry for a given period of time",
key: "beebole_app-list-untimed-employees",
version: "0.0.1",
type: "action",
props: {
app,
begda: {
propDefinition: [
app,
"begda",
],
},
endda: {
propDefinition: [
app,
"endda",
],
},
},
async run({ $ }) {
let response,
people = [];

try {
response = await this.app.apiRequest({
$,
data: {
service: "time.get_people_timesheets",
undoc: true,
from: this.begda.split("-"),
to: this.endda.split("-"),
show: "all",
statusFilters: [
"d",
],
showAll: true,
details: [],
},
});

$.export("$summary", `Successfully generated list for ${response.items[0].people.length} people`);

response.items[0].people.forEach((element) => {
people.push({
name: element.doc.name,
eid: element.eid,
draft: element.hours.sum,
});
});
return people;
} catch (errors) {
return errors;
}
},
};
Loading

0 comments on commit ba17a2c

Please sign in to comment.