Skip to content

Commit

Permalink
Refactor and update dummy server actions to satisfy linter
Browse files Browse the repository at this point in the history
  • Loading branch information
pjborowiecki committed Jan 7, 2024
1 parent 225899e commit efe7788
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 28 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# Quantum Stash

Quantum Stash is a modern inventory management system, designed for the future of efficient business operations. Harness the power of advanced technology to streamline your inventory processes with precision and speed. Quantum Stash offers a seamless and intuitive experience, ensuring that your organization stays ahead in the dynamic landscape of inventory control. From cutting-edge analytics to real-time updates, Quantum Stash empowers your business to manage stock with unprecedented efficiency. Elevate your inventory management to a new dimension with Quantum Stash.

![public/images/screenshots/screenshot_1](./public/images/screenshots/screenshot_1.png)

![public/images/screenshots/screenshot_2](./public/images/screenshots/screenshot_2.png)

<br />

## Project Description

**WORK IN PROGRESS**

Quantum Stash is an open-source Software as a Service (SaaS) web application designed for efficient inventory management.
Expand All @@ -22,6 +12,12 @@ You can check the deployed demo version [TODO: here]()

<br />

![public/images/screenshots/screenshot_1](./public/images/screenshots/screenshot_1.png)

![public/images/screenshots/screenshot_2](./public/images/screenshots/screenshot_2.png)

<br />

## Tech Stack

- **Framework:** [Next.js 14](https://nextjs.org)
Expand Down
12 changes: 9 additions & 3 deletions src/actions/inventory/brands.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use server"

import { type addBrandSchema } from "@/validations/inventory"
import { type brandSchema } from "@/validations/inventory"
import type { z } from "zod"

export async function addNewBrand(input: z.infer<typeof addBrandSchema>) {
export async function addNewBrand(input: z.infer<typeof brandSchema>) {
console.log(input.name)
return "success"
console.log("Adding brand to the database...")
return new Promise((resolve) => {
setTimeout(() => {
console.log("Brand added to the database")
resolve("success")
}, 1000)
})
}
12 changes: 9 additions & 3 deletions src/actions/inventory/categories.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use server"

import { type addCategorySchema } from "@/validations/inventory"
import type { categorySchema } from "@/validations/inventory"
import type { z } from "zod"

export async function addNewCategory(input: z.infer<typeof addCategorySchema>) {
export async function addCategory(input: z.infer<typeof categorySchema>) {
console.log(input.name, input.description)
return "success"
console.log("Adding new category to the database")
return new Promise((resolve) => {
setTimeout(() => {
console.log("Category added to the database")
resolve("success")
}, 1000)
})
}
12 changes: 9 additions & 3 deletions src/actions/inventory/units.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
"use server"

import { type addUnitSchema } from "@/validations/inventory"
import type { unitSchema } from "@/validations/inventory"
import type { z } from "zod"

export async function addNewUnit(input: z.infer<typeof addUnitSchema>) {
export async function addNewUnit(input: z.infer<typeof unitSchema>) {
console.log(input.name, input.abbreviation)
return "success"
console.log("Adding unit to the database...")
return new Promise((resolve) => {
setTimeout(() => {
console.log("Unit added to the database")
resolve("success")
}, 1000)
})
}
14 changes: 9 additions & 5 deletions src/actions/warehouses.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
"use server"

import { type addWarehouseSchema } from "@/validations/warehouses"
import type { warehouseSchema } from "@/validations/warehouses"
import type { z } from "zod"

export async function addNewWarehouse(
input: z.infer<typeof addWarehouseSchema>
) {
export async function addWarehouse(input: z.infer<typeof warehouseSchema>) {
console.log(input.name)
console.log(input.type)
console.log(input.description)
console.log(input.location)
return "success"
console.log("Adding warehouse to the database...")
return new Promise((resolve) => {
setTimeout(() => {
console.log("Warehouse added to the database")
resolve("success")
}, 1000)
})
}
6 changes: 3 additions & 3 deletions src/validations/inventory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as z from "zod"

export const addCategorySchema = z.object({
export const categorySchema = z.object({
name: z.string(),
description: z.string(),
})
Expand Down Expand Up @@ -115,11 +115,11 @@ export const extendedItemSchema = itemSchema.extend({
.nullable(),
})

export const addUnitSchema = z.object({
export const unitSchema = z.object({
name: z.string(),
abbreviation: z.string(),
})

export const addBrandSchema = z.object({
export const brandSchema = z.object({
name: z.string(),
})
2 changes: 1 addition & 1 deletion src/validations/warehouses.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as z from "zod"

export const addWarehouseSchema = z.object({
export const warehouseSchema = z.object({
name: z.string(),
type: z.string(),
description: z.string(),
Expand Down

0 comments on commit efe7788

Please sign in to comment.