Compare commits
2 Commits
2210280edd
...
25b573d3a4
Author | SHA1 | Date | |
---|---|---|---|
25b573d3a4 | |||
02383b8c8a |
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@ -1,5 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CommitMessageInspectionProfile">
|
||||
<profile version="1.0">
|
||||
<inspection_tool class="CommitFormat" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="CommitNamingConvention" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
|
@ -402,7 +402,25 @@ const MySqlService = {
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieves all categories from the database.
|
||||
*
|
||||
* @param {MysqlHandler} handler - The MySQL handler used for executing the query.
|
||||
*
|
||||
* @return {Promise<Array<IDbCategory>>} - A promise that resolves with an array of category objects from the database.
|
||||
* - The category objects are of type IDbCategory.
|
||||
* - If an error occurs, the promise will be rejected with an Error object.
|
||||
*/
|
||||
getAll(handler: MysqlHandler) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const _sql = "SELECT * FROM `categories`";
|
||||
try {
|
||||
resolve(handler.query(_sql) as unknown as Array<IDbCategory>);
|
||||
} catch (err: unknown) {
|
||||
reject(err as Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user