mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-13 01:38:29 +03:00
adhere to barbatos spec
This commit is contained in:
@@ -7,17 +7,17 @@ import mockApi from "../../../test-utils/mock-api";
|
||||
import { TestingBarbatosScore } from "../../../test-utils/test-data";
|
||||
import db from "../../../db/db";
|
||||
|
||||
t.test("POST /api/ir/barbatos/import", async (t) => {
|
||||
t.test("POST /api/ir/barbatos/score/submit", async (t) => {
|
||||
const cookie = await CreateFakeAuthCookie(mockApi);
|
||||
|
||||
t.beforeEach(ResetDBState);
|
||||
|
||||
// @TODO NEEDS TO USE PROPER AUTHENTICATION!!!
|
||||
RequireNeutralAuthentication("/api/ir/barbatos/import", "POST");
|
||||
RequireNeutralAuthentication("/api/ir/barbatos/score/submit", "POST");
|
||||
|
||||
t.test("Should import a valid score", async (t) => {
|
||||
let res = await mockApi
|
||||
.post("/api/ir/barbatos/import")
|
||||
.post("/api/ir/barbatos/score/submit")
|
||||
.set("Cookie", cookie)
|
||||
.send(TestingBarbatosScore);
|
||||
|
||||
|
||||
@@ -6,7 +6,11 @@ import { ParseBarbatosSingle } from "../../../score-import/import-types/ir/barba
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
router.post("/import", RequireLoggedIn, async (req, res) => {
|
||||
/**
|
||||
* Submits a single score document from Barbatos clients.
|
||||
* @name /api/ir/barbatos/score/submit
|
||||
*/
|
||||
router.post("/score/submit", RequireLoggedIn, async (req, res) => {
|
||||
const userDoc = await GetUserWithIDGuaranteed(req.session.ktchi!.userID);
|
||||
|
||||
let responseData = await ExpressWrappedScoreImportMain(userDoc, true, "ir/barbatos", (logger) =>
|
||||
|
||||
Reference in New Issue
Block a user