This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 746
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing properies and sync missing star users. fixed #235
* add readmeFilename and missing created, modified time. * Sync star users on pkg sync flow * Show star users on registry.show * Show star users on web package show * Need to create new table module_star
- Loading branch information
Showing
11 changed files
with
273 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/**! | ||
* cnpmjs.org - proxy/module_star.js | ||
* | ||
* Copyright(c) cnpmjs.org and other contributors. | ||
* MIT Licensed | ||
* | ||
* Authors: | ||
* fengmk2 <[email protected]> (http://fengmk2.github.com) | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var mysql = require('../common/mysql'); | ||
|
||
exports.add = function *add(name, user) { | ||
var sql = 'INSERT INTO module_star(name, user) VALUES(?, ?);'; | ||
try { | ||
yield mysql.query(sql, [name, user]); | ||
} catch (err) { | ||
if (err.code !== 'ER_DUP_ENTRY') { | ||
throw err; | ||
} | ||
} | ||
}; | ||
|
||
exports.remove = function *(name, user) { | ||
var sql = 'DELETE FROM module_star WHERE name = ? AND user = ?;'; | ||
return yield mysql.query(sql, [name, user]); | ||
}; | ||
|
||
exports.listUsers = function *(name) { | ||
var sql = 'SELECT user FROM module_star WHERE name = ?;'; | ||
return (yield mysql.query(sql, [name])).map(function (r) { | ||
return r.user; | ||
}); | ||
}; | ||
|
||
exports.listUserModules = function *(user) { | ||
var sql = 'SELECT name FROM module_star WHERE user = ?;'; | ||
return (yield mysql.query(sql, [user])).map(function (r) { | ||
return r.name; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.