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:
2026-04-26 04:27:47 +02:00
parent da1f9437ab
commit 66821427be
17 changed files with 64 additions and 120 deletions
-1
View File
@@ -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);