-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from High-Country-Dev/refactor/auth-and-mongoos…
…e-md-5012 [MD-5012] refactor: updated middleware, auth, db conn etc.
- Loading branch information
Showing
38 changed files
with
1,386 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
apps/isomorphic-i18n/src/app/[lang]/(hydrogen)/groups/aia/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
export default function AIAPage() { | ||
return ( | ||
<div> | ||
AIA | ||
</div> | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
apps/isomorphic-i18n/src/app/[lang]/(hydrogen)/groups/cia/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
export default function CIAPage() { | ||
return ( | ||
<div> | ||
CIA | ||
</div> | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
apps/isomorphic-i18n/src/app/[lang]/(hydrogen)/groups/control/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
export default function ControlPage() { | ||
return ( | ||
<div> | ||
Control | ||
</div> | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
apps/isomorphic-i18n/src/app/[lang]/(hydrogen)/groups/iia/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
export default function IIAPage() { | ||
return ( | ||
<div> | ||
IIA | ||
</div> | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
apps/isomorphic-i18n/src/app/[lang]/(hydrogen)/groups/wbcia/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
export default function WBCIAPage() { | ||
return ( | ||
<div> | ||
CIA | ||
</div> | ||
) | ||
} |
5 changes: 3 additions & 2 deletions
5
...rphic-i18n/src/app/[lang]/signin/page.tsx → ...phic-i18n/src/app/[lang]/sign-in/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Alert as RAlert, Text } from "rizzui" | ||
|
||
import cn from "@utils/class-names"; | ||
|
||
export default function Alert({ | ||
color, | ||
message, | ||
className, | ||
}: { | ||
color: 'danger' | 'success' | 'warning'; | ||
message: string; | ||
className?: string; | ||
}) { | ||
return ( | ||
<RAlert | ||
color={color} | ||
variant="flat" | ||
className={cn(className)} | ||
> | ||
<Text>{message}</Text> | ||
</RAlert> | ||
) | ||
} |
97 changes: 48 additions & 49 deletions
97
apps/isomorphic-i18n/src/app/api/aggregated-catch/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,52 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import clientPromise from "@/app/mongodb"; | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
|
||
export async function GET(req: NextRequest) { | ||
try { | ||
const client = await clientPromise; | ||
const db = client.db("kenya"); | ||
const collection = db.collection("legacy_data"); | ||
/** | ||
* TODO: migrate to mongoose | ||
*/ | ||
|
||
// Filter and aggregate data | ||
const data = await collection | ||
.aggregate([ | ||
{ | ||
$match: { | ||
landing_site: "Kenyatta", | ||
}, | ||
}, | ||
{ | ||
$project: { | ||
landing_date: { | ||
$dateTrunc: { | ||
date: "$landing_date", | ||
unit: "month", | ||
}, | ||
}, | ||
fish_category: 1, | ||
catch_kg: 1, | ||
}, | ||
}, | ||
{ | ||
$group: { | ||
_id: { | ||
landing_date: "$landing_date", | ||
fish_category: "$fish_category", | ||
}, | ||
catch_kg: { $sum: "$catch_kg" }, | ||
}, | ||
}, | ||
{ | ||
$sort: { "_id.landing_date": 1, "_id.fish_category": 1 }, | ||
}, | ||
]) | ||
.toArray(); | ||
export async function GET(req: NextRequest) { | ||
// try { | ||
// const client = await clientPromise; | ||
// const db = client.db('kenya'); | ||
// const collection = db.collection('legacy_data'); | ||
|
||
// // Filter and aggregate data | ||
// const data = await collection.aggregate([ | ||
// { | ||
// $match: { | ||
// landing_site: "Kenyatta" | ||
// } | ||
// }, | ||
// { | ||
// $project: { | ||
// landing_date: { | ||
// $dateTrunc: { | ||
// date: "$landing_date", | ||
// unit: "month" | ||
// } | ||
// }, | ||
// fish_category: 1, | ||
// catch_kg: 1 | ||
// } | ||
// }, | ||
// { | ||
// $group: { | ||
// _id: { | ||
// landing_date: "$landing_date", | ||
// fish_category: "$fish_category" | ||
// }, | ||
// catch_kg: { $sum: "$catch_kg" } | ||
// } | ||
// }, | ||
// { | ||
// $sort: { "_id.landing_date": 1, "_id.fish_category": 1 } | ||
// } | ||
// ]).toArray(); | ||
|
||
return NextResponse.json(data); | ||
} catch (error) { | ||
console.error("Error fetching data:", (error as Error).message); | ||
return NextResponse.json( | ||
{ error: "Internal Server Error", details: (error as Error).message }, | ||
{ status: 500 } | ||
); | ||
} | ||
// return NextResponse.json(data); | ||
// } catch (error) { | ||
// console.error('Error fetching data:', (error as Error).message); | ||
// return NextResponse.json({ error: 'Internal Server Error', details: (error as Error).message }, { status: 500 }); | ||
// } | ||
return NextResponse.json({}); | ||
} |
Oops, something went wrong.