fix(skydive): migrate author field from ObjectId to UUID string
- Register SkydiverProfile model in mysql.js (fixes startup crash on association)
- Replace $toObjectId with direct string match in all 12 aggregation queries
- Guard toJSONFor on all Mongo models to fall back to MySQL user.toProfileJSONFor()
when author is a UUID string (restores username/image in API responses)
- Pass user to toJSONFor() everywhere instead of null
- Remove dead .populate('author') calls (author: String has no ref)
- Fix ownership check in /last route: compare author string to req.payload.id
instead of the now-absent author.username property
This commit is contained in:
@@ -13,7 +13,6 @@ passport.use('headerapikey', new HeaderAPIKeyStrategy(
|
||||
const salt = secret;
|
||||
Promise.resolve(bcrypt.hash(apikey, salt)).then(function (encryptedKey) {
|
||||
Application.findOne({ encryptedKey: encryptedKey })
|
||||
.populate('author')
|
||||
.then(function (application) {
|
||||
if (!application) {
|
||||
return done({message: "Application can't be found.", status: 404}, false, false);
|
||||
|
||||
Reference in New Issue
Block a user