Ranks customs perfect-preferencely by using Simple Additive Weighting (SAW) algorithm.
- Run your postgreSQL. You could mock your database by using docker in
start-database.sh - Copy
.env.exampleto.env - Set
DATABASE_URL - If you never push the database schema, just run:
npm run db:push - Try to run
npm run postinstall - If you are on linux:
./.env && npm exec -y tsx -- ./prisma/insert.ts
If you are on windows:npm exec -y env-cmd -- npm exec -y tsx -- ./prisma/insert.ts
or you could just usenpm run db:insert-linuxornpm run db:insert-win - You may want to redo the step 6 for mock. E.g. Linux
npm exec -y tsx -- ./prisma/insert.ts - Last, run
npm run dev
All commands already scripted and implemented in .devcontainer/postStart.sh. You could just open
a new Codespace and wait for terminal finishing the build. After that, run npm run dev.
To manage DB, you could do npm run db:studio.
({
getKostums: publicProcedure.input(z.object({
rank: z.boolean().default(false),
name: z.string().optional(),
link: z.string().optional(),
origin: z.string().optional(),
}).default({}))
.query(({ ctx: { db }, }) => db.kostum.findMany({
//
})),
})Such searching features has default value. Whether developer input undefined it would use the default. For every query
is a wildcard, which would not care of cAsE and incomp...(lete) words even if it is at the ...start, end..., or mid..dle.
A omnibox like Google Search Bar or Github Repository Search usually using additional parameters that can be used. E.g.
sort:name,desc origin:Game param2:Long param but between params param1:"Long Params" A usual normal search
This could be breakdowns to
const x = {
sort: ["name", "desc"],
origin: "Game",
// notice by "param2:Lomg" and "params "
// In regex should be `:\w+\s`
param2: "Long param but between params",
param1: "Long Params",
q: "A usual normal search"
}- First upload file to
POST /api/uploadasmultipart/form-datato a field namedfile - Get the filename by response
name - Pass the
nameto other service on tRPC.
- Ensure you have run mocks upsertion.
- Run
npm exec -y tsx -- ./src/server/test/04-findMany-selected.ts