This file contains hidden or 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
| // As needed, add imports | |
| export const createGMXClient = () => { | |
| // As needed, create shared resources or | |
| // shared functions | |
| // _placeDeposit = async () => { ... } | |
| /** | |
| * When called, the function should place an order, using the given | |
| * arguments, with the GMX V2 contract and return an identifier for |
This file contains hidden or 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
| import { try as tryit, partial, mapValues } from "radash"; | |
| import * as uuid from "uuid"; | |
| import dur, { Duration } from "durhuman"; | |
| import type { Props, ApiFunction } from "@exobase/core"; | |
| interface CacheClient { | |
| get: (key: string) => Promise<string>; | |
| set: (key: string, value: string, ttl: number) => Promise<void>; | |
| } |
This file contains hidden or 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
| export type ListingView = { | |
| _view: 'listing' | |
| id: string | |
| title: string | |
| categoryId: string | |
| description: string | |
| price: number | |
| userId: string | |
| expiresAt: number | |
| } |
This file contains hidden or 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
| import * as t from 'src/types' | |
| export class ListingView { | |
| static toView(model: t.Listing): t.ListingView { | |
| return { | |
| _view: 'listing', | |
| id: model.id, | |
| title: model.title, | |
| categoryId: model.categoryId, | |
| description: model.description, |
This file contains hidden or 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
| export type Listing = { | |
| id: string | |
| title: string | |
| categoryId: string | |
| description: string | |
| price: number | |
| userId: string | |
| expiresAt: number | |
| reported: number | |
| } |
This file contains hidden or 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
| import { compose } from 'radash' | |
| import { useNext } from '@exobase/next' | |
| import { useService, useJsonArgs } from '@exobase/hooks' | |
| import type { Props } from '@exobase/core' | |
| import makeDatabase from 'src/database' | |
| import * as t from 'src/types' | |
| import * as mappers from 'src/view/mappers' | |
| type Args = { | |
| listingId: string |
This file contains hidden or 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
| export type ListingDocument = Listing & { | |
| _id: ObjectId | |
| _categoryId: ObjectId | |
| _userId: ObjectId | |
| } |
This file contains hidden or 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
| import { omit } from 'radash' | |
| import * as t from 'src/types' | |
| import { ObjectId } from 'mongodb' | |
| export class Listing { | |
| static toModel(document: t.ListingDocument): t.Listing { | |
| return omit(document, ['_id', '_userId', '_categoryId']) | |
| } | |
| static toDocument(model: t.Listing): t.ListingDocument { | |
| return { |
This file contains hidden or 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
| export default function PasswordResetEmail({ | |
| link, | |
| user | |
| }: { | |
| link: string | |
| user: User | |
| }) { | |
| return ( | |
| <div className="bg-slate-200"> |
This file contains hidden or 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
| import _ from 'radash' | |
| import { useStoredData } from './useStoredData' | |
| interface StoredUser { | |
| email: string | |
| } | |
| export default function App () { | |
| const storedUsers = useStoredData({ |
NewerOlder