MCPcopy Create free account
hub / github.com/coderwhy/coderhub / LabelService

Class LabelService

src/service/label.service.js:3–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1const connection = require('../app/database');
2
3class LabelService {
4 async create(name) {
5 const statement = `INSERT INTO label (name) VALUES (?);`;
6 const [result] = await connection.execute(statement, [name]);
7 return result;
8 }
9
10 async getLabelByName(name) {
11 const statement = `SELECT * FROM label WHERE name = ?;`;
12 const [result] = await connection.execute(statement, [name]);
13 return result[0];
14 }
15
16 async getLabels(limit, offset) {
17 const statement = `SELECT * FROM label LIMIT ?, ?;`;
18 const [result] = await connection.execute(statement, [offset, limit]);
19 return result;
20 }
21}
22
23module.exports = new LabelService();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected