Skip to content

Commit

Permalink
GH Action Standards
Browse files Browse the repository at this point in the history
  • Loading branch information
confused-Techie authored and github-actions[bot] committed Jan 20, 2024
1 parent 4a320aa commit c99e22c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 35 deletions.
17 changes: 0 additions & 17 deletions docs/reference/Source_Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,6 @@ with and retrieve data from the cloud hosted database instance.
* [~updateDecrementStar(user, pack)](#module_database..updateDecrementStar) ⇒ <code>object</code>
* [~getStarredPointersByUserID(userid)](#module_database..getStarredPointersByUserID) ⇒ <code>object</code>
* [~getStarringUsersByPointer(pointer)](#module_database..getStarringUsersByPointer) ⇒ <code>object</code>
* [~simpleSearch(term, dir, sort, [themes])](#module_database..simpleSearch) ⇒ <code>object</code>
* [~getUserCollectionById(ids)](#module_database..getUserCollectionById) ⇒ <code>object</code>
* [~getSortedPackages(page, dir, method, [themes])](#module_database..getSortedPackages) ⇒ <code>object</code>
* [~getOrderField(method, sqlStorage)](#module_database..getOrderField) ⇒ <code>object</code> \| <code>null</code>
Expand Down Expand Up @@ -1017,22 +1016,6 @@ Use the pointer of a package to collect all users that have starred it.
| --- | --- | --- |
| pointer | <code>string</code> | The ID of the package. |

<a name="module_database..simpleSearch"></a>

### database~simpleSearch(term, dir, sort, [themes]) ⇒ <code>object</code>
The current Fuzzy-Finder implementation of search. Ideally eventually
will use a more advanced search method.

**Kind**: inner method of [<code>database</code>](#module_database)
**Returns**: <code>object</code> - A server status object containing the results and the pagination object.

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| term | <code>string</code> | | The search term. |
| dir | <code>string</code> | | String flag for asc/desc order. |
| sort | <code>string</code> | | The sort method. |
| [themes] | <code>boolean</code> | <code>false</code> | Optional Parameter to specify if this should only return themes. |

<a name="module_database..getUserCollectionById"></a>

### database~getUserCollectionById(ids) ⇒ <code>object</code>
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/complexity-report.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Complexity report, 1/17/2024
# Complexity report, 1/20/2024

* Mean per-function logical LOC: 14.271929824561404
* Mean per-function parameter count: 0.1324561403508772
Expand Down
5 changes: 4 additions & 1 deletion src/controllers/getPackagesSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ module.exports = {

const sso = new context.sso();

return sso.notOk().addContent(packs).addCalls("db.getSortedPackages", packs);
return sso
.notOk()
.addContent(packs)
.addCalls("db.getSortedPackages", packs);
}

const newPacks = await context.utils.constructPackageObjectShort(
Expand Down
11 changes: 5 additions & 6 deletions src/controllers/getThemesSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@ module.exports = {
},

async logic(params, context) {

const packs = await context.database.getSortedPackages(
params,
true
);
const packs = await context.database.getSortedPackages(params, true);

if (!packs.ok) {
const sso = new context.sso();

return sso.notOk().addContent(packs).addCalls("db.getSortedPackages", packs);
return sso
.notOk()
.addContent(packs)
.addCalls("db.getSortedPackages", packs);
}

const newPacks = await context.utils.constructPackageObjectShort(
Expand Down
8 changes: 2 additions & 6 deletions src/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ function queryClause(opts) {
const searchTerm = lcterm.replace(wordSeparators, "_");
// Replaces all word separators with '_' which matches any single character

return sqlStorage`AND p.name LIKE ${"%" + searchTerm + "%" }`;
return sqlStorage`AND p.name LIKE ${"%" + searchTerm + "%"}`;
}

function filterClause(opts) {
Expand Down Expand Up @@ -1591,11 +1591,7 @@ async function getSortedPackages(opts, themes = false) {
INNER JOIN versions AS v ON (p.pointer = v.package AND v.deleted IS FALSE
${queryClause(opts)}
${filterClause(opts)}
${
themes === true
? filterClause({ filter: "theme" })
: sqlStorage``
})
${themes === true ? filterClause({ filter: "theme" }) : sqlStorage``})
WHERE p.name IS NOT NULL
Expand Down
7 changes: 3 additions & 4 deletions tests/http/getPackagesSearch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe("Behaves as expected", () => {
{
hasSnippets: false,
hasGrammar: true,
supportedLanguages: ["js", "ts"]
supportedLanguages: ["js", "ts"],
},
"get-packages-search-test",
"1.0.0"
Expand All @@ -84,7 +84,7 @@ describe("Behaves as expected", () => {
direction: "desc",
query: "get packages search",
filter: "package",
fileExtension: "js"
fileExtension: "js",
},
context
);
Expand All @@ -102,13 +102,12 @@ describe("Behaves as expected", () => {
direction: "desc",
query: "get packages search",
filter: "package",
fileExtension: "sql"
fileExtension: "sql",
},
context
);

expect(ssoEmpty.ok).toBe(true);
expect(ssoEmpty.content.length).toBe(0);

});
});

0 comments on commit c99e22c

Please sign in to comment.