mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-30 02:48:01 +03:00
Rename goal.title to goal.name
This commit is contained in:
+1
-1
@@ -84,7 +84,7 @@
|
||||
"rimraf": "3.0.2",
|
||||
"safe-json-stringify": "1.2.0",
|
||||
"seq-logging": "1.1.1",
|
||||
"tachi-common": "0.7.5",
|
||||
"tachi-common": "0.7.6",
|
||||
"ts-node": "10.4.0",
|
||||
"tsconfig-paths": "3.12.0",
|
||||
"typescript": "4.5.5",
|
||||
|
||||
Generated
+4
-4
@@ -65,7 +65,7 @@ specifiers:
|
||||
safe-json-stringify: 1.2.0
|
||||
seq-logging: 1.1.1
|
||||
supertest: 6.2.2
|
||||
tachi-common: 0.7.5
|
||||
tachi-common: 0.7.6
|
||||
tap: 15.1.6
|
||||
ts-node: 10.4.0
|
||||
tsconfig-paths: 3.12.0
|
||||
@@ -112,7 +112,7 @@ dependencies:
|
||||
rimraf: 3.0.2
|
||||
safe-json-stringify: 1.2.0
|
||||
seq-logging: 1.1.1
|
||||
tachi-common: 0.7.5
|
||||
tachi-common: 0.7.6
|
||||
ts-node: 10.4.0_2615db9039ce432b4abf2fc39ef336ec
|
||||
tsconfig-paths: 3.12.0
|
||||
typescript: 4.5.5
|
||||
@@ -5363,8 +5363,8 @@ packages:
|
||||
engines: {node: '>= 0.4'}
|
||||
dev: true
|
||||
|
||||
/tachi-common/0.7.5:
|
||||
resolution: {integrity: sha512-F++XGcYlIQqXbwl82qJWYwzvv41ykmXed6j0aMauW2TyOJbuSM04Sw8j0TONXlU9X1QsIWLahG8I2p0wLrT0Qw==}
|
||||
/tachi-common/0.7.6:
|
||||
resolution: {integrity: sha512-stdhYYWvHMGmaqnIszmymAbIhwZcMXXXP4hhosayZzCaWlzZENqXA21wAwrFn+BiazWpTLdSn46KP+94Jg06OA==}
|
||||
dependencies:
|
||||
'@types/mongodb': 3.6.18
|
||||
dev: false
|
||||
|
||||
@@ -141,7 +141,7 @@ export async function EvaluateMilestoneProgress(userID: integer, milestone: Mile
|
||||
|
||||
if (!result) {
|
||||
logger.error(
|
||||
`Failed to calculate ${userID} result for goal '${goal.title}'. Is the goal valid?`,
|
||||
`Failed to calculate ${userID} result for goal '${goal.name}'. Is the goal valid?`,
|
||||
{ goal, milestone }
|
||||
);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ router.get("/:goalID", ResolveGoalID, async (req, res) => {
|
||||
|
||||
return res.status(200).json({
|
||||
success: true,
|
||||
description: `Retrieved information about ${goal.title}.`,
|
||||
description: `Retrieved information about ${goal.name}.`,
|
||||
body: {
|
||||
goal,
|
||||
goalSubs,
|
||||
@@ -170,7 +170,7 @@ router.get(
|
||||
|
||||
if (!results) {
|
||||
throw new Error(
|
||||
`Failed to evaluate goal ${goal.title} (${goal.goalID}) for user ${user.id}. More information above.`
|
||||
`Failed to evaluate goal ${goal.name} (${goal.goalID}) for user ${user.id}. More information above.`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ router.get(
|
||||
|
||||
return res.status(200).json({
|
||||
success: true,
|
||||
description: `Evaluated ${goal.title} for ${user.username}.`,
|
||||
description: `Evaluated ${goal.name} for ${user.username}.`,
|
||||
body: goalResults,
|
||||
});
|
||||
}
|
||||
|
||||
+2
-2
@@ -176,7 +176,7 @@ router.post(
|
||||
|
||||
return res.status(200).json({
|
||||
success: true,
|
||||
description: `Subscribed to ${goal.title}.`,
|
||||
description: `Subscribed to ${goal.name}.`,
|
||||
body: {
|
||||
goal,
|
||||
goalSub,
|
||||
@@ -228,7 +228,7 @@ router.get("/:goalID", GetGoalSubscription, async (req, res) => {
|
||||
|
||||
return res.status(200).json({
|
||||
success: true,
|
||||
description: `Returned information about goal ${goal.title}.`,
|
||||
description: `Returned information about goal ${goal.name}.`,
|
||||
body: {
|
||||
goal,
|
||||
goalSub,
|
||||
|
||||
+9
-16
@@ -2,15 +2,14 @@ import { RequestHandler, Router } from "express";
|
||||
import db from "external/mongo/db";
|
||||
import { SYMBOL_TachiData } from "lib/constants/tachi";
|
||||
import {
|
||||
CalculateMilestoneOutOf,
|
||||
EvaluateMilestoneProgress,
|
||||
GetGoalsInMilestone,
|
||||
SubscribeToMilestone,
|
||||
} from "lib/targets/milestones";
|
||||
import { RequirePermissions } from "server/middleware/auth";
|
||||
import { MilestoneSubscriptionDocument } from "tachi-common";
|
||||
import { GetMilestoneForIDGuaranteed } from "utils/db";
|
||||
import { AssignToReqTachiData } from "utils/req-tachi-data";
|
||||
import { FormatUserDoc } from "utils/user";
|
||||
import { FormatUserDoc, GetUserWithID } from "utils/user";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
@@ -104,7 +103,7 @@ router.get("/:milestoneID", GetMilestoneSubscription, async (req, res) => {
|
||||
*
|
||||
* @name PUT /api/v1/users/:userID/games/:game/:playtype/targets/milestones/:milestoneID
|
||||
*/
|
||||
router.put("/:milestoneID", RequirePermissions(""), async (req, res) => {
|
||||
router.put("/:milestoneID", RequirePermissions("manage_targets"), async (req, res) => {
|
||||
const user = req[SYMBOL_TachiData]!.requestedUser!;
|
||||
const game = req[SYMBOL_TachiData]!.game!;
|
||||
const playtype = req[SYMBOL_TachiData]!.playtype!;
|
||||
@@ -147,7 +146,7 @@ router.put("/:milestoneID", RequirePermissions(""), async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
const { progress, achieved } = await EvaluateMilestoneProgress(user.id, milestone);
|
||||
const x = await SubscribeToMilestone(user.id, milestone);
|
||||
|
||||
if (achieved) {
|
||||
return res.status(400).json({
|
||||
@@ -156,17 +155,11 @@ router.put("/:milestoneID", RequirePermissions(""), async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
const milestoneSub: MilestoneSubscriptionDocument = {
|
||||
achieved,
|
||||
game,
|
||||
milestoneID: milestone.milestoneID,
|
||||
playtype,
|
||||
progress,
|
||||
timeAchieved: null,
|
||||
timeSet: Date.now(),
|
||||
userID: user.id,
|
||||
wasInstantlyAchieved: false,
|
||||
};
|
||||
return res.status(200).json({
|
||||
success: true,
|
||||
description: `Subscribed to milestone '${milestone.name}'.`,
|
||||
body:
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user