Skip to content

Commit ed78857

Browse files
authored
Merge pull request #944 from fabiovincenzi/db-fix
fix: missing query parameter in file db
2 parents 5d24d9d + 100f742 commit ed78857

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

packages/git-proxy-cli/test/testCli.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,12 @@ describe('test git-proxy-cli', function () {
645645

646646
describe('test git-proxy-cli :: git push administration', function () {
647647
const pushId = `0000000000000000000000000000000000000000__${Date.now()}`;
648+
const gitAccount = 'testGitAccount1';
648649

649650
before(async function () {
650651
await helper.addRepoToDb(TEST_REPO_CONFIG);
651-
await helper.addGitPushToDb(pushId, TEST_REPO);
652+
await helper.addUserToDb('testuser1', 'testpassword', '[email protected]', gitAccount);
653+
await helper.addGitPushToDb(pushId, TEST_REPO, gitAccount);
652654
});
653655

654656
it('attempt to ls should list existing push', async function () {

packages/git-proxy-cli/test/testCliUtils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,18 @@ async function addRepoToDb(newRepo, debug = false) {
168168
* Add a new git push record to the database.
169169
* @param {string} id The ID of the git push.
170170
* @param {string} repo The repository of the git push.
171+
* @param {string} user The user who pushed the git push.
171172
* @param {boolean} debug Flag to enable logging for debugging.
172173
*/
173-
async function addGitPushToDb(id, repo, debug = false) {
174+
async function addGitPushToDb(id, repo, user = null, debug = false) {
174175
const action = new actions.Action(
175176
id,
176177
'push', // type
177178
'get', // method
178179
Date.now(), // timestamp
179180
repo,
180181
);
182+
action.user = user;
181183
const step = new steps.Step(
182184
'authBlock', // stepName
183185
false, // error

src/db/file/users.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ exports.updateUser = function (user) {
7878
exports.getUsers = function (query) {
7979
if (!query) query = {};
8080
return new Promise((resolve, reject) => {
81-
db.find({}, (err, docs) => {
81+
db.find(query, (err, docs) => {
8282
if (err) {
8383
reject(err);
8484
} else {

0 commit comments

Comments
 (0)