mirror of
https://github.com/UiO-Gaming/infoscreen3.git
synced 2026-11-05 22:04:33 +01:00
30 lines
757 B
JavaScript
30 lines
757 B
JavaScript
import config from '../config.js'
|
|
|
|
const records = config.admins;
|
|
|
|
export default {
|
|
|
|
findById: function (id, cb) {
|
|
process.nextTick(function () {
|
|
let idx = id - 1;
|
|
if (records[idx]) {
|
|
cb(null, records[idx]);
|
|
} else {
|
|
cb(new Error('User ' + id + ' does not exist'));
|
|
}
|
|
});
|
|
},
|
|
|
|
findByUsername: function (username, cb) {
|
|
process.nextTick(function () {
|
|
for (let i = 0, len = records.length; i < len; i++) {
|
|
let record = records[i];
|
|
if (record.username === username) {
|
|
return cb(null, record);
|
|
}
|
|
}
|
|
return cb(null, null);
|
|
});
|
|
}
|
|
};
|