mirror of
https://github.com/PretendoNetwork/BOSS.git
synced 2026-03-29 21:35:38 -05:00
feat: use file hashes and title_id hashes for data retrieval
This commit is contained in:
parent
fa2b048015
commit
ff085aadf5
|
|
@ -15,6 +15,7 @@ const TaskSchema = new mongoose.Schema<ITask, TaskModel, ITaskMethods>({
|
|||
enum: ['open'] // TODO - What else is there?
|
||||
},
|
||||
title_id: String,
|
||||
title_id_hash: String,
|
||||
description: Number,
|
||||
created: BigInt,
|
||||
updated: BigInt
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ import { getCdnFileAsStream, streamFileToResponse } from '@/cdn';
|
|||
|
||||
const npdi = express.Router();
|
||||
|
||||
npdi.get('/p01/data/1/:titleHash/:dataID/:fileHash', async (request, response) => {
|
||||
const { dataID } = request.params;
|
||||
npdi.get('/p01/data/1/:titleIdHash/:dataId/:fileHash', async (request, response) => {
|
||||
const { dataId, fileHash } = request.params;
|
||||
|
||||
const file = await File.findOne({
|
||||
data_id: dataID
|
||||
data_id: dataId,
|
||||
hash: fileHash
|
||||
});
|
||||
if (!file) {
|
||||
return response.sendStatus(404);
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ import { File } from '@/models/file';
|
|||
|
||||
const npts = express.Router();
|
||||
|
||||
npts.get('/p01/tasksheet/:id/:hash/:taskId', async (request, response) => {
|
||||
const { id, taskId } = request.params;
|
||||
npts.get('/p01/tasksheet/:id/:titleIdHash/:taskId', async (request, response) => {
|
||||
const { titleIdHash, taskId } = request.params;
|
||||
|
||||
const task = await Task.findOne({
|
||||
title_id: id,
|
||||
id: taskId
|
||||
id: taskId,
|
||||
title_id_hash: titleIdHash
|
||||
});
|
||||
if (!task) {
|
||||
return response.sendStatus(404);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ export interface ITask {
|
|||
creator_pid: number;
|
||||
status: 'open'; // TODO - Make this a union. What else is there?
|
||||
title_id: string;
|
||||
title_id_hash: string;
|
||||
description: string;
|
||||
created: bigint;
|
||||
updated: bigint;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user