momentum-mod / website

Momentum Mod's main website.
https://momentum-mod.org
MIT License
58 stars 59 forks source link

/admin/maps/:mapID PATCH #817

Closed tsa96 closed 1 year ago

tsa96 commented 1 year ago

Same as #816, this one is really complicated, especially since there's so much to do when going to APPROVED.

tsa96 commented 1 year ago

Some stuff from notes

Going to Approved

Placeholders

See if we have anything in placeholders on MapSubmission. If so, iterate over each. Note that it's possible that during this period that same placeholder was created from another submission. I think we just have to accept that this could happen but not the end of the world, we could add support for merging two placeholders if needed

Activities

Created MAP_APPROVED activites for authors. Old code here:

const allCredits = await tx.mapCredit.findMany({
  where: { mapID, type: MapCreditType.AUTHOR }
});

await tx.activity.createMany({
  data: allCredits.map(
    (credit): Prisma.ActivityCreateManyInput => ({
      type: ActivityType.MAP_APPROVED,
      userID: credit.userID,
      data: mapID
    })
  )
});
}
tsa96 commented 1 year ago

More from notes - I don't have further thought on this yet: make long-term issue for allows admins to revert map back to submission state? Maybe just SPECIAL? e.g. map gets added in fast for an event, but then wants to go back for approval after event

tsa96 commented 1 year ago

When going to approved, take the last MapSubmissionVersion, rename it to the map's fileName and upload to maps/

tsa96 commented 1 year ago

See #841 for some extra behaviour we need