Skip to content

Commit

Permalink
add mock-create-rule nextjs endpoint #373
Browse files Browse the repository at this point in the history
  • Loading branch information
maany committed Oct 6, 2023
1 parent 0da9f54 commit 1724fba
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/pages/api/feature/feature-create-rule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { withAuthenticatedSessionRoute } from "@/lib/infrastructure/auth/session-utils";
import { NextApiRequest, NextApiResponse } from "next";

async function endpoint(req: NextApiRequest, res: NextApiResponse, rucioAuthToken: string) {
if(req.method !== 'POST') {
res.status(405).json({ error: 'Method Not Allowed' })
return
}


const data = req.body

if(!data) {
res.status(400).json({ error: 'Missing body' })
return
}

res.status(200).json(req.body)
}

export default withAuthenticatedSessionRoute(endpoint);
30 changes: 30 additions & 0 deletions src/pages/api/feature/mock-get-validated-dids.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { withAuthenticatedSessionRoute } from "@/lib/infrastructure/auth/session-utils";
import { NextApiRequest, NextApiResponse } from "next";
import { fixtureRuleMetaViewModel, generateSequenceArray } from "test/fixtures/table-fixtures";

async function endpoint(req: NextApiRequest, res: NextApiResponse, rucioAuthToken: string) {
if(req.method !== 'POST') {
res.status(405).json({ error: 'Method Not Allowed' })
return
}
if(!req.body) {
res.status(400).json({ error: 'Missing body' })
return
}
const { dids } = req.body
if(!dids) {
res.status(400).json({ error: 'Missing dids' })
return
}
const response = dids.map((did: string) => {
return {
did,
is_valid: true,
reason: null
}
})

res.status(200).json(response)
}

export default withAuthenticatedSessionRoute(endpoint);

0 comments on commit 1724fba

Please sign in to comment.