├── .gitignore ├── uploads ├── visa.png ├── paypal.png ├── slide1.webp ├── slide2.webp ├── look (1).png ├── look (2).png ├── look (3).png ├── look (4).png ├── Men │ ├── Men (1).jpg │ ├── Men (10).jpg │ ├── Men (11).jpg │ ├── Men (2).jpg │ ├── Men (3).jpg │ ├── Men (4).jpg │ ├── Men (5).jpg │ ├── Men (6).jpg │ ├── Men (7).jpg │ ├── Men (8).jpg │ ├── Men (9).jpg │ ├── cart1.1.png │ └── people2.2.avif ├── account-01.webp ├── brand │ ├── color1.png │ ├── color2.png │ ├── color3.png │ ├── color4.png │ ├── color5.png │ └── color6.png ├── google-pay.webp ├── mastercard.png ├── Women │ ├── cart1.3.png │ ├── Women (1).webp │ ├── Women (10).webp │ ├── Women (11).webp │ ├── Women (12).webp │ ├── Women (13).webp │ ├── Women (14).webp │ ├── Women (2).webp │ ├── Women (3).webp │ ├── Women (4).webp │ ├── Women (5).webp │ ├── Women (6).webp │ ├── Women (7).webp │ ├── Women (8).webp │ └── Women (9).webp ├── shoes │ ├── shoe1.1.webp │ ├── shoe1.2.webp │ ├── shoe1.3.webp │ ├── shoe1.4.webp │ ├── shoe1.5.webp │ ├── shoe1.6.webp │ ├── shoe1.7.webp │ ├── shoe1.8.webp │ ├── shoe2.1.webp │ ├── shoe2.2.webp │ ├── shoe2.3.webp │ ├── shoe2.4.webp │ ├── shoe2.5.webp │ ├── shoe2.6.webp │ ├── shoe2.7.webp │ ├── shoe2.8.webp │ ├── people1.5.avif │ └── menu-banner.webp ├── socialmedia │ ├── a.avif │ ├── b.avif │ ├── c.webp │ ├── d.avif │ ├── e.webp │ ├── f.avif │ ├── g.avif │ ├── h.avif │ ├── i.avif │ ├── j.avif │ ├── k.avif │ ├── l.avif │ ├── m.avif │ ├── n.avif │ ├── o.avif │ └── p.avif ├── american-express.png ├── category │ ├── circle1.avif │ ├── circle2.avif │ ├── circle3.avif │ ├── circle4.avif │ ├── circle5.avif │ └── circle6.avif ├── Summerdress │ ├── cart1.5.png │ ├── people1.3.avif │ ├── people1.4.avif │ ├── people1.6.avif │ ├── summer1.1.webp │ ├── summer1.2.webp │ ├── summer1.3.webp │ ├── summer1.4.webp │ ├── summer1.5.webp │ ├── summer2.1.webp │ ├── summer2.2.webp │ ├── summer2.3.webp │ ├── summer2.4.webp │ └── summer2.5.webp ├── Winterdress │ ├── cart1.1.png │ ├── cart1.3.png │ ├── cart1.4.png │ ├── bigimage1.webp │ ├── cart1.2.webp │ ├── cart1.3.webp │ ├── cart1.5.webp │ ├── cart2.1.webp │ ├── cart2.2.webp │ ├── cart2.3.webp │ ├── cart2.4.webp │ ├── cart2.5.webp │ └── people1.1.avif ├── Menu bar │ ├── Catalog │ │ ├── pets.avif │ │ ├── parts.avif │ │ ├── shoes.avif │ │ ├── jewelry.avif │ │ ├── electronics.avif │ │ ├── nutritions.avif │ │ ├── toys-games.avif │ │ ├── cameras-optics.avif │ │ ├── menu-category.avif │ │ ├── home_and_garden.avif │ │ ├── menu-category-03.avif │ │ ├── menu-category-06.avif │ │ ├── office-supplies.avif │ │ ├── busines-industrial.avif │ │ ├── handbags-wallets_2572ebaf-29b8-4a8a-a6f9-435f84344f73.avif │ │ └── ChatGPT_files │ │ │ ├── saved_resource.html │ │ │ └── index-small-c8xg50op.css │ ├── menu-banner-03.webp │ ├── menu-banner-06.webp │ └── menu-banner-07.webp ├── popup-login-fashion2.webp ├── Categoryimage │ ├── categorya.webp │ ├── categoryb.png │ ├── categoryc.webp │ ├── categoryd.webp │ ├── categorye.webp │ ├── categoryf.webp │ ├── categoryg.webp │ ├── categoryh.webp │ ├── categoryi.webp │ └── categoryj.webp ├── popup-newsletter-fashion2.webp ├── home-svgrepo-com.svg ├── svg-icons │ ├── filter-svgrepo-com.svg │ ├── return-svgrepo-com.svg │ ├── support-technology-svgrepo-com.svg │ ├── leaf-fluttering-in-wind-svgrepo-com.svg │ └── documentation-svgrepo-com.svg ├── bars-sort-svgrepo-com.svg ├── mail-letter-svgrepo-com.svg ├── cross-svgrepo-com.svg ├── menu-svgrepo-com.svg ├── loupe-search-svgrepo-com.svg ├── heart-like-svgrepo-com.svg ├── phone-svgrepo-com.svg ├── user-svgrepo-com.svg ├── delivery-truck-svgrepo-com.svg ├── shield-antivirus-svgrepo-com.svg ├── messages-svgrepo-com.svg ├── shopping-bag-svgrepo-com.svg ├── logo.svg ├── logo-white.svg ├── three-equalizer-bars-svgrepo-com.svg └── operator-svgrepo-com.svg ├── prisma ├── migrations │ ├── 20250215091231_init │ │ └── migration.sql │ ├── 20241209055417_add_imagepath_to_category │ │ └── migration.sql │ ├── migration_lock.toml │ ├── 20241209082831_init │ │ └── migration.sql │ ├── 20241209090549_init │ │ └── migration.sql │ ├── 20250219163501_init │ │ └── migration.sql │ ├── 20250217055219_add_product_attributes │ │ └── migration.sql │ ├── 20241209083528_init │ │ └── migration.sql │ ├── 20250220060538_add_unique_to_product_name │ │ └── migration.sql │ ├── 20250219081703_new_schema │ │ └── migration.sql │ ├── 20250108065608_init │ │ └── migration.sql │ ├── 20250217060250_add_product_images │ │ └── migration.sql │ ├── 20250217140405_update_images_array │ │ └── migration.sql │ ├── 20250320152634_init │ │ └── migration.sql │ ├── 20250108065243_add_season_model │ │ └── migration.sql │ ├── 20250320151524_init │ │ └── migration.sql │ ├── 20250320153609_init │ │ └── migration.sql │ ├── 20250215052929_init │ │ └── migration.sql │ ├── 20250307102057_fix_userrole_default │ │ └── migration.sql │ ├── 20241207100127_init │ │ └── migration.sql │ ├── 20250219160905_init │ │ └── migration.sql │ ├── 20250219081505_ │ │ └── migration.sql │ └── 20250219083658_fix_category_product_ids │ │ └── migration.sql └── schema.prisma ├── src ├── shared │ └── lib │ │ ├── models │ │ ├── jwtModel.ts │ │ ├── clientModel.ts │ │ └── userModel.ts │ │ ├── utils │ │ ├── errorObject.ts │ │ ├── customErrorCode.ts │ │ ├── fileUpload.ts │ │ └── jwt.ts │ │ ├── db.ts │ │ ├── async-context.ts │ │ └── middleware │ │ └── auth-context.ts ├── modules │ ├── brand │ │ ├── brand.service.ts │ │ └── brand.route.ts │ ├── socilamedia │ │ ├── socialmedia.service.ts │ │ └── socialmedia.route.ts │ ├── productImages │ │ ├── productImage.sevice.ts │ │ └── productImage.route.ts │ ├── seasons │ │ ├── season.service.ts │ │ └── season.route.ts │ ├── staff │ │ ├── staff.sevice.ts │ │ └── staff.route.ts │ ├── subject │ │ ├── subject.sevice.ts │ │ └── subject.route.ts │ ├── product │ │ ├── product.route.ts │ │ └── product.service.ts │ ├── category │ │ ├── category.service.ts │ │ └── category.route.ts │ ├── services │ │ ├── services.route.ts │ │ ├── serviceHighlights │ │ │ ├── serviceHighlights.route.ts │ │ │ └── serviceHighlights.service.ts │ │ ├── serviceFeatutures │ │ │ ├── serviceFeature.route.ts │ │ │ └── serviceFeature.service.ts │ │ └── services.service.ts │ ├── assignSubject │ │ ├── assignSubject.service.ts │ │ └── assignSubject.route.ts │ └── auth │ │ ├── auth.route.ts │ │ └── auth.service.ts └── app.ts ├── package.json ├── catalyst-debug.log └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | # Keep environment variables out of version control 3 | .env 4 | -------------------------------------------------------------------------------- /uploads/visa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/visa.png -------------------------------------------------------------------------------- /uploads/paypal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/paypal.png -------------------------------------------------------------------------------- /uploads/slide1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/slide1.webp -------------------------------------------------------------------------------- /uploads/slide2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/slide2.webp -------------------------------------------------------------------------------- /uploads/look (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/look (1).png -------------------------------------------------------------------------------- /uploads/look (2).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/look (2).png -------------------------------------------------------------------------------- /uploads/look (3).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/look (3).png -------------------------------------------------------------------------------- /uploads/look (4).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/look (4).png -------------------------------------------------------------------------------- /uploads/Men/Men (1).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (1).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (10).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (10).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (11).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (11).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (2).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (2).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (3).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (3).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (4).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (4).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (5).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (5).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (6).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (6).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (7).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (7).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (8).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (8).jpg -------------------------------------------------------------------------------- /uploads/Men/Men (9).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/Men (9).jpg -------------------------------------------------------------------------------- /uploads/Men/cart1.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/cart1.1.png -------------------------------------------------------------------------------- /uploads/account-01.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/account-01.webp -------------------------------------------------------------------------------- /uploads/brand/color1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/brand/color1.png -------------------------------------------------------------------------------- /uploads/brand/color2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/brand/color2.png -------------------------------------------------------------------------------- /uploads/brand/color3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/brand/color3.png -------------------------------------------------------------------------------- /uploads/brand/color4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/brand/color4.png -------------------------------------------------------------------------------- /uploads/brand/color5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/brand/color5.png -------------------------------------------------------------------------------- /uploads/brand/color6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/brand/color6.png -------------------------------------------------------------------------------- /uploads/google-pay.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/google-pay.webp -------------------------------------------------------------------------------- /uploads/mastercard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/mastercard.png -------------------------------------------------------------------------------- /uploads/Men/people2.2.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Men/people2.2.avif -------------------------------------------------------------------------------- /uploads/Women/cart1.3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/cart1.3.png -------------------------------------------------------------------------------- /uploads/shoes/shoe1.1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe1.1.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe1.2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe1.2.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe1.3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe1.3.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe1.4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe1.4.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe1.5.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe1.5.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe1.6.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe1.6.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe1.7.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe1.7.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe1.8.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe1.8.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe2.1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe2.1.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe2.2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe2.2.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe2.3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe2.3.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe2.4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe2.4.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe2.5.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe2.5.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe2.6.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe2.6.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe2.7.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe2.7.webp -------------------------------------------------------------------------------- /uploads/shoes/shoe2.8.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/shoe2.8.webp -------------------------------------------------------------------------------- /uploads/socialmedia/a.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/a.avif -------------------------------------------------------------------------------- /uploads/socialmedia/b.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/b.avif -------------------------------------------------------------------------------- /uploads/socialmedia/c.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/c.webp -------------------------------------------------------------------------------- /uploads/socialmedia/d.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/d.avif -------------------------------------------------------------------------------- /uploads/socialmedia/e.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/e.webp -------------------------------------------------------------------------------- /uploads/socialmedia/f.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/f.avif -------------------------------------------------------------------------------- /uploads/socialmedia/g.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/g.avif -------------------------------------------------------------------------------- /uploads/socialmedia/h.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/h.avif -------------------------------------------------------------------------------- /uploads/socialmedia/i.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/i.avif -------------------------------------------------------------------------------- /uploads/socialmedia/j.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/j.avif -------------------------------------------------------------------------------- /uploads/socialmedia/k.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/k.avif -------------------------------------------------------------------------------- /uploads/socialmedia/l.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/l.avif -------------------------------------------------------------------------------- /uploads/socialmedia/m.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/m.avif -------------------------------------------------------------------------------- /uploads/socialmedia/n.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/n.avif -------------------------------------------------------------------------------- /uploads/socialmedia/o.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/o.avif -------------------------------------------------------------------------------- /uploads/socialmedia/p.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/socialmedia/p.avif -------------------------------------------------------------------------------- /uploads/Women/Women (1).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (1).webp -------------------------------------------------------------------------------- /uploads/Women/Women (10).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (10).webp -------------------------------------------------------------------------------- /uploads/Women/Women (11).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (11).webp -------------------------------------------------------------------------------- /uploads/Women/Women (12).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (12).webp -------------------------------------------------------------------------------- /uploads/Women/Women (13).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (13).webp -------------------------------------------------------------------------------- /uploads/Women/Women (14).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (14).webp -------------------------------------------------------------------------------- /uploads/Women/Women (2).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (2).webp -------------------------------------------------------------------------------- /uploads/Women/Women (3).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (3).webp -------------------------------------------------------------------------------- /uploads/Women/Women (4).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (4).webp -------------------------------------------------------------------------------- /uploads/Women/Women (5).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (5).webp -------------------------------------------------------------------------------- /uploads/Women/Women (6).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (6).webp -------------------------------------------------------------------------------- /uploads/Women/Women (7).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (7).webp -------------------------------------------------------------------------------- /uploads/Women/Women (8).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (8).webp -------------------------------------------------------------------------------- /uploads/Women/Women (9).webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Women/Women (9).webp -------------------------------------------------------------------------------- /uploads/american-express.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/american-express.png -------------------------------------------------------------------------------- /uploads/category/circle1.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/category/circle1.avif -------------------------------------------------------------------------------- /uploads/category/circle2.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/category/circle2.avif -------------------------------------------------------------------------------- /uploads/category/circle3.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/category/circle3.avif -------------------------------------------------------------------------------- /uploads/category/circle4.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/category/circle4.avif -------------------------------------------------------------------------------- /uploads/category/circle5.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/category/circle5.avif -------------------------------------------------------------------------------- /uploads/category/circle6.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/category/circle6.avif -------------------------------------------------------------------------------- /uploads/shoes/people1.5.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/people1.5.avif -------------------------------------------------------------------------------- /uploads/Summerdress/cart1.5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/cart1.5.png -------------------------------------------------------------------------------- /uploads/Winterdress/cart1.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart1.1.png -------------------------------------------------------------------------------- /uploads/Winterdress/cart1.3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart1.3.png -------------------------------------------------------------------------------- /uploads/Winterdress/cart1.4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart1.4.png -------------------------------------------------------------------------------- /uploads/shoes/menu-banner.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/shoes/menu-banner.webp -------------------------------------------------------------------------------- /prisma/migrations/20250215091231_init/migration.sql: -------------------------------------------------------------------------------- 1 | -- AlterTable 2 | ALTER TABLE "Category" ADD COLUMN "imagePath" TEXT; 3 | -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/pets.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/pets.avif -------------------------------------------------------------------------------- /uploads/Summerdress/people1.3.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/people1.3.avif -------------------------------------------------------------------------------- /uploads/Summerdress/people1.4.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/people1.4.avif -------------------------------------------------------------------------------- /uploads/Summerdress/people1.6.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/people1.6.avif -------------------------------------------------------------------------------- /uploads/Summerdress/summer1.1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer1.1.webp -------------------------------------------------------------------------------- /uploads/Summerdress/summer1.2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer1.2.webp -------------------------------------------------------------------------------- /uploads/Summerdress/summer1.3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer1.3.webp -------------------------------------------------------------------------------- /uploads/Summerdress/summer1.4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer1.4.webp -------------------------------------------------------------------------------- /uploads/Summerdress/summer1.5.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer1.5.webp -------------------------------------------------------------------------------- /uploads/Summerdress/summer2.1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer2.1.webp -------------------------------------------------------------------------------- /uploads/Summerdress/summer2.2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer2.2.webp -------------------------------------------------------------------------------- /uploads/Summerdress/summer2.3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer2.3.webp -------------------------------------------------------------------------------- /uploads/Summerdress/summer2.4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer2.4.webp -------------------------------------------------------------------------------- /uploads/Summerdress/summer2.5.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Summerdress/summer2.5.webp -------------------------------------------------------------------------------- /uploads/Winterdress/bigimage1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/bigimage1.webp -------------------------------------------------------------------------------- /uploads/Winterdress/cart1.2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart1.2.webp -------------------------------------------------------------------------------- /uploads/Winterdress/cart1.3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart1.3.webp -------------------------------------------------------------------------------- /uploads/Winterdress/cart1.5.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart1.5.webp -------------------------------------------------------------------------------- /uploads/Winterdress/cart2.1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart2.1.webp -------------------------------------------------------------------------------- /uploads/Winterdress/cart2.2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart2.2.webp -------------------------------------------------------------------------------- /uploads/Winterdress/cart2.3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart2.3.webp -------------------------------------------------------------------------------- /uploads/Winterdress/cart2.4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart2.4.webp -------------------------------------------------------------------------------- /uploads/Winterdress/cart2.5.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/cart2.5.webp -------------------------------------------------------------------------------- /uploads/Winterdress/people1.1.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Winterdress/people1.1.avif -------------------------------------------------------------------------------- /uploads/popup-login-fashion2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/popup-login-fashion2.webp -------------------------------------------------------------------------------- /uploads/Categoryimage/categorya.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categorya.webp -------------------------------------------------------------------------------- /uploads/Categoryimage/categoryb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categoryb.png -------------------------------------------------------------------------------- /uploads/Categoryimage/categoryc.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categoryc.webp -------------------------------------------------------------------------------- /uploads/Categoryimage/categoryd.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categoryd.webp -------------------------------------------------------------------------------- /uploads/Categoryimage/categorye.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categorye.webp -------------------------------------------------------------------------------- /uploads/Categoryimage/categoryf.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categoryf.webp -------------------------------------------------------------------------------- /uploads/Categoryimage/categoryg.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categoryg.webp -------------------------------------------------------------------------------- /uploads/Categoryimage/categoryh.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categoryh.webp -------------------------------------------------------------------------------- /uploads/Categoryimage/categoryi.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categoryi.webp -------------------------------------------------------------------------------- /uploads/Categoryimage/categoryj.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Categoryimage/categoryj.webp -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/parts.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/parts.avif -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/shoes.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/shoes.avif -------------------------------------------------------------------------------- /uploads/Menu bar/menu-banner-03.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/menu-banner-03.webp -------------------------------------------------------------------------------- /uploads/Menu bar/menu-banner-06.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/menu-banner-06.webp -------------------------------------------------------------------------------- /uploads/Menu bar/menu-banner-07.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/menu-banner-07.webp -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/jewelry.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/jewelry.avif -------------------------------------------------------------------------------- /uploads/popup-newsletter-fashion2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/popup-newsletter-fashion2.webp -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/electronics.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/electronics.avif -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/nutritions.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/nutritions.avif -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/toys-games.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/toys-games.avif -------------------------------------------------------------------------------- /prisma/migrations/20241209055417_add_imagepath_to_category/migration.sql: -------------------------------------------------------------------------------- 1 | -- AlterTable 2 | ALTER TABLE "Category" ADD COLUMN "imagePath" TEXT; 3 | -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/cameras-optics.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/cameras-optics.avif -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/menu-category.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/menu-category.avif -------------------------------------------------------------------------------- /src/shared/lib/models/jwtModel.ts: -------------------------------------------------------------------------------- 1 | export type JwtPayload = { 2 | id: string; 3 | name: string; 4 | username: string; 5 | role: string; 6 | } -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/home_and_garden.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/home_and_garden.avif -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/menu-category-03.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/menu-category-03.avif -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/menu-category-06.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/menu-category-06.avif -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/office-supplies.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/office-supplies.avif -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/busines-industrial.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/busines-industrial.avif -------------------------------------------------------------------------------- /prisma/migrations/migration_lock.toml: -------------------------------------------------------------------------------- 1 | # Please do not edit this file manually 2 | # It should be added in your version-control system (e.g., Git) 3 | provider = "postgresql" -------------------------------------------------------------------------------- /prisma/migrations/20241209082831_init/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "Brand" ( 3 | "id" UUID NOT NULL, 4 | "imagepath" TEXT, 5 | 6 | CONSTRAINT "Brand_pkey" PRIMARY KEY ("id") 7 | ); 8 | -------------------------------------------------------------------------------- /prisma/migrations/20241209090549_init/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "SocilMedia" ( 3 | "id" UUID NOT NULL, 4 | "imagePath" TEXT, 5 | 6 | CONSTRAINT "SocilMedia_pkey" PRIMARY KEY ("id") 7 | ); 8 | -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/handbags-wallets_2572ebaf-29b8-4a8a-a6f9-435f84344f73.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KPRAHUL1/Lumia-Prisma-Backend/HEAD/uploads/Menu bar/Catalog/handbags-wallets_2572ebaf-29b8-4a8a-a6f9-435f84344f73.avif -------------------------------------------------------------------------------- /src/shared/lib/utils/errorObject.ts: -------------------------------------------------------------------------------- 1 | import { Response } from 'express'; 2 | 3 | export const sendErrorObj = (res:Response, code: string, message: string) => { 4 | res.status(500).json({ errorCode: code, errorMessage: message}); 5 | } 6 | -------------------------------------------------------------------------------- /prisma/migrations/20250219163501_init/migration.sql: -------------------------------------------------------------------------------- 1 | -- AlterTable 2 | ALTER TABLE "Category" ADD COLUMN "createdAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP, 3 | ADD COLUMN "deletedAt" TIMESTAMP(3), 4 | ADD COLUMN "updatedAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP; 5 | -------------------------------------------------------------------------------- /prisma/migrations/20250217055219_add_product_attributes/migration.sql: -------------------------------------------------------------------------------- 1 | -- AlterTable 2 | ALTER TABLE "Product" ADD COLUMN "colors" TEXT[], 3 | ADD COLUMN "materials" TEXT[], 4 | ADD COLUMN "sizes" TEXT[], 5 | ADD COLUMN "subscription" BOOLEAN NOT NULL DEFAULT false; 6 | -------------------------------------------------------------------------------- /prisma/migrations/20241209083528_init/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - You are about to drop the column `imagepath` on the `Brand` table. All the data in the column will be lost. 5 | 6 | */ 7 | -- AlterTable 8 | ALTER TABLE "Brand" DROP COLUMN "imagepath", 9 | ADD COLUMN "imagePath" TEXT; 10 | -------------------------------------------------------------------------------- /src/shared/lib/utils/customErrorCode.ts: -------------------------------------------------------------------------------- 1 | export const con_err = 'CON_ERROR'; 2 | export const query_err = 'QUERY_ERROR'; 3 | export const crash_err = 'FUNCTION_ERROR'; 4 | export const login_err = 'INCORRECT_LOGIN'; 5 | export const token_err = 'INVALID_TOKEN'; 6 | export const user_dup = 'USER_DUP'; 7 | export const not_admin = 'NOT_ADMIN'; -------------------------------------------------------------------------------- /prisma/migrations/20250220060538_add_unique_to_product_name/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - A unique constraint covering the columns `[name]` on the table `Product` will be added. If there are existing duplicate values, this will fail. 5 | 6 | */ 7 | -- CreateIndex 8 | CREATE UNIQUE INDEX "Product_name_key" ON "Product"("name"); 9 | -------------------------------------------------------------------------------- /uploads/home-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/modules/brand/brand.service.ts: -------------------------------------------------------------------------------- 1 | import { db } from "../../shared/lib/db"; 2 | 3 | 4 | export async function addBrand(payload: any) { 5 | return await db.brand.create({ 6 | data:{ 7 | name:payload.name, 8 | imageUrl:payload.imageUrl 9 | } 10 | }); 11 | } 12 | 13 | 14 | export async function getAllBrand() { 15 | return await db.brand.findMany({}); 16 | } -------------------------------------------------------------------------------- /src/modules/socilamedia/socialmedia.service.ts: -------------------------------------------------------------------------------- 1 | import { db } from "../../shared/lib/db"; 2 | 3 | 4 | export async function addSocialMedia(payload: any) { 5 | return await db.socialMedia.create({ 6 | data:{ 7 | imagePath:payload.imagePath 8 | } 9 | }); 10 | } 11 | 12 | 13 | export async function getAllSocialMedia() { 14 | return await db.socialMedia.findMany({}); 15 | } -------------------------------------------------------------------------------- /prisma/migrations/20250219081703_new_schema/migration.sql: -------------------------------------------------------------------------------- 1 | -- DropForeignKey 2 | ALTER TABLE "Product" DROP CONSTRAINT "Product_categoryId_fkey"; 3 | 4 | -- AlterTable 5 | ALTER TABLE "Product" ALTER COLUMN "categoryId" DROP NOT NULL; 6 | 7 | -- AddForeignKey 8 | ALTER TABLE "Product" ADD CONSTRAINT "Product_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE SET NULL ON UPDATE CASCADE; 9 | -------------------------------------------------------------------------------- /prisma/migrations/20250108065608_init/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - You are about to drop the `SocilMedia` table. If the table is not empty, all the data it contains will be lost. 5 | 6 | */ 7 | -- DropTable 8 | DROP TABLE "SocilMedia"; 9 | 10 | -- CreateTable 11 | CREATE TABLE "SocialMedia" ( 12 | "id" UUID NOT NULL, 13 | "imagePath" TEXT, 14 | 15 | CONSTRAINT "SocialMedia_pkey" PRIMARY KEY ("id") 16 | ); 17 | -------------------------------------------------------------------------------- /src/shared/lib/db.ts: -------------------------------------------------------------------------------- 1 | import { PrismaClient } from '@prisma/client'; 2 | 3 | declare global { 4 | var cachedPrisma: PrismaClient; 5 | } 6 | 7 | let prisma: PrismaClient; 8 | if (process.env['NODE_ENV'] === 'production') { 9 | prisma = new PrismaClient(); 10 | } else { 11 | if (!global.cachedPrisma) { 12 | global.cachedPrisma = new PrismaClient(); 13 | } 14 | prisma = global.cachedPrisma; 15 | } 16 | 17 | export const db = prisma; 18 | -------------------------------------------------------------------------------- /src/shared/lib/async-context.ts: -------------------------------------------------------------------------------- 1 | // shared/lib/async-context.ts 2 | import { AsyncLocalStorage } from "async_hooks"; 3 | 4 | type Store = { 5 | userId?: string; 6 | email?: string; 7 | }; 8 | 9 | export const asyncLocalStorage = new AsyncLocalStorage(); 10 | 11 | export function setUserContext(userId: string, email: string) { 12 | asyncLocalStorage.enterWith({ userId, email }); 13 | } 14 | 15 | export function getUserContext() { 16 | return asyncLocalStorage.getStore(); 17 | } 18 | -------------------------------------------------------------------------------- /prisma/migrations/20250217060250_add_product_images/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "ProductImage" ( 3 | "id" UUID NOT NULL, 4 | "imageUrl" TEXT NOT NULL, 5 | "productId" UUID NOT NULL, 6 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 7 | 8 | CONSTRAINT "ProductImage_pkey" PRIMARY KEY ("id") 9 | ); 10 | 11 | -- AddForeignKey 12 | ALTER TABLE "ProductImage" ADD CONSTRAINT "ProductImage_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 13 | -------------------------------------------------------------------------------- /src/modules/brand/brand.route.ts: -------------------------------------------------------------------------------- 1 | import { addBrand, getAllBrand } from "./brand.service"; 2 | 3 | const express=require("express") 4 | const router = express.Router(); 5 | 6 | router.post("/", async (req: any, res: any) => { 7 | const payload = req.body; 8 | const result = await addBrand(payload); 9 | res.status(201).json(result); 10 | }); 11 | 12 | router.get("/", async (req: any, res: any) => { 13 | const response = await getAllBrand(); 14 | res.status(200).json(response); 15 | }); 16 | module.exports = router; -------------------------------------------------------------------------------- /uploads/svg-icons/filter-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/shared/lib/models/clientModel.ts: -------------------------------------------------------------------------------- 1 | export type ClientModel = { 2 | id: string; 3 | name: string; 4 | companyName: string; 5 | description?: string; 6 | serviceIds: string[]; 7 | imagePath?: string; 8 | industry?: string; 9 | createdAt?: Date; 10 | updatedAt?: Date; 11 | deletedAt?: Date; 12 | }; 13 | 14 | export type CreateClientModel = Omit< 15 | ClientModel, 16 | "id" | "createdAt" | "updatedAt" | "deletedAt" 17 | >; 18 | 19 | export type UpdateClientModel = Omit< 20 | ClientModel, 21 | "createdAt" | "updatedAt" | "deletedAt" 22 | >; 23 | -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/ChatGPT_files/saved_resource.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/modules/socilamedia/socialmedia.route.ts: -------------------------------------------------------------------------------- 1 | 2 | import { addSocialMedia, getAllSocialMedia } from "./socialmedia.service"; 3 | 4 | const express=require('express') 5 | const router = express.Router(); 6 | 7 | router.post("/", async (req: any, res: any) => { 8 | const payload = req.body; 9 | const result = await addSocialMedia(payload); 10 | res.status(201).json(result); 11 | }); 12 | 13 | router.get("/", async (req: any, res: any) => { 14 | const response = await getAllSocialMedia(); 15 | res.status(200).json(response); 16 | }); 17 | module.exports = router; -------------------------------------------------------------------------------- /src/modules/productImages/productImage.sevice.ts: -------------------------------------------------------------------------------- 1 | // import { db } from "../../shared/lib/db"; 2 | 3 | // // Add Product Image 4 | // export async function addProductImage(payload: any) { 5 | // return await db.productImage.create({ 6 | // data: { 7 | // imageUrl: payload.imageUrl, // Assuming payload has imageUrl and productId 8 | // productId: payload.productId, 9 | // } 10 | // }); 11 | // } 12 | 13 | // // Get All Product Images 14 | // export async function getAllProductImages() { 15 | // return await db.productImage.findMany({}); 16 | // } 17 | -------------------------------------------------------------------------------- /prisma/migrations/20250217140405_update_images_array/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - You are about to drop the column `imageUrl` on the `Product` table. All the data in the column will be lost. 5 | - You are about to drop the `ProductImage` table. If the table is not empty, all the data it contains will be lost. 6 | 7 | */ 8 | -- DropForeignKey 9 | ALTER TABLE "ProductImage" DROP CONSTRAINT "ProductImage_productId_fkey"; 10 | 11 | -- AlterTable 12 | ALTER TABLE "Product" DROP COLUMN "imageUrl", 13 | ADD COLUMN "imageUrls" TEXT[]; 14 | 15 | -- DropTable 16 | DROP TABLE "ProductImage"; 17 | -------------------------------------------------------------------------------- /prisma/migrations/20250320152634_init/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "AssignedSubject" ( 3 | "id" TEXT NOT NULL, 4 | "staffId" TEXT NOT NULL, 5 | "subjectId" TEXT NOT NULL, 6 | 7 | CONSTRAINT "AssignedSubject_pkey" PRIMARY KEY ("id") 8 | ); 9 | 10 | -- AddForeignKey 11 | ALTER TABLE "AssignedSubject" ADD CONSTRAINT "AssignedSubject_staffId_fkey" FOREIGN KEY ("staffId") REFERENCES "Staff"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 12 | 13 | -- AddForeignKey 14 | ALTER TABLE "AssignedSubject" ADD CONSTRAINT "AssignedSubject_subjectId_fkey" FOREIGN KEY ("subjectId") REFERENCES "Subject"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 15 | -------------------------------------------------------------------------------- /src/shared/lib/middleware/auth-context.ts: -------------------------------------------------------------------------------- 1 | // shared/middleware/auth-context.ts 2 | import { asyncLocalStorage } from "../async-context"; 3 | import { Request, Response, NextFunction } from "express"; 4 | 5 | // Middleware to track user context based on incoming request 6 | export function authContextMiddleware(req: Request, res: Response, next: NextFunction) { 7 | const userId = req.headers['x-user-id'] as string || "anonymous"; 8 | const email = req.headers['x-user-email'] as string || "unknown@example.com"; 9 | 10 | // Set the context for the incoming request 11 | asyncLocalStorage.run({ userId, email }, () => { 12 | next(); 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /src/shared/lib/models/userModel.ts: -------------------------------------------------------------------------------- 1 | export type UserModel = { 2 | id: string; 3 | name?: string; 4 | email: string; 5 | image?: string; 6 | password: string; 7 | username: string; 8 | emailVerified?: Date; 9 | phoneNumber: string; 10 | gender: string; 11 | signUpType?: string; 12 | isActive: boolean; 13 | role: string; 14 | createdAt: Date; 15 | deletedAt: Date; 16 | }; 17 | 18 | export type CreateUserModel = Pick -------------------------------------------------------------------------------- /uploads/bars-sort-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bars-sort 5 | 6 | -------------------------------------------------------------------------------- /uploads/mail-letter-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/modules/seasons/season.service.ts: -------------------------------------------------------------------------------- 1 | import { db } from "../../shared/lib/db"; 2 | 3 | 4 | // Function to add a new season 5 | export async function addSeason(payload: any) { 6 | try { 7 | return await db.season.create({ 8 | data: { 9 | name: payload.name, 10 | }, 11 | }); 12 | } catch (error) { 13 | console.error("Error adding season:", error); 14 | throw new Error("Failed to add season"); 15 | } 16 | } 17 | 18 | // Function to get all seasons 19 | export async function getAllSeasons() { 20 | try { 21 | return await db.season.findMany(); 22 | } catch (error) { 23 | console.error("Error fetching seasons:", error); 24 | throw new Error("Failed to fetch seasons"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /uploads/cross-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uploads/svg-icons/return-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 9 | -------------------------------------------------------------------------------- /src/modules/staff/staff.sevice.ts: -------------------------------------------------------------------------------- 1 | import { db } from "../../shared/lib/db"; 2 | 3 | // Create Staff 4 | export async function createStaff(name: string, email: string) { 5 | return await db.staff.create({ data: { name, email } }); 6 | } 7 | 8 | // Get All Staffs 9 | export async function getAllStaffs() { 10 | return await db.staff.findMany({ include: { subjects: true } }); 11 | } 12 | 13 | // Get Staff by ID 14 | export async function getStaffById(id: string) { 15 | return await db.staff.findUnique({ where: { id }, include: { subjects: true } }); 16 | } 17 | 18 | // Update Staff 19 | export async function updateStaff(id: string, name: string) { 20 | return await db.staff.update({ where: { id }, data: { name } }); 21 | } 22 | 23 | // Delete Staff 24 | export async function deleteStaff(id: string) { 25 | return await db.staff.delete({ where: { id } }); 26 | } 27 | -------------------------------------------------------------------------------- /src/modules/subject/subject.sevice.ts: -------------------------------------------------------------------------------- 1 | import { db } from "../../shared/lib/db"; 2 | 3 | // Create Subject 4 | export async function createSubject(name: string) { 5 | return await db.subject.create({ data: { name } }); 6 | } 7 | 8 | // Get All Subjects 9 | export async function getAllSubjects() { 10 | return await db.subject.findMany({ include: { staff: true } }); 11 | } 12 | 13 | // Get Subject by ID 14 | export async function getSubjectById(id: string) { 15 | return await db.subject.findUnique({ where: { id }, include: { staff: true } }); 16 | } 17 | 18 | // Update Subject 19 | export async function updateSubject(id: string, name: string) { 20 | return await db.subject.update({ where: { id }, data: { name } }); 21 | } 22 | 23 | // Delete Subject 24 | export async function deleteSubject(id: string) { 25 | return await db.subject.delete({ where: { id } }); 26 | } 27 | -------------------------------------------------------------------------------- /uploads/menu-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /prisma/migrations/20250108065243_add_season_model/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - Added the required column `updatedAt` to the `Product` table without a default value. This is not possible if the table is not empty. 5 | 6 | */ 7 | -- AlterTable 8 | ALTER TABLE "Product" ADD COLUMN "seasonId" UUID, 9 | ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL; 10 | 11 | -- CreateTable 12 | CREATE TABLE "Season" ( 13 | "id" UUID NOT NULL, 14 | "name" TEXT NOT NULL, 15 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 16 | "updatedAt" TIMESTAMP(3) NOT NULL, 17 | 18 | CONSTRAINT "Season_pkey" PRIMARY KEY ("id") 19 | ); 20 | 21 | -- CreateIndex 22 | CREATE UNIQUE INDEX "Season_name_key" ON "Season"("name"); 23 | 24 | -- AddForeignKey 25 | ALTER TABLE "Product" ADD CONSTRAINT "Product_seasonId_fkey" FOREIGN KEY ("seasonId") REFERENCES "Season"("id") ON DELETE SET NULL ON UPDATE CASCADE; 26 | -------------------------------------------------------------------------------- /uploads/loupe-search-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/modules/staff/staff.route.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { createStaff, getAllStaffs, getStaffById, updateStaff, deleteStaff } from "./staff.sevice"; 3 | 4 | const router = Router(); 5 | 6 | router.post("/", async (req, res) => { 7 | const { name, email } = req.body; 8 | const staff = await createStaff(name, email); 9 | res.json(staff); 10 | }); 11 | 12 | router.get("/", async (req, res) => { 13 | const staffs = await getAllStaffs(); 14 | res.json(staffs); 15 | }); 16 | 17 | router.get("/:id", async (req, res) => { 18 | const staff = await getStaffById(req.params.id); 19 | res.json(staff); 20 | }); 21 | 22 | router.put("/:id", async (req, res) => { 23 | const staff = await updateStaff(req.params.id, req.body.name); 24 | res.json(staff); 25 | }); 26 | 27 | router.delete("/:id", async (req, res) => { 28 | const staff = await deleteStaff(req.params.id); 29 | res.json({ message: "Staff deleted", staff }); 30 | }); 31 | 32 | module.exports = router; 33 | -------------------------------------------------------------------------------- /prisma/migrations/20250320151524_init/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "Staff" ( 3 | "id" TEXT NOT NULL, 4 | "name" TEXT NOT NULL, 5 | "email" TEXT NOT NULL, 6 | "phone" TEXT, 7 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 8 | "updatedAt" TIMESTAMP(3) NOT NULL, 9 | 10 | CONSTRAINT "Staff_pkey" PRIMARY KEY ("id") 11 | ); 12 | 13 | -- CreateTable 14 | CREATE TABLE "Subject" ( 15 | "id" TEXT NOT NULL, 16 | "name" TEXT NOT NULL, 17 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 18 | "staffId" TEXT, 19 | 20 | CONSTRAINT "Subject_pkey" PRIMARY KEY ("id") 21 | ); 22 | 23 | -- CreateIndex 24 | CREATE UNIQUE INDEX "Staff_email_key" ON "Staff"("email"); 25 | 26 | -- CreateIndex 27 | CREATE UNIQUE INDEX "Subject_name_key" ON "Subject"("name"); 28 | 29 | -- AddForeignKey 30 | ALTER TABLE "Subject" ADD CONSTRAINT "Subject_staffId_fkey" FOREIGN KEY ("staffId") REFERENCES "Staff"("id") ON DELETE SET NULL ON UPDATE CASCADE; 31 | -------------------------------------------------------------------------------- /src/modules/productImages/productImage.route.ts: -------------------------------------------------------------------------------- 1 | // import { addProductImage, getAllProductImages } from "./productImage.sevice"; 2 | 3 | // const express = require('express'); 4 | // const router = express.Router(); 5 | 6 | // // Route to add a new product image 7 | // router.post("/", async (req: any, res: any) => { 8 | // const payload = req.body; 9 | // try { 10 | // const result = await addProductImage(payload); 11 | // res.status(201).json(result); 12 | // } catch (error) { 13 | // res.status(500).json({ error: 'Failed to add product image' }); 14 | // } 15 | // }); 16 | 17 | // // Route to get all product images 18 | // router.get("/", async (req: any, res: any) => { 19 | // try { 20 | // const response = await getAllProductImages(); 21 | // res.status(200).json(response); 22 | // } catch (error) { 23 | // res.status(500).json({ error: 'Failed to fetch product images' }); 24 | // } 25 | // }); 26 | 27 | // module.exports = router; 28 | -------------------------------------------------------------------------------- /src/modules/subject/subject.route.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "express"; 2 | import { createSubject, getAllSubjects, getSubjectById, updateSubject, deleteSubject } from "./subject.sevice"; 3 | 4 | const router = Router(); 5 | 6 | router.post("/", async (req, res) => { 7 | const { name } = req.body; 8 | const subject = await createSubject(name); 9 | res.json(subject); 10 | }); 11 | 12 | router.get("/", async (req, res) => { 13 | const subjects = await getAllSubjects(); 14 | res.json(subjects); 15 | }); 16 | 17 | router.get("/:id", async (req, res) => { 18 | const subject = await getSubjectById(req.params.id); 19 | res.json(subject); 20 | }); 21 | 22 | router.put("/:id", async (req, res) => { 23 | const subject = await updateSubject(req.params.id, req.body.name); 24 | res.json(subject); 25 | }); 26 | 27 | router.delete("/:id", async (req, res) => { 28 | const subject = await deleteSubject(req.params.id); 29 | res.json({ message: "Subject deleted", subject }); 30 | }); 31 | 32 | module.exports = router; 33 | -------------------------------------------------------------------------------- /uploads/Menu bar/Catalog/ChatGPT_files/index-small-c8xg50op.css: -------------------------------------------------------------------------------- 1 | ._prosemirror-parent_kgrdp_1 .ProseMirror[contenteditable]{outline:2px solid transparent;outline-offset:2px;outline-width:0}._prosemirror-parent_kgrdp_1 .ProseMirror{word-wrap:break-word;font-feature-settings:"liga" 0,none;font-variant-ligatures:none;padding:.5rem 0;white-space:pre-wrap;white-space:break-spaces}._prosemirror-parent_kgrdp_1.ProseMirror br{line-height:normal}._prosemirror-parent_kgrdp_1.default-browser .placeholder:after{--tw-content:attr(data-placeholder);color:var(--text-secondary);content:var(--tw-content);cursor:text;pointer-events:none;position:relative}._prosemirror-parent_kgrdp_1.default-browser .placeholder .ProseMirror-trailingBreak{display:none!important}._prosemirror-parent_kgrdp_1.firefox .placeholder:before{--tw-content:attr(data-placeholder);color:var(--text-secondary);content:var(--tw-content);cursor:text;pointer-events:none;position:absolute}._prosemirror-parent_kgrdp_1 p{white-space:pre-wrap}._prosemirror-parent_kgrdp_1 .ProseMirror-separator{display:none!important} 2 | -------------------------------------------------------------------------------- /uploads/heart-like-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Lumia", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "src/app.ts", 6 | "scripts": { 7 | "build": "npx tsc", 8 | "start": "node dist/app.js", 9 | "dev": "nodemon src/app.ts" 10 | }, 11 | "keywords": [], 12 | "author": "Lumia", 13 | "license": "ISC", 14 | "devDependencies": { 15 | "@types/bcrypt": "^5.0.2", 16 | "@types/express": "^5.0.0", 17 | "@types/jsonwebtoken": "^9.0.7", 18 | "@types/multer": "^1.4.12", 19 | "@types/node": "^22.10.1", 20 | "@types/pg": "^8.15.2", 21 | "@types/sequelize": "^4.28.20", 22 | "prisma": "^6.4.0", 23 | "ts-node": "^10.9.2", 24 | "ts-node-dev": "^2.0.0", 25 | "typescript": "^5.7.3" 26 | }, 27 | "dependencies": { 28 | "@prisma/client": "^6.4.0", 29 | "axios": "^1.7.9", 30 | "bcrypt": "^5.1.1", 31 | "dotenv": "^16.4.7", 32 | "express": "^4.21.2", 33 | "jsonwebtoken": "^9.0.2", 34 | "multer": "^1.4.5-lts.1", 35 | "nodemon": "^3.1.7", 36 | "pg": "^8.16.0", 37 | "sequelize": "^6.37.7" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /uploads/phone-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/shared/lib/utils/fileUpload.ts: -------------------------------------------------------------------------------- 1 | import multer from "multer"; 2 | import path from "path"; 3 | import { Request } from "express"; 4 | 5 | const maxSize = 2 * 1024 * 1024; 6 | 7 | const storage = multer.diskStorage({ 8 | destination: (req, file, cb) => { 9 | cb(null, 'uploads/'); 10 | }, 11 | filename: (req: Request, file, cb) => { 12 | const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9); 13 | const filePath = file.fieldname + '-' + uniqueSuffix + path.extname(file.originalname); 14 | cb(null, filePath); 15 | } 16 | }); 17 | 18 | const uploadFile = (fieldName: string) => { 19 | return multer({ storage: storage, limits: { fileSize: maxSize } }).single(fieldName); 20 | }; 21 | 22 | const uploadFileMiddleware = (req: Request, res: any, fieldName: string) => { 23 | return new Promise((resolve, reject) => { 24 | const upload = uploadFile(fieldName); 25 | upload(req, res, (err) => { 26 | if (err) { 27 | reject(err); 28 | } else { 29 | resolve(req.file?.path); 30 | } 31 | }); 32 | }); 33 | }; 34 | 35 | export { uploadFileMiddleware }; -------------------------------------------------------------------------------- /uploads/user-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /prisma/migrations/20250320153609_init/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - You are about to drop the `AssignedSubject` table. If the table is not empty, all the data it contains will be lost. 5 | 6 | */ 7 | -- DropForeignKey 8 | ALTER TABLE "AssignedSubject" DROP CONSTRAINT "AssignedSubject_staffId_fkey"; 9 | 10 | -- DropForeignKey 11 | ALTER TABLE "AssignedSubject" DROP CONSTRAINT "AssignedSubject_subjectId_fkey"; 12 | 13 | -- DropTable 14 | DROP TABLE "AssignedSubject"; 15 | 16 | -- CreateTable 17 | CREATE TABLE "SubjectAssignment" ( 18 | "id" TEXT NOT NULL, 19 | "staffId" TEXT NOT NULL, 20 | "subjectId" TEXT NOT NULL, 21 | 22 | CONSTRAINT "SubjectAssignment_pkey" PRIMARY KEY ("id") 23 | ); 24 | 25 | -- CreateIndex 26 | CREATE UNIQUE INDEX "SubjectAssignment_staffId_subjectId_key" ON "SubjectAssignment"("staffId", "subjectId"); 27 | 28 | -- AddForeignKey 29 | ALTER TABLE "SubjectAssignment" ADD CONSTRAINT "SubjectAssignment_staffId_fkey" FOREIGN KEY ("staffId") REFERENCES "Staff"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 30 | 31 | -- AddForeignKey 32 | ALTER TABLE "SubjectAssignment" ADD CONSTRAINT "SubjectAssignment_subjectId_fkey" FOREIGN KEY ("subjectId") REFERENCES "Subject"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 33 | -------------------------------------------------------------------------------- /src/modules/product/product.route.ts: -------------------------------------------------------------------------------- 1 | import { addProduct, getAllProduct ,getProductById} from "./product.service"; 2 | const express = require("express"); 3 | const router = express.Router(); 4 | 5 | // POST route to create a product 6 | router.post("/", async (req: any, res: any) => { 7 | const payload = req.body; 8 | const result = await addProduct(payload); 9 | res.status(201).json(result); 10 | }); 11 | 12 | router.get("/", async (req: any, res: any) => { 13 | const response = await getAllProduct(); 14 | res.status(200).json(response); 15 | }); 16 | router.get("/:id", async (req: any, res: any) => { 17 | const id = req.params.id; 18 | const response = await getProductById(id); 19 | res.status(200).json(response); 20 | }); 21 | 22 | // router.put("/:id", async (req: any, res: any) => { 23 | // const id = req.params.id; 24 | // const payload = req.body; 25 | // const result = await up(id, payload); 26 | // res.status(200).json(result); 27 | // }); 28 | 29 | // router.delete("/:id", async (req: any, res: any) => { 30 | // const id = req.params.id; 31 | // await deleteServicesById(id); 32 | // res.status(200).json("Deleted successfully"); 33 | // }); 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | module.exports = router; 44 | -------------------------------------------------------------------------------- /src/modules/category/category.service.ts: -------------------------------------------------------------------------------- 1 | import { db } from "../../shared/lib/db"; 2 | 3 | 4 | export async function addCategory(payload: any) { 5 | return await db.category.create({ 6 | data: { 7 | name: payload.name, 8 | description: payload.description, 9 | imagePath:payload.imagePath 10 | }, 11 | }); 12 | } 13 | 14 | 15 | export async function getAllCategory() { 16 | return await db.category.findMany({}); 17 | } 18 | 19 | 20 | export async function updateCategory(id: string, payload: any) { 21 | return await db.category.update({ 22 | where: { id:id }, 23 | data: { 24 | name: payload.name, 25 | description: payload.description, 26 | imagePath: payload.imagePath, 27 | }, 28 | }); 29 | } 30 | 31 | 32 | export async function deleteAllCategories(id: any) { 33 | return await db.category.deleteMany(); 34 | } 35 | 36 | export async function getCategoryById(id: string) { 37 | return await db.category.findFirst({ 38 | where: { 39 | id: id, // Ensure the ID is correct 40 | }, 41 | include: { 42 | products: true, // Assuming 'products' relation exists 43 | } 44 | }); 45 | } 46 | -------------------------------------------------------------------------------- /src/modules/services/services.route.ts: -------------------------------------------------------------------------------- 1 | // import { 2 | // addServices, 3 | // getAllServices, 4 | // updateServices, 5 | // deleteServicesById, 6 | // getServiceById, 7 | // } from "../services/services.service"; 8 | 9 | // const express = require("express"); 10 | // const router = express.Router(); 11 | 12 | // router.post("/", async (req: any, res: any) => { 13 | // const payload = req.body; 14 | // const result = await addServices(payload); 15 | // res.status(201).json(result); 16 | // }); 17 | 18 | // router.get("/", async (req: any, res: any) => { 19 | // const response = await getAllServices(); 20 | // res.status(200).json(response); 21 | // }); 22 | // router.get("/:id", async (req: any, res: any) => { 23 | // const id = req.params.id; 24 | // const response = await getServiceById(id); 25 | // res.status(200).json(response); 26 | // }); 27 | 28 | // router.put("/:id", async (req: any, res: any) => { 29 | // const id = req.params.id; 30 | // const payload = req.body; 31 | // const result = await updateServices(id, payload); 32 | // res.status(200).json(result); 33 | // }); 34 | 35 | // router.delete("/:id", async (req: any, res: any) => { 36 | // const id = req.params.id; 37 | // await deleteServicesById(id); 38 | // res.status(200).json("Deleted successfully"); 39 | // }); 40 | // module.exports = router; 41 | -------------------------------------------------------------------------------- /src/modules/seasons/season.route.ts: -------------------------------------------------------------------------------- 1 | import { addSeason, getAllSeasons } from "./season.service"; 2 | import { Request, Response } from "express"; // Import types for better type safety 3 | 4 | const express = require('express'); 5 | const router = express.Router(); 6 | 7 | // POST route to create a season 8 | router.post("/", async (req: Request, res: Response) => { 9 | const payload = req.body; 10 | 11 | // Optional: Validate that the name of the season is provided 12 | if (!payload.name) { 13 | return res.status(400).json({ error: "Season name is required" }); 14 | } 15 | 16 | try { 17 | const result = await addSeason(payload); // Call addSeason function 18 | res.status(201).json(result); // Return the created season as a response 19 | } catch (error) { 20 | console.error("Error creating season:", error); 21 | res.status(500).json({ error: "Internal server error" }); 22 | } 23 | }); 24 | 25 | // GET route to fetch all seasons 26 | router.get("/", async (req: Request, res: Response) => { 27 | try { 28 | const response = await getAllSeasons(); // Call getAllSeasons function 29 | res.status(200).json(response); // Return all seasons as a response 30 | } catch (error) { 31 | console.error("Error fetching seasons:", error); 32 | res.status(500).json({ error: "Internal server error" }); 33 | } 34 | }); 35 | 36 | module.exports = router; 37 | -------------------------------------------------------------------------------- /src/modules/assignSubject/assignSubject.service.ts: -------------------------------------------------------------------------------- 1 | import { db } from "../../shared/lib/db"; 2 | 3 | // Create Subject 4 | export async function createSubject(name: string) { 5 | return await db.subject.create({ data: { name } }); 6 | } 7 | 8 | // Get All Subjects 9 | export async function getAllSubjects() { 10 | return await db.subject.findMany({ include: { staff: true } }); 11 | } 12 | 13 | // Get Subject by ID 14 | export async function getSubjectById(id: string) { 15 | return await db.subject.findUnique({ where: { id }, include: { staff: true } }); 16 | } 17 | 18 | // Update Subject 19 | export async function updateSubject(id: string, name: string) { 20 | return await db.subject.update({ where: { id }, data: { name } }); 21 | } 22 | 23 | // Delete Subject 24 | export async function deleteSubject(id: string) { 25 | return await db.subject.delete({ where: { id } }); 26 | } 27 | 28 | // Assign Subject to Staff 29 | export async function assignSubjectToStaff(staffId: string, subjectId: string) { 30 | // Check if the assignment already exists 31 | const existingAssignment = await db.subjectAssignment.findFirst({ 32 | where: { staffId, subjectId }, 33 | }); 34 | 35 | if (existingAssignment) { 36 | throw new Error("Subject already assigned to staff."); 37 | } 38 | 39 | // Create new assignment 40 | return await db.subjectAssignment.create({ data: { staffId, subjectId } }); 41 | } 42 | -------------------------------------------------------------------------------- /src/modules/services/serviceHighlights/serviceHighlights.route.ts: -------------------------------------------------------------------------------- 1 | // import { addServiceHighlights, getAllServiceHighlights, updateServiceHighlights, deleteServiceHighlightsById, getServiceHighlightsById } from "./serviceHighlights.service"; 2 | 3 | 4 | // const express = require('express'); 5 | // const router = express.Router(); 6 | 7 | 8 | // router.post('/', async (req:any, res: any) => { 9 | // const payload= req.body; 10 | // const result = await addServiceHighlights(payload); 11 | // res.status(201).json(result) 12 | // }) 13 | 14 | // router.get('/',async (req:any,res:any)=>{ 15 | // const serviceId = req.params.serviceId; 16 | // const response= await getAllServiceHighlights(serviceId); 17 | // res.status(200).json(response) 18 | // }) 19 | // router.get("/:id", async (req: any, res: any) => { 20 | // const id = req.params.id; 21 | // const response = await getServiceHighlightsById(id); 22 | // res.status(200).json(response); 23 | // }); 24 | // router.put('/:id',async(req:any, res: any) => { 25 | // const id =req.params.id 26 | // const payload= req.body; 27 | // const result = await updateServiceHighlights(id,payload); 28 | // res.status(200).json(result) 29 | // }) 30 | 31 | // router.delete('/:id', async(req:any, res:any)=>{ 32 | // const id =req.params.id 33 | // await deleteServiceHighlightsById(id) 34 | // res.status(200).json("Deleted successfully") 35 | // }) 36 | // module.exports = router; 37 | -------------------------------------------------------------------------------- /uploads/delivery-truck-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 14 | 15 | -------------------------------------------------------------------------------- /src/modules/services/serviceFeatutures/serviceFeature.route.ts: -------------------------------------------------------------------------------- 1 | // import { addServiceFeature, getAllServiceFeature, updateServiceFeature, deleteServiceFeatureById, getServiceFeatureById } from "./serviceFeature.service"; 2 | 3 | 4 | // const express = require('express'); 5 | // const router = express.Router(); 6 | 7 | 8 | // router.post('/', async (req:any, res: any) => { 9 | // const payload= req.body; 10 | // const result = await addServiceFeature(payload); 11 | // res.status(201).json(result) 12 | // }) 13 | 14 | // router.get('/',async (req:any,res:any)=>{ 15 | // const serviceId = req.params.serviceId; 16 | // console.log(req.params.id) 17 | // const response= await getAllServiceFeature(serviceId); 18 | // res.status(200).json(response) 19 | // }) 20 | // router.get("/:id", async (req: any, res: any) => { 21 | // const id = req.params.id || req.query.id; 22 | // const response = await getServiceFeatureById(id); 23 | // res.status(200).json(response); 24 | // }); 25 | // router.put('/:id',async(req:any, res: any) => { 26 | // const id =req.params.id 27 | // const payload= req.body; 28 | // const result = await updateServiceFeature(id,payload); 29 | // res.status(200).json(result) 30 | // }) 31 | 32 | // router.delete('/:id', async(req:any, res:any)=>{ 33 | // const id =req.params.id 34 | // console.log(req.params) 35 | // await deleteServiceFeatureById(id) 36 | // res.status(200).json("Deleted successfully") 37 | // }) 38 | // module.exports = router; 39 | -------------------------------------------------------------------------------- /src/modules/auth/auth.route.ts: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | import { userLogin, userSignUp, changeUserPassword } from "./auth.service"; 3 | import { db } from "../../shared/lib/db"; 4 | import { getUserContext } from "../../shared/lib/async-context"; 5 | const router = express.Router(); 6 | 7 | router.post("/register", async (req, res) => { 8 | const payload = req.body; 9 | const user = await userSignUp(payload); 10 | res.status(201).json({ message: "User registered successfully", user }); 11 | }); 12 | 13 | router.post("/login", async (req, res) => { 14 | const { email, password } = req.body; 15 | 16 | try { 17 | const user = await userLogin(email, password); 18 | res.status(200).json({ message: "Login successful", user }); 19 | } catch (error) { 20 | res.status(400).json({ message: "error.message" }); 21 | } 22 | }); 23 | 24 | router.put("/change-password", async (req, res) => { 25 | const { email, currentPassword, newPassword } = req.body; 26 | await changeUserPassword(email, currentPassword, newPassword); 27 | res.status(200).json({ message: "Password changed successfully" }); 28 | }); 29 | 30 | router.get("/users", async (req, res) => { 31 | const users = await db.user.findMany({ 32 | select: { 33 | id: true, 34 | name: true, 35 | email: true, 36 | username: true, 37 | password: true, 38 | phoneNumber: true, 39 | image: true, 40 | role: true, 41 | }, 42 | }); 43 | res.status(200).json(users); 44 | }); 45 | 46 | module.exports = router; 47 | -------------------------------------------------------------------------------- /prisma/migrations/20250215052929_init/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - You are about to drop the column `imagePath` on the `Brand` table. All the data in the column will be lost. 5 | - You are about to drop the column `imagePath` on the `Category` table. All the data in the column will be lost. 6 | - A unique constraint covering the columns `[name]` on the table `Brand` will be added. If there are existing duplicate values, this will fail. 7 | - A unique constraint covering the columns `[name]` on the table `Category` will be added. If there are existing duplicate values, this will fail. 8 | - Added the required column `name` to the `Brand` table without a default value. This is not possible if the table is not empty. 9 | 10 | */ 11 | -- AlterTable 12 | ALTER TABLE "Brand" DROP COLUMN "imagePath", 13 | ADD COLUMN "imageUrl" TEXT, 14 | ADD COLUMN "name" TEXT NOT NULL; 15 | 16 | -- AlterTable 17 | ALTER TABLE "Category" DROP COLUMN "imagePath", 18 | ADD COLUMN "imageUrl" TEXT; 19 | 20 | -- AlterTable 21 | ALTER TABLE "Product" ADD COLUMN "brandId" UUID, 22 | ALTER COLUMN "imageUrl" DROP NOT NULL; 23 | 24 | -- AlterTable 25 | ALTER TABLE "SocialMedia" ADD COLUMN "name" TEXT NOT NULL DEFAULT 'Default Name'; 26 | 27 | -- CreateIndex 28 | CREATE UNIQUE INDEX "Brand_name_key" ON "Brand"("name"); 29 | 30 | -- CreateIndex 31 | CREATE UNIQUE INDEX "Category_name_key" ON "Category"("name"); 32 | 33 | -- AddForeignKey 34 | ALTER TABLE "Product" ADD CONSTRAINT "Product_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "Brand"("id") ON DELETE SET NULL ON UPDATE CASCADE; 35 | -------------------------------------------------------------------------------- /uploads/svg-icons/support-technology-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 14 | 16 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/shared/lib/utils/jwt.ts: -------------------------------------------------------------------------------- 1 | import jwt from 'jsonwebtoken'; 2 | import dotenv from "dotenv"; 3 | import { sendErrorObj } from './errorObject'; 4 | import { Response } from 'express'; 5 | import { token_err } from './customErrorCode'; 6 | import { JwtPayload } from '../models/jwtModel'; 7 | 8 | dotenv.config(); 9 | 10 | export const generateJwtToken = (payload: JwtPayload): string => { 11 | 12 | const secretKey = process.env.JWT_SECRET_KEY || "Lumia_2024_by_lumia@2024" 13 | const options = { 14 | expiresIn: '10h', 15 | }; 16 | 17 | return jwt.sign(payload, secretKey, options); 18 | }; 19 | 20 | export const authenticateToken = (req: any, res: Response, next: any) => { 21 | const authHeader = req.headers.authorization?req.headers.authorization: req.query.token; 22 | if (!authHeader) { 23 | sendErrorObj(res, token_err, "Token Not Found!"); 24 | } else { 25 | const token = authHeader && authHeader.split(" ")[1]; 26 | if (token == null) { 27 | sendErrorObj(res, token_err, "Token Not Found!"); 28 | } else { 29 | jwt.verify(token, process.env.JWT_SECRET_KEY||"Lumia_2024_by_lumia@2024", (err:any, user: any) => { 30 | if (err) { 31 | sendErrorObj(res, token_err, err); 32 | } 33 | req.user = user; 34 | if(Date.now() >= user.exp * 1000) 35 | { 36 | sendErrorObj(res, 'TOKEN_EXP', "Token Expired!"); 37 | } 38 | else{ 39 | next(); 40 | } 41 | }); 42 | } 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/modules/product/product.service.ts: -------------------------------------------------------------------------------- 1 | import { db } from "../../shared/lib/db"; 2 | 3 | // Add a new product 4 | export async function addProduct(payload: any) { 5 | console.log("Received payload:", payload); 6 | 7 | const productData = { 8 | name: payload.name, 9 | description: payload.description, 10 | price: parseFloat(payload.price), 11 | stock: parseInt(payload.stock, 10), 12 | imageUrls: payload.imageUrls || [], 13 | categoryId: payload.categoryId, 14 | seasonId: payload.seasonId || null, 15 | brandId: payload.brandId || null, 16 | subscription: payload.subscription || false, 17 | colors: payload.colors || [], 18 | materials: payload.materials || [], 19 | sizes: payload.sizes || [], 20 | }; 21 | 22 | try { 23 | return await db.product.create({ data: productData }); 24 | } catch (error) { 25 | console.error("Error creating product:", error); 26 | throw error; 27 | } 28 | } 29 | 30 | // Fetch all products with an optional filter 31 | export async function getAllProduct(filter: any = {}) { 32 | try { 33 | return await db.product.findMany({ 34 | where: filter, 35 | include: { 36 | category: true, 37 | season: true, 38 | brand: true, 39 | reviews:true, 40 | orderItems:true 41 | }, 42 | }); 43 | } catch (error) { 44 | console.error("Error fetching products:", error); 45 | throw error; 46 | } 47 | } 48 | 49 | export async function getProductById(id: string) { 50 | 51 | return db.product.findFirst({ 52 | where: { 53 | id: id, 54 | }, 55 | include:{ 56 | category:true, 57 | brand:true, 58 | season:true 59 | } 60 | }); 61 | } 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /src/modules/services/serviceHighlights/serviceHighlights.service.ts: -------------------------------------------------------------------------------- 1 | // import { db } from "../../../shared/lib/db" 2 | 3 | 4 | // export async function addServiceHighlights(payload : any){ 5 | // return await db.serviceHighlights.create({ 6 | // data: { 7 | // name: payload.name, 8 | // icon: payload.icon, 9 | // description: payload.description, 10 | // imagePath: payload.imagePath, 11 | // order:payload.order, 12 | // serviceId:payload.serviceId, 13 | // isActive:payload.isActive, 14 | // } 15 | // }) 16 | // } 17 | // export async function getAllServiceHighlights(serviceId:string){ 18 | // return await db.serviceHighlights.findMany({ 19 | // where:{ 20 | // serviceId:serviceId, 21 | // deletedAt:null 22 | // } 23 | // }) 24 | // } 25 | // export async function getServiceHighlightsById(id: string) { 26 | 27 | // return db.serviceHighlights.findFirst({ 28 | // where: { 29 | // id: id, 30 | // deletedAt:null 31 | // }, 32 | // }); 33 | // } 34 | // export async function updateServiceHighlights(id : string, payload : any){ 35 | // return db.serviceHighlights.update({ 36 | // where: { 37 | // id: id, 38 | // }, 39 | // data: { 40 | // name: payload.name, 41 | // icon: payload.icon, 42 | // description: payload.description, 43 | // imagePath: payload.imagePath, 44 | // order:payload.order, 45 | // isActive:payload.isActive, 46 | // serviceId:payload.serviceId, 47 | // updatedAt: new Date() 48 | // } 49 | // }) 50 | // } 51 | // export async function deleteServiceHighlightsById(id: string){ 52 | // return db.serviceHighlights.delete({ 53 | // where: { 54 | // id: id, 55 | // }, 56 | // }) 57 | // } 58 | -------------------------------------------------------------------------------- /src/modules/category/category.route.ts: -------------------------------------------------------------------------------- 1 | import { addCategory, deleteAllCategories, getAllCategory, getCategoryById, updateCategory } from "./category.service"; 2 | 3 | const express = require("express"); 4 | const router = express.Router(); 5 | 6 | // POST route to create a category 7 | router.post("/", async (req:any, res:any) => { 8 | try { 9 | const result = await addCategory(req.body); 10 | res.status(201).json(result); 11 | } catch (error) { 12 | console.error("Error creating category:", error); 13 | res.status(500).json({ error: "Internal server error" }); 14 | } 15 | }); 16 | 17 | // GET route to fetch all categories 18 | router.get("/", async (req:any, res:any) => { 19 | try { 20 | const categories = await getAllCategory(); 21 | res.status(200).json(categories); 22 | } catch (error) { 23 | console.error("Error fetching categories:", error); 24 | res.status(500).json({ error: "Internal server error" }); 25 | } 26 | }); 27 | 28 | // PUT route to update a category by ID 29 | router.put("/:id", async (req:any, res:any) => { 30 | try { 31 | const result = await updateCategory(req.params.id, req.body); 32 | res.status(200).json(result); 33 | } catch (error) { 34 | console.error("Error updating category:", error); 35 | res.status(500).json({ error: "Internal server error" }); 36 | } 37 | }); 38 | 39 | // DELETE route to delete a category by ID 40 | router.delete("/:id", async (req:any, res:any) => { 41 | try { 42 | await deleteAllCategories(req.params.id); 43 | res.status(200).json({ message: "Deleted successfully" }); 44 | } catch (error) { 45 | console.error("Error deleting category:", error); 46 | res.status(500).json({ error: "Internal server error" }); 47 | } 48 | }); 49 | router.get("/:id", async (req: any, res: any) => { 50 | const id = req.params.id; 51 | const response = await getCategoryById(id); 52 | res.status(200).json(response); 53 | }); 54 | module.exports = router; 55 | 56 | -------------------------------------------------------------------------------- /src/modules/services/serviceFeatutures/serviceFeature.service.ts: -------------------------------------------------------------------------------- 1 | // import { db } from "../../../shared/lib/db" 2 | 3 | 4 | // export async function addServiceFeature(payload : any){ 5 | // return await db.serviceFeatures.create({ 6 | // data: { 7 | // title:payload.title, 8 | // description:payload.description, 9 | // imagePath:payload.imagePath, 10 | // icon:payload.icon, 11 | // isFeatured:payload.isFeatured, 12 | // order:payload.order, 13 | // serviceId:payload.serviceId, 14 | // isActive:payload.isActive, 15 | // } 16 | // }) 17 | // } 18 | 19 | // export async function getAllServiceFeature(serviceId:string){ 20 | // console.log(serviceId,'server') 21 | // return await db.serviceFeatures.findMany({ 22 | // where:{ 23 | // serviceId:serviceId, 24 | // deletedAt:null 25 | // } 26 | // }) 27 | // } 28 | // export async function getServiceFeatureById(id: string) { 29 | 30 | // return db.serviceFeatures.findFirst({ 31 | // where: { 32 | // id: id, 33 | // deletedAt:null 34 | // }, 35 | // }); 36 | // } 37 | // export async function updateServiceFeature(id : string, payload : any){ 38 | // return db.serviceFeatures.update({ 39 | // where: { 40 | // id: id, 41 | // }, 42 | // data: { 43 | // title:payload.title, 44 | // description:payload.description, 45 | // imagePath:payload.imagePath, 46 | // icon:payload.icon, 47 | // isFeatured:payload.isFeatured, 48 | // order:payload.order, 49 | // isActive:payload.isActive, 50 | // serviceId:payload.serviceId, 51 | // updatedAt: new Date() 52 | // } 53 | // }) 54 | // } 55 | // export async function deleteServiceFeatureById(id: string){ 56 | // return db.serviceFeatures.delete({ 57 | // where: { 58 | // id: id, 59 | // } 60 | // }) 61 | // } 62 | -------------------------------------------------------------------------------- /uploads/svg-icons/leaf-fluttering-in-wind-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /prisma/migrations/20250307102057_fix_userrole_default/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - The `role` column on the `User` table would be dropped and recreated. This will lead to data loss if there is data in the column. 5 | - A unique constraint covering the columns `[userId]` on the table `Cart` will be added. If there are existing duplicate values, this will fail. 6 | - A unique constraint covering the columns `[username]` on the table `User` will be added. If there are existing duplicate values, this will fail. 7 | - Added the required column `updatedAt` to the `User` table without a default value. This is not possible if the table is not empty. 8 | 9 | */ 10 | -- CreateEnum 11 | CREATE TYPE "UserRole" AS ENUM ('Admin', 'TeachingStaff', 'NonTeachingStaff', 'Student', 'User', 'OfficeAdmin', 'HM', 'AHM'); 12 | 13 | -- AlterTable 14 | ALTER TABLE "User" ADD COLUMN "emailVerified" TIMESTAMP(3), 15 | ADD COLUMN "image" TEXT, 16 | ADD COLUMN "phoneNumber" TEXT, 17 | ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL, 18 | ADD COLUMN "username" TEXT, 19 | ALTER COLUMN "name" DROP NOT NULL, 20 | DROP COLUMN "role", 21 | ADD COLUMN "role" "UserRole" NOT NULL DEFAULT 'User'; 22 | 23 | -- CreateTable 24 | CREATE TABLE "Account" ( 25 | "_id" UUID NOT NULL, 26 | "userId" UUID NOT NULL, 27 | "provider" TEXT NOT NULL, 28 | "providerAccountId" TEXT NOT NULL, 29 | "access_token" TEXT, 30 | "refresh_token" TEXT, 31 | "expires_at" INTEGER, 32 | "token_type" TEXT, 33 | "scope" TEXT, 34 | "id_token" TEXT, 35 | "session_state" TEXT, 36 | 37 | CONSTRAINT "Account_pkey" PRIMARY KEY ("_id") 38 | ); 39 | 40 | -- CreateIndex 41 | CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId"); 42 | 43 | -- CreateIndex 44 | CREATE UNIQUE INDEX "Cart_userId_key" ON "Cart"("userId"); 45 | 46 | -- CreateIndex 47 | CREATE UNIQUE INDEX "User_username_key" ON "User"("username"); 48 | 49 | -- AddForeignKey 50 | ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE RESTRICT ON UPDATE CASCADE; 51 | -------------------------------------------------------------------------------- /src/modules/services/services.service.ts: -------------------------------------------------------------------------------- 1 | // import { db } from "../../shared/lib/db" 2 | 3 | 4 | // export async function addServices(payload : any){ 5 | // return await db.services.create({ 6 | // data: { 7 | // title:payload.title, 8 | // shortNote:payload.shortNote, 9 | // description:payload.description, 10 | // icon:payload.icon, 11 | // order:parseInt(payload.order), 12 | // isActive:payload.isActive, 13 | // featuredImagePath: payload.featuredImagePath, 14 | // } 15 | // }) 16 | // } 17 | 18 | // export async function getAllServices(){ 19 | // return await db.services.findMany({ 20 | // where:{ 21 | // deletedAt:null 22 | // }, 23 | // include:{ 24 | // serviceFeatures:true, 25 | // serviceHighlights:true, 26 | // } 27 | // }) 28 | // } 29 | 30 | // export async function getServiceById(id: string) { 31 | 32 | // return db.services.findFirst({ 33 | // where: { 34 | // id: id, 35 | // deletedAt:null 36 | // }, 37 | // include:{ 38 | // serviceFeatures:true, 39 | // serviceHighlights:true, 40 | // } 41 | // }); 42 | // } 43 | // export async function updateServices(id : string, payload : any){ 44 | // return db.services.update({ 45 | // where: { 46 | // id: id, 47 | // }, 48 | // data: { 49 | // title:payload.title, 50 | // shortNote:payload.shortNote, 51 | // description:payload.description, 52 | // icon:payload.icon, 53 | // order:parseInt(payload.order), 54 | // isActive:payload.isActive, 55 | // featuredImagePath: payload.featuredImage, 56 | // updatedAt: new Date() 57 | // } 58 | // }) 59 | // } 60 | // export async function deleteServicesById(id: string){ 61 | // return db.services.update({ 62 | // where: { 63 | // id: id, 64 | // }, 65 | // data: { 66 | // deletedAt: new Date(), 67 | // } 68 | // }) 69 | // } 70 | -------------------------------------------------------------------------------- /src/modules/auth/auth.service.ts: -------------------------------------------------------------------------------- 1 | // auth.service.ts 2 | import { db } from "../../shared/lib/db"; 3 | import bcrypt from "bcrypt"; 4 | import { CreateUserModel } from "../../shared/lib/models/userModel"; 5 | import dotenv from "dotenv"; 6 | import { UserRole } from "@prisma/client"; 7 | import { getUserContext } from "../../shared/lib/async-context"; 8 | dotenv.config(); 9 | 10 | export async function userSignUp(payload: CreateUserModel): Promise { 11 | const saltRounds = parseInt(process.env.PASSWORD_HASH_KEY || "10"); 12 | const hashedPassword = await bcrypt.hash(payload.password, saltRounds); 13 | 14 | const role = Object.values(UserRole).includes(payload.role as UserRole) 15 | ? (payload.role as UserRole) 16 | : UserRole.User; 17 | 18 | return await db.user.create({ 19 | data: { 20 | name: payload.name, 21 | email: payload.email, 22 | username: payload.username, 23 | password: hashedPassword, 24 | image: payload.image, 25 | phoneNumber: payload.phoneNumber, 26 | role: role, 27 | }, 28 | }); 29 | } 30 | 31 | export async function userLogin(email: string, password: string): Promise { 32 | const user = await db.user.findUnique({ where: { email } }); 33 | 34 | if (!user) throw new Error("User not found"); 35 | 36 | const isPasswordValid = await bcrypt.compare(password, user.password); 37 | if (!isPasswordValid) throw new Error("Invalid password"); 38 | 39 | // Example: log context after successful login 40 | const ctx = getUserContext(); 41 | console.log(`[Login] User Context: Email: ${ctx?.email}, UserID: ${ctx?.userId}`); 42 | 43 | return user; 44 | } 45 | 46 | export async function changeUserPassword( 47 | email: string, 48 | currentPassword: string, 49 | newPassword: string 50 | ): Promise { 51 | const user = await db.user.findUnique({ where: { email } }); 52 | 53 | if (!user) { 54 | throw new Error("User not found"); 55 | } 56 | 57 | const isPasswordValid = await bcrypt.compare(currentPassword, user.password); 58 | if (!isPasswordValid) { 59 | throw new Error("Current password is incorrect"); 60 | } 61 | 62 | const saltRounds = parseInt(process.env.PASSWORD_HASH_KEY || "10"); 63 | const hashedNewPassword = await bcrypt.hash(newPassword, saltRounds); 64 | 65 | await db.user.update({ 66 | where: { email }, 67 | data: { password: hashedNewPassword }, 68 | }); 69 | } 70 | -------------------------------------------------------------------------------- /src/modules/assignSubject/assignSubject.route.ts: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | import { 3 | createSubject, 4 | getAllSubjects, 5 | getSubjectById, 6 | updateSubject, 7 | deleteSubject, 8 | assignSubjectToStaff, 9 | } from "././assignSubject.service"; 10 | 11 | const router = express.Router(); 12 | 13 | /** 14 | * @route POST /api/subjects 15 | * Create a new subject 16 | */ 17 | router.post("/create", async (req:any, res:any) => { 18 | try { 19 | const { name } = req.body; 20 | if (!name || name.trim() === "") { 21 | return res.status(400).json({ error: "Subject name is required" }); 22 | } 23 | 24 | const subject = await createSubject(name); 25 | res.status(201).json(subject); 26 | } catch (error: any) { 27 | res.status(400).json({ error: error.message }); 28 | } 29 | }); 30 | 31 | /** 32 | * @route GET /api/subjects 33 | * Get all subjects 34 | */ 35 | router.get("/", async (_req, res) => { 36 | const subjects = await getAllSubjects(); 37 | res.json(subjects); 38 | }); 39 | 40 | /** 41 | * @route GET /api/subjects/:id 42 | * Get subject by ID 43 | */ 44 | router.get("/:id", async (req, res) => { 45 | try { 46 | const subject = await getSubjectById(req.params.id); 47 | res.json(subject); 48 | } catch (error) { 49 | res.status(404).json({ error: "Subject not found" }); 50 | } 51 | }); 52 | 53 | /** 54 | * @route PUT /api/subjects/:id 55 | * Update subject name 56 | */ 57 | router.put("/:id", async (req, res) => { 58 | try { 59 | const updatedSubject = await updateSubject(req.params.id, req.body.name); 60 | res.json(updatedSubject); 61 | } catch (error) { 62 | res.status(400).json({ error: "Could not update subject" }); 63 | } 64 | }); 65 | 66 | /** 67 | * @route DELETE /api/subjects/:id 68 | * Delete a subject 69 | */ 70 | router.delete("/:id", async (req, res) => { 71 | try { 72 | await deleteSubject(req.params.id); 73 | res.json({ message: "Subject deleted successfully" }); 74 | } catch (error) { 75 | res.status(400).json({ error: "Could not delete subject" }); 76 | } 77 | }); 78 | 79 | /** 80 | * @route POST /api/subjects/assign 81 | * Assign a subject to a staff member 82 | */ 83 | router.post("/assign", async (req, res) => { 84 | const { staffId, subjectId } = req.body; 85 | 86 | try { 87 | const assignment = await assignSubjectToStaff(staffId, subjectId); 88 | res.status(201).json(assignment); 89 | } catch (error: any) { 90 | res.status(400).json({ error: error.message }); 91 | } 92 | }); 93 | 94 | module.exports = router; 95 | -------------------------------------------------------------------------------- /uploads/shield-antivirus-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 15 | 21 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /uploads/messages-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /uploads/svg-icons/documentation-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /prisma/migrations/20241207100127_init/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "User" ( 3 | "id" UUID NOT NULL, 4 | "name" TEXT NOT NULL, 5 | "email" TEXT NOT NULL, 6 | "password" TEXT NOT NULL, 7 | "role" TEXT NOT NULL DEFAULT 'customer', 8 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 9 | 10 | CONSTRAINT "User_pkey" PRIMARY KEY ("id") 11 | ); 12 | 13 | -- CreateTable 14 | CREATE TABLE "Category" ( 15 | "id" UUID NOT NULL, 16 | "name" TEXT NOT NULL, 17 | "description" TEXT, 18 | 19 | CONSTRAINT "Category_pkey" PRIMARY KEY ("id") 20 | ); 21 | 22 | -- CreateTable 23 | CREATE TABLE "Product" ( 24 | "id" UUID NOT NULL, 25 | "name" TEXT NOT NULL, 26 | "description" TEXT NOT NULL, 27 | "price" DOUBLE PRECISION NOT NULL, 28 | "stock" INTEGER NOT NULL, 29 | "imageUrl" TEXT NOT NULL, 30 | "categoryId" UUID NOT NULL, 31 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 32 | 33 | CONSTRAINT "Product_pkey" PRIMARY KEY ("id") 34 | ); 35 | 36 | -- CreateTable 37 | CREATE TABLE "Order" ( 38 | "id" UUID NOT NULL, 39 | "userId" UUID NOT NULL, 40 | "totalAmount" DOUBLE PRECISION NOT NULL, 41 | "status" TEXT NOT NULL DEFAULT 'pending', 42 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 43 | 44 | CONSTRAINT "Order_pkey" PRIMARY KEY ("id") 45 | ); 46 | 47 | -- CreateTable 48 | CREATE TABLE "OrderItem" ( 49 | "id" UUID NOT NULL, 50 | "orderId" UUID NOT NULL, 51 | "productId" UUID NOT NULL, 52 | "quantity" INTEGER NOT NULL, 53 | "price" DOUBLE PRECISION NOT NULL, 54 | 55 | CONSTRAINT "OrderItem_pkey" PRIMARY KEY ("id") 56 | ); 57 | 58 | -- CreateTable 59 | CREATE TABLE "Review" ( 60 | "id" UUID NOT NULL, 61 | "userId" UUID NOT NULL, 62 | "productId" UUID NOT NULL, 63 | "rating" INTEGER NOT NULL DEFAULT 5, 64 | "comment" TEXT, 65 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 66 | 67 | CONSTRAINT "Review_pkey" PRIMARY KEY ("id") 68 | ); 69 | 70 | -- CreateTable 71 | CREATE TABLE "Cart" ( 72 | "id" UUID NOT NULL, 73 | "userId" UUID NOT NULL, 74 | "productId" UUID NOT NULL, 75 | "quantity" INTEGER NOT NULL, 76 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 77 | 78 | CONSTRAINT "Cart_pkey" PRIMARY KEY ("id") 79 | ); 80 | 81 | -- CreateIndex 82 | CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); 83 | 84 | -- AddForeignKey 85 | ALTER TABLE "Product" ADD CONSTRAINT "Product_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 86 | 87 | -- AddForeignKey 88 | ALTER TABLE "Order" ADD CONSTRAINT "Order_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 89 | 90 | -- AddForeignKey 91 | ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_orderId_fkey" FOREIGN KEY ("orderId") REFERENCES "Order"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 92 | 93 | -- AddForeignKey 94 | ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 95 | 96 | -- AddForeignKey 97 | ALTER TABLE "Review" ADD CONSTRAINT "Review_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 98 | 99 | -- AddForeignKey 100 | ALTER TABLE "Review" ADD CONSTRAINT "Review_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 101 | 102 | -- AddForeignKey 103 | ALTER TABLE "Cart" ADD CONSTRAINT "Cart_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 104 | 105 | -- AddForeignKey 106 | ALTER TABLE "Cart" ADD CONSTRAINT "Cart_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 107 | -------------------------------------------------------------------------------- /src/app.ts: -------------------------------------------------------------------------------- 1 | import express, { Express, Request, Response } from "express"; 2 | import dotenv from "dotenv"; 3 | import path from "path"; 4 | import { authContextMiddleware } from "./shared/lib/middleware/auth-context"; 5 | import { Sequelize } from "sequelize"; // Import Sequelize 6 | 7 | dotenv.config(); 8 | 9 | const app: Express = express(); 10 | 11 | // --- DATABASE CONNECTION SETUP --- 12 | const sequelize = new Sequelize(process.env.DATABASE_URL || '', { // Ensure DATABASE_URL is not undefined 13 | dialect: 'postgres', 14 | dialectOptions: { 15 | ssl: { 16 | require: true, 17 | // BE CAREFUL WITH rejectUnauthorized: false IN PRODUCTION! 18 | // This allows connecting to databases with self-signed or invalid SSL certs. 19 | // For Render, it's often needed if they use a specific setup, 20 | // but if you can validate the cert, remove this line. 21 | rejectUnauthorized: false, 22 | }, 23 | }, 24 | logging: false, // Optional: Set to true to see SQL queries in console 25 | }); 26 | 27 | // Test the database connection and then start the server 28 | sequelize 29 | .authenticate() 30 | .then(() => { 31 | console.log('Database connection has been established successfully.'); 32 | 33 | // --- SERVER CONFIGURATION AND START --- 34 | const host = process.env.APP_HOST || '0.0.0.0'; // Use 0.0.0.0 for Render deployment 35 | const port = process.env.PORT || 5000; // Use process.env.PORT for Render, default to 5000 for local 36 | 37 | app.use(express.json()); 38 | app.use(express.urlencoded({ extended: true })); 39 | 40 | //Express configuration. 41 | app.set("host", host); 42 | app.set("port", port); 43 | 44 | // Using custom CORS policy 45 | // IMPORTANT: For production, replace '*' with your frontend domain(s) 46 | app.use((req, res, next) => { 47 | res.append('Access-Control-Allow-Origin', '*'); // Change this to your frontend URL(s) in production 48 | res.append('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,PATCH,OPTIONS'); // Add PATCH, OPTIONS 49 | res.append('Access-Control-Allow-Headers', 'Content-Type, Authorization, Accept, Origin, X-Requested-With'); // Be specific with headers 50 | next(); 51 | }); 52 | 53 | app.get("/", (req: Request, res: Response) => { 54 | res.send("Express + TypeScript Server"); 55 | }); 56 | 57 | // Import and use your routes 58 | const authApi = require('./modules/auth/auth.route'); // Consider using import statements if possible 59 | const categoryApi = require('./modules/category/category.route'); 60 | const brandApi = require('./modules/brand/brand.route'); 61 | const socialMediaApi = require('./modules/socilamedia/socialmedia.route'); // Typo: socilamedia -> socialmedia? 62 | const productApi = require('./modules/product/product.route'); 63 | const seasonApi = require('./modules/seasons/season.route'); 64 | const subjectApi = require('./modules/subject/subject.route'); 65 | const staffApi = require('./modules/staff/staff.route'); 66 | const assignSubjectApi = require('./modules/assignSubject/assignSubject.route'); 67 | 68 | // Middleware that applies to all routes below it 69 | app.use(authContextMiddleware); 70 | 71 | // Routes 72 | app.use('/api/category', categoryApi); 73 | app.use('/api/brand', brandApi); 74 | app.use('/api/socialmedia', socialMediaApi); // Typo: socilamedia -> socialmedia? 75 | app.use('/api/product', productApi); 76 | app.use('/api/season', seasonApi); 77 | app.use('/api/auth', authApi); 78 | app.use("/api/staffs", staffApi); 79 | app.use("/api/subjects", subjectApi); 80 | app.use("/api/assignSubjects", assignSubjectApi); 81 | 82 | // Serve static files from the 'uploads' directory 83 | app.use("/uploads", express.static(path.join(__dirname, "../uploads"))); 84 | 85 | // Start the server 86 | app.listen(app.get("port"), () => { 87 | console.log( 88 | "Server started at %s : %d ", 89 | app.get("host"), 90 | app.get("port"), 91 | ); 92 | }); 93 | 94 | }) 95 | .catch((err:any) => { 96 | console.error('Unable to connect to the database:', err); 97 | process.exit(1); // Exit the process if database connection fails 98 | }); 99 | // --- END DATABASE CONNECTION SETUP --- 100 | 101 | // It's generally better to export the `app` instance after it's fully configured, 102 | // but for this setup, the `app.listen` is inside the promise, so just export it. 103 | // If you run tests, you might want to export it before listen() to allow supertest etc. 104 | module.exports = app; -------------------------------------------------------------------------------- /uploads/shopping-bag-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 29 | 30 | 31 | 32 | 33 | 37 | 38 | 39 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /uploads/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uploads/logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /uploads/three-equalizer-bars-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 52 | -------------------------------------------------------------------------------- /uploads/operator-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 48 | 52 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /prisma/schema.prisma: -------------------------------------------------------------------------------- 1 | generator client { 2 | provider = "prisma-client-js" 3 | } 4 | 5 | datasource db { 6 | provider = "postgresql" 7 | url = env("DATABASE_URL") 8 | } 9 | 10 | model User { 11 | id String @id @default(uuid()) @map("_id") @db.Uuid 12 | name String? 13 | email String @unique 14 | username String? @unique 15 | password String 16 | phoneNumber String? 17 | role UserRole @default(User) 18 | image String? 19 | emailVerified DateTime? 20 | accounts Account[] 21 | orders Order[] 22 | cart Cart? 23 | createdAt DateTime @default(now()) 24 | updatedAt DateTime @updatedAt 25 | Review Review[] 26 | } 27 | 28 | 29 | enum UserRole { 30 | Admin 31 | TeachingStaff 32 | NonTeachingStaff 33 | Student 34 | User 35 | OfficeAdmin 36 | HM 37 | AHM 38 | } 39 | model Account { 40 | id String @id @default(uuid()) @map("_id") @db.Uuid 41 | userId String @db.Uuid 42 | provider String 43 | providerAccountId String 44 | access_token String? 45 | refresh_token String? 46 | expires_at Int? 47 | token_type String? 48 | scope String? 49 | id_token String? 50 | session_state String? 51 | user User @relation(fields: [userId], references: [id]) 52 | 53 | @@unique([provider, providerAccountId]) 54 | } 55 | 56 | model Category { 57 | id String @id @default(uuid()) @map("_id") @db.Uuid 58 | name String @unique 59 | description String? 60 | imageUrl String? 61 | imagePath String? 62 | createdAt DateTime? @default(now()) 63 | updatedAt DateTime? @default(now()) 64 | deletedAt DateTime? 65 | products Product[] 66 | } 67 | 68 | model Season { 69 | id String @id @default(uuid()) @map("_id") @db.Uuid 70 | name String @unique 71 | createdAt DateTime @default(now()) 72 | updatedAt DateTime @updatedAt 73 | products Product[] 74 | } 75 | 76 | model Product { 77 | id String @id @default(uuid()) @map("_id") @db.Uuid 78 | name String @unique 79 | description String 80 | price Float 81 | stock Int 82 | categoryId String @db.Uuid 83 | createdAt DateTime @default(now()) 84 | seasonId String? @db.Uuid 85 | updatedAt DateTime @updatedAt 86 | brandId String? @db.Uuid 87 | colors String[] 88 | materials String[] 89 | sizes String[] 90 | subscription Boolean @default(false) 91 | imageUrls String[] 92 | cartItems Cart[] 93 | orderItems OrderItem[] 94 | brand Brand? @relation(fields: [brandId], references: [id]) 95 | category Category @relation(fields: [categoryId], references: [id]) 96 | season Season? @relation(fields: [seasonId], references: [id]) 97 | reviews Review[] 98 | } 99 | 100 | model Order { 101 | id String @id @default(uuid()) @map("_id") @db.Uuid 102 | userId String @db.Uuid 103 | totalAmount Float 104 | status String @default("pending") 105 | createdAt DateTime @default(now()) 106 | user User @relation(fields: [userId], references: [id]) 107 | items OrderItem[] 108 | } 109 | 110 | model OrderItem { 111 | id String @id @default(uuid()) @map("_id") @db.Uuid 112 | orderId String @db.Uuid 113 | productId String @db.Uuid 114 | quantity Int 115 | price Float 116 | order Order @relation(fields: [orderId], references: [id]) 117 | product Product @relation(fields: [productId], references: [id]) 118 | } 119 | 120 | model Review { 121 | id String @id @default(uuid()) @map("_id") @db.Uuid 122 | userId String @db.Uuid 123 | productId String @db.Uuid 124 | rating Int @default(5) 125 | comment String? 126 | createdAt DateTime @default(now()) 127 | product Product @relation(fields: [productId], references: [id]) 128 | user User @relation(fields: [userId], references: [id]) 129 | } 130 | 131 | model Cart { 132 | id String @id @default(uuid()) @map("_id") @db.Uuid 133 | userId String @db.Uuid @unique 134 | productId String @db.Uuid 135 | quantity Int 136 | createdAt DateTime @default(now()) 137 | product Product @relation(fields: [productId], references: [id]) 138 | user User @relation(fields: [userId], references: [id]) 139 | } 140 | 141 | model Brand { 142 | id String @id @default(uuid()) @map("_id") @db.Uuid 143 | imageUrl String? 144 | name String @unique 145 | products Product[] 146 | } 147 | 148 | model SocialMedia { 149 | id String @id @default(uuid()) @map("_id") @db.Uuid 150 | imagePath String? 151 | name String @default("Default Name") 152 | } 153 | model Staff { 154 | id String @id @default(uuid()) 155 | name String 156 | email String @unique 157 | phone String? 158 | createdAt DateTime @default(now()) 159 | updatedAt DateTime @updatedAt 160 | 161 | subjects Subject[] @relation("StaffSubjects") 162 | 163 | subjectAssignment SubjectAssignment[] 164 | } 165 | 166 | model Subject { 167 | id String @id @default(uuid()) 168 | name String @unique 169 | createdAt DateTime @default(now()) 170 | 171 | staff Staff? @relation("StaffSubjects", fields: [staffId], references: [id]) 172 | staffId String? 173 | 174 | subjectAssignment SubjectAssignment[] 175 | } 176 | 177 | model SubjectAssignment { 178 | id String @id @default(uuid()) 179 | staff Staff @relation(fields: [staffId], references: [id]) 180 | staffId String 181 | subject Subject @relation(fields: [subjectId], references: [id]) 182 | subjectId String 183 | 184 | @@unique([staffId, subjectId]) // Prevent duplicate assignments 185 | } -------------------------------------------------------------------------------- /catalyst-debug.log: -------------------------------------------------------------------------------- 1 | [debug] [2025-02-26T09:21:26.643Z] : 2 | [debug] [2025-02-26T09:21:26.644Z] : ---------------------------------------------------------------------- 3 | [debug] [2025-02-26T09:21:26.644Z] : Command: C:\Program Files\nodejs\node.exe C:\Users\HP\AppData\Roaming\npm\node_modules\zcatalyst-cli\lib\bin\catalyst.js init 4 | [debug] [2025-02-26T09:21:26.644Z] : CLI Version: 1.17.6 5 | [debug] [2025-02-26T09:21:26.645Z] : Platform: win32 6 | [debug] [2025-02-26T09:21:26.645Z] : Node Version: v22.14.0 7 | [debug] [2025-02-26T09:21:26.645Z] : Time: Wed Feb 26 2025 14:51:26 GMT+0530 (India Standard Time) 8 | [debug] [2025-02-26T09:21:26.646Z] : ---------------------------------------------------------------------- 9 | [debug] [2025-02-26T09:21:26.646Z] : 10 | [debug] [2025-02-26T09:21:27.447Z] : > authorizing via signed-in user option 11 | [debug] [2025-02-26T09:21:27.447Z] : > command requires scopes: ["ZohoCatalyst.projects.ALL","ZohoCatalyst.projects.ALL","Stratus.sdkop.CREATE","Stratus.sdkop.READ","ZohoCatalyst.project.import.CREATE"] 12 | [info] [2025-02-26T09:21:27.461Z] : 13 | ___ 14 | \ \ ____ _ _ _ 15 | ___ \ \ / ___| __ _ | |_ __ _ | | _ _ ___ | |_ 16 | / / / / | | / _` | | __| / _` | | | | | | | / __| | __| 17 | / / /__/ | |___ | (_| | | |_ | (_| | | | | |_| | \__ \ | |_ 18 | \ \ \____| \__,_| \__| \__,_| |_| \__, | |___/ \__| 19 | \__\ |___/ 20 | 21 | You're about to initialize a Catalyst project in this directory: 22 | 23 | D:\react\Lumia Prisma Backend 24 | 25 | Before we get started, keep in mind: 26 | 27 | * You are currently outside your home directory 28 | 29 | [debug] [2025-02-26T09:21:36.380Z] : > refreshing access token < 30 | [debug] [2025-02-26T09:21:36.381Z] : >>>> HTTP REQUEST : POST https://accounts.zoho.in/oauth/v2/token 31 | 32 | 33 | [debug] [2025-02-26T09:21:36.714Z] : <<<< HTTP RESPONSE : 200 34 | Response Headers: {"server":"ZGS","date":"Wed, 26 Feb 2025 09:21:23 GMT","content-type":"application/json;charset=UTF-8","content-length":"1948","connection":"keep-alive","set-cookie":["zalb_6e73717622=13e67ac15bc4d3ece130966123511df7; Path=/; Secure; HttpOnly","iamcsr=f8939f7d-7940-46ee-b82d-5b7ca5548b42;path=/;SameSite=None;Secure;priority=high","_zcsr_tmp=f8939f7d-7940-46ee-b82d-5b7ca5548b42;path=/;SameSite=Strict;Secure;priority=high"],"cache-control":"no-store","x-content-type-options":"nosniff","content-security-policy":"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.zohocdn.com https://*.zoho.com https://*.zoho.eu https://*.zoho.com.cn https://*.zoho.com.au https://*.zoho.jp https://*.zoho.uk https://*.zoho.sa https://*.zohocloud.ca; report-uri https://logsapi.zoho.in/csplog?service=accounts;","pragma":"no-cache","x-frame-options":"SAMEORIGIN","vary":"accept-encoding","content-language":"en-US","strict-transport-security":"max-age=64072000; includeSubDomains; preload"} 35 | 36 | [debug] [2025-02-26T09:21:36.734Z] : >>>> HTTP REQUEST : GET https://api.catalyst.zoho.in/baas/v1/orgs 37 | 38 | [warn] [2025-02-26T09:21:57.867Z] : ‼ ETIMEDOUT has occured while communicating remote server. Kindly be patient while the cli retries this request. 39 | [debug] [2025-02-26T09:21:57.868Z] : API Error while firing request : connect ETIMEDOUT 103.103.196.93:443 40 | 41 | [debug] [2025-02-26T09:21:57.868Z] : >>>> RETRYING 42 | 43 | [warn] [2025-02-26T09:22:18.913Z] : ‼ ETIMEDOUT has occured while communicating remote server. Kindly be patient while the cli retries this request. 44 | [debug] [2025-02-26T09:22:18.913Z] : API Error while firing request : connect ETIMEDOUT 103.103.196.93:443 45 | 46 | [debug] [2025-02-26T09:22:18.914Z] : >>>> RETRYING 47 | 48 | [debug] [2025-02-26T09:22:19.333Z] : <<<< HTTP RESPONSE : 200 49 | Response Headers: {"server":"ZGS","date":"Wed, 26 Feb 2025 09:22:06 GMT","content-type":"application/vnd.catalyst.v2+json","transfer-encoding":"chunked","connection":"keep-alive","set-cookie":["zalb_3a750b85f1=ed010f63633be60a322039283f31a645; Path=/; Secure; HttpOnly","ZD_CSRF_TOKEN=34b24f55-4194-4d4e-a1fa-72f2272f05cf;path=/;SameSite=None;Secure;priority=high","_zcsr_tmp=34b24f55-4194-4d4e-a1fa-72f2272f05cf;path=/;SameSite=Strict;Secure;priority=high"],"x-content-type-options":"nosniff","cache-control":"private,no-cache,no-store,max-age=0,must-revalidate","pragma":"no-cache","expires":"Thu, 01 Jan 1970 00:00:00 GMT","x-frame-options":"DENY","strict-transport-security":"max-age=64072000; includeSubDomains; preload"} 50 | 51 | [info] [2025-02-26T09:22:19.336Z] : i Setting up a new default project for this folder 52 | 53 | [debug] [2025-02-26T09:22:19.338Z] : >>>> HTTP REQUEST : GET https://api.catalyst.zoho.in/baas/v1/project 54 | 55 | [debug] [2025-02-26T09:22:19.469Z] : <<<< HTTP RESPONSE : 200 56 | Response Headers: {"server":"ZGS","date":"Wed, 26 Feb 2025 09:22:06 GMT","content-type":"application/vnd.catalyst.v2+json","transfer-encoding":"chunked","connection":"keep-alive","set-cookie":["zalb_3a750b85f1=411f509465b028e7e235eac6930aaab2; Path=/; Secure; HttpOnly","ZD_CSRF_TOKEN=edf2fa0b-a9a8-4a15-b694-0688da8cce7d;path=/;SameSite=None;Secure;priority=high","_zcsr_tmp=edf2fa0b-a9a8-4a15-b694-0688da8cce7d;path=/;SameSite=Strict;Secure;priority=high"],"x-content-type-options":"nosniff","cache-control":"private,no-cache,no-store,max-age=0,must-revalidate","pragma":"no-cache","expires":"Thu, 01 Jan 1970 00:00:00 GMT","x-frame-options":"DENY","strict-transport-security":"max-age=64072000; includeSubDomains; preload"} 57 | 58 | [debug] [2025-02-26T09:22:34.825Z] : >>>> HTTP REQUEST : GET https://api.catalyst.zoho.in/baas/v1/project/import 59 | 60 | [debug] [2025-02-26T09:22:35.100Z] : <<<< HTTP RESPONSE : 200 61 | Response Headers: {"server":"ZGS","date":"Wed, 26 Feb 2025 09:22:21 GMT","content-type":"application/vnd.catalyst.v2+json","transfer-encoding":"chunked","connection":"keep-alive","set-cookie":["zalb_3a750b85f1=ed010f63633be60a322039283f31a645; Path=/; Secure; HttpOnly","ZD_CSRF_TOKEN=2701ba82-8eeb-4924-a07a-8c4691b6fa6f;path=/;SameSite=None;Secure;priority=high","_zcsr_tmp=2701ba82-8eeb-4924-a07a-8c4691b6fa6f;path=/;SameSite=Strict;Secure;priority=high"],"x-content-type-options":"nosniff","cache-control":"private,no-cache,no-store,max-age=0,must-revalidate","pragma":"no-cache","expires":"Thu, 01 Jan 1970 00:00:00 GMT","x-frame-options":"DENY","strict-transport-security":"max-age=64072000; includeSubDomains; preload"} 62 | 63 | -------------------------------------------------------------------------------- /prisma/migrations/20250219160905_init/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - The primary key for the `Brand` table will be changed. If it partially fails, the table could be left without primary key constraint. 5 | - You are about to drop the column `id` on the `Brand` table. All the data in the column will be lost. 6 | - The primary key for the `Cart` table will be changed. If it partially fails, the table could be left without primary key constraint. 7 | - You are about to drop the column `id` on the `Cart` table. All the data in the column will be lost. 8 | - The primary key for the `Category` table will be changed. If it partially fails, the table could be left without primary key constraint. 9 | - You are about to drop the column `id` on the `Category` table. All the data in the column will be lost. 10 | - The primary key for the `Order` table will be changed. If it partially fails, the table could be left without primary key constraint. 11 | - You are about to drop the column `id` on the `Order` table. All the data in the column will be lost. 12 | - The primary key for the `OrderItem` table will be changed. If it partially fails, the table could be left without primary key constraint. 13 | - You are about to drop the column `id` on the `OrderItem` table. All the data in the column will be lost. 14 | - The primary key for the `Product` table will be changed. If it partially fails, the table could be left without primary key constraint. 15 | - You are about to drop the column `id` on the `Product` table. All the data in the column will be lost. 16 | - The primary key for the `Review` table will be changed. If it partially fails, the table could be left without primary key constraint. 17 | - You are about to drop the column `id` on the `Review` table. All the data in the column will be lost. 18 | - The primary key for the `Season` table will be changed. If it partially fails, the table could be left without primary key constraint. 19 | - You are about to drop the column `id` on the `Season` table. All the data in the column will be lost. 20 | - The primary key for the `SocialMedia` table will be changed. If it partially fails, the table could be left without primary key constraint. 21 | - You are about to drop the column `id` on the `SocialMedia` table. All the data in the column will be lost. 22 | - The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint. 23 | - You are about to drop the column `id` on the `User` table. All the data in the column will be lost. 24 | - The required column `_id` was added to the `Brand` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 25 | - The required column `_id` was added to the `Cart` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 26 | - The required column `_id` was added to the `Category` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 27 | - The required column `_id` was added to the `Order` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 28 | - The required column `_id` was added to the `OrderItem` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 29 | - The required column `_id` was added to the `Product` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 30 | - The required column `_id` was added to the `Review` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 31 | - The required column `_id` was added to the `Season` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 32 | - The required column `_id` was added to the `SocialMedia` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 33 | - The required column `_id` was added to the `User` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. 34 | 35 | */ 36 | -- DropForeignKey 37 | ALTER TABLE "Cart" DROP CONSTRAINT "Cart_productId_fkey"; 38 | 39 | -- DropForeignKey 40 | ALTER TABLE "Cart" DROP CONSTRAINT "Cart_userId_fkey"; 41 | 42 | -- DropForeignKey 43 | ALTER TABLE "Order" DROP CONSTRAINT "Order_userId_fkey"; 44 | 45 | -- DropForeignKey 46 | ALTER TABLE "OrderItem" DROP CONSTRAINT "OrderItem_orderId_fkey"; 47 | 48 | -- DropForeignKey 49 | ALTER TABLE "OrderItem" DROP CONSTRAINT "OrderItem_productId_fkey"; 50 | 51 | -- DropForeignKey 52 | ALTER TABLE "Product" DROP CONSTRAINT "Product_brandId_fkey"; 53 | 54 | -- DropForeignKey 55 | ALTER TABLE "Product" DROP CONSTRAINT "Product_categoryId_fkey"; 56 | 57 | -- DropForeignKey 58 | ALTER TABLE "Product" DROP CONSTRAINT "Product_seasonId_fkey"; 59 | 60 | -- DropForeignKey 61 | ALTER TABLE "Review" DROP CONSTRAINT "Review_productId_fkey"; 62 | 63 | -- DropForeignKey 64 | ALTER TABLE "Review" DROP CONSTRAINT "Review_userId_fkey"; 65 | 66 | -- AlterTable 67 | ALTER TABLE "Brand" DROP CONSTRAINT "Brand_pkey", 68 | DROP COLUMN "id", 69 | ADD COLUMN "_id" UUID NOT NULL, 70 | ADD CONSTRAINT "Brand_pkey" PRIMARY KEY ("_id"); 71 | 72 | -- AlterTable 73 | ALTER TABLE "Cart" DROP CONSTRAINT "Cart_pkey", 74 | DROP COLUMN "id", 75 | ADD COLUMN "_id" UUID NOT NULL, 76 | ADD CONSTRAINT "Cart_pkey" PRIMARY KEY ("_id"); 77 | 78 | -- AlterTable 79 | ALTER TABLE "Category" DROP CONSTRAINT "Category_pkey", 80 | DROP COLUMN "id", 81 | ADD COLUMN "_id" UUID NOT NULL, 82 | ADD CONSTRAINT "Category_pkey" PRIMARY KEY ("_id"); 83 | 84 | -- AlterTable 85 | ALTER TABLE "Order" DROP CONSTRAINT "Order_pkey", 86 | DROP COLUMN "id", 87 | ADD COLUMN "_id" UUID NOT NULL, 88 | ADD CONSTRAINT "Order_pkey" PRIMARY KEY ("_id"); 89 | 90 | -- AlterTable 91 | ALTER TABLE "OrderItem" DROP CONSTRAINT "OrderItem_pkey", 92 | DROP COLUMN "id", 93 | ADD COLUMN "_id" UUID NOT NULL, 94 | ADD CONSTRAINT "OrderItem_pkey" PRIMARY KEY ("_id"); 95 | 96 | -- AlterTable 97 | ALTER TABLE "Product" DROP CONSTRAINT "Product_pkey", 98 | DROP COLUMN "id", 99 | ADD COLUMN "_id" UUID NOT NULL, 100 | ADD CONSTRAINT "Product_pkey" PRIMARY KEY ("_id"); 101 | 102 | -- AlterTable 103 | ALTER TABLE "Review" DROP CONSTRAINT "Review_pkey", 104 | DROP COLUMN "id", 105 | ADD COLUMN "_id" UUID NOT NULL, 106 | ADD CONSTRAINT "Review_pkey" PRIMARY KEY ("_id"); 107 | 108 | -- AlterTable 109 | ALTER TABLE "Season" DROP CONSTRAINT "Season_pkey", 110 | DROP COLUMN "id", 111 | ADD COLUMN "_id" UUID NOT NULL, 112 | ADD CONSTRAINT "Season_pkey" PRIMARY KEY ("_id"); 113 | 114 | -- AlterTable 115 | ALTER TABLE "SocialMedia" DROP CONSTRAINT "SocialMedia_pkey", 116 | DROP COLUMN "id", 117 | ADD COLUMN "_id" UUID NOT NULL, 118 | ADD CONSTRAINT "SocialMedia_pkey" PRIMARY KEY ("_id"); 119 | 120 | -- AlterTable 121 | ALTER TABLE "User" DROP CONSTRAINT "User_pkey", 122 | DROP COLUMN "id", 123 | ADD COLUMN "_id" UUID NOT NULL, 124 | ADD CONSTRAINT "User_pkey" PRIMARY KEY ("_id"); 125 | 126 | -- AddForeignKey 127 | ALTER TABLE "Product" ADD CONSTRAINT "Product_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "Brand"("_id") ON DELETE SET NULL ON UPDATE CASCADE; 128 | 129 | -- AddForeignKey 130 | ALTER TABLE "Product" ADD CONSTRAINT "Product_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("_id") ON DELETE RESTRICT ON UPDATE CASCADE; 131 | 132 | -- AddForeignKey 133 | ALTER TABLE "Product" ADD CONSTRAINT "Product_seasonId_fkey" FOREIGN KEY ("seasonId") REFERENCES "Season"("_id") ON DELETE SET NULL ON UPDATE CASCADE; 134 | 135 | -- AddForeignKey 136 | ALTER TABLE "Order" ADD CONSTRAINT "Order_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE RESTRICT ON UPDATE CASCADE; 137 | 138 | -- AddForeignKey 139 | ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_orderId_fkey" FOREIGN KEY ("orderId") REFERENCES "Order"("_id") ON DELETE RESTRICT ON UPDATE CASCADE; 140 | 141 | -- AddForeignKey 142 | ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("_id") ON DELETE RESTRICT ON UPDATE CASCADE; 143 | 144 | -- AddForeignKey 145 | ALTER TABLE "Review" ADD CONSTRAINT "Review_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("_id") ON DELETE RESTRICT ON UPDATE CASCADE; 146 | 147 | -- AddForeignKey 148 | ALTER TABLE "Review" ADD CONSTRAINT "Review_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE RESTRICT ON UPDATE CASCADE; 149 | 150 | -- AddForeignKey 151 | ALTER TABLE "Cart" ADD CONSTRAINT "Cart_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("_id") ON DELETE RESTRICT ON UPDATE CASCADE; 152 | 153 | -- AddForeignKey 154 | ALTER TABLE "Cart" ADD CONSTRAINT "Cart_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE RESTRICT ON UPDATE CASCADE; 155 | -------------------------------------------------------------------------------- /prisma/migrations/20250219081505_/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - The primary key for the `Brand` table will be changed. If it partially fails, the table could be left without primary key constraint. 5 | - The `id` column on the `Brand` table would be dropped and recreated. This will lead to data loss if there is data in the column. 6 | - The primary key for the `Cart` table will be changed. If it partially fails, the table could be left without primary key constraint. 7 | - The `id` column on the `Cart` table would be dropped and recreated. This will lead to data loss if there is data in the column. 8 | - The primary key for the `Category` table will be changed. If it partially fails, the table could be left without primary key constraint. 9 | - You are about to drop the column `imagePath` on the `Category` table. All the data in the column will be lost. 10 | - The `id` column on the `Category` table would be dropped and recreated. This will lead to data loss if there is data in the column. 11 | - The primary key for the `Order` table will be changed. If it partially fails, the table could be left without primary key constraint. 12 | - The `id` column on the `Order` table would be dropped and recreated. This will lead to data loss if there is data in the column. 13 | - The primary key for the `OrderItem` table will be changed. If it partially fails, the table could be left without primary key constraint. 14 | - The `id` column on the `OrderItem` table would be dropped and recreated. This will lead to data loss if there is data in the column. 15 | - The primary key for the `Product` table will be changed. If it partially fails, the table could be left without primary key constraint. 16 | - You are about to drop the column `imageUrls` on the `Product` table. All the data in the column will be lost. 17 | - The `id` column on the `Product` table would be dropped and recreated. This will lead to data loss if there is data in the column. 18 | - The `seasonId` column on the `Product` table would be dropped and recreated. This will lead to data loss if there is data in the column. 19 | - The `brandId` column on the `Product` table would be dropped and recreated. This will lead to data loss if there is data in the column. 20 | - The primary key for the `Review` table will be changed. If it partially fails, the table could be left without primary key constraint. 21 | - The `id` column on the `Review` table would be dropped and recreated. This will lead to data loss if there is data in the column. 22 | - The primary key for the `Season` table will be changed. If it partially fails, the table could be left without primary key constraint. 23 | - The `id` column on the `Season` table would be dropped and recreated. This will lead to data loss if there is data in the column. 24 | - The primary key for the `SocialMedia` table will be changed. If it partially fails, the table could be left without primary key constraint. 25 | - The `id` column on the `SocialMedia` table would be dropped and recreated. This will lead to data loss if there is data in the column. 26 | - The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint. 27 | - The `id` column on the `User` table would be dropped and recreated. This will lead to data loss if there is data in the column. 28 | - Changed the type of `userId` on the `Cart` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 29 | - Changed the type of `productId` on the `Cart` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 30 | - Changed the type of `userId` on the `Order` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 31 | - Changed the type of `orderId` on the `OrderItem` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 32 | - Changed the type of `productId` on the `OrderItem` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 33 | - Changed the type of `categoryId` on the `Product` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 34 | - Changed the type of `userId` on the `Review` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 35 | - Changed the type of `productId` on the `Review` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 36 | 37 | */ 38 | -- DropForeignKey 39 | ALTER TABLE "Cart" DROP CONSTRAINT "Cart_productId_fkey"; 40 | 41 | -- DropForeignKey 42 | ALTER TABLE "Cart" DROP CONSTRAINT "Cart_userId_fkey"; 43 | 44 | -- DropForeignKey 45 | ALTER TABLE "Order" DROP CONSTRAINT "Order_userId_fkey"; 46 | 47 | -- DropForeignKey 48 | ALTER TABLE "OrderItem" DROP CONSTRAINT "OrderItem_orderId_fkey"; 49 | 50 | -- DropForeignKey 51 | ALTER TABLE "OrderItem" DROP CONSTRAINT "OrderItem_productId_fkey"; 52 | 53 | -- DropForeignKey 54 | ALTER TABLE "Product" DROP CONSTRAINT "Product_brandId_fkey"; 55 | 56 | -- DropForeignKey 57 | ALTER TABLE "Product" DROP CONSTRAINT "Product_categoryId_fkey"; 58 | 59 | -- DropForeignKey 60 | ALTER TABLE "Product" DROP CONSTRAINT "Product_seasonId_fkey"; 61 | 62 | -- DropForeignKey 63 | ALTER TABLE "Review" DROP CONSTRAINT "Review_productId_fkey"; 64 | 65 | -- DropForeignKey 66 | ALTER TABLE "Review" DROP CONSTRAINT "Review_userId_fkey"; 67 | 68 | -- AlterTable 69 | ALTER TABLE "Brand" DROP CONSTRAINT "Brand_pkey", 70 | DROP COLUMN "id", 71 | ADD COLUMN "id" SERIAL NOT NULL, 72 | ADD CONSTRAINT "Brand_pkey" PRIMARY KEY ("id"); 73 | 74 | -- AlterTable 75 | ALTER TABLE "Cart" DROP CONSTRAINT "Cart_pkey", 76 | DROP COLUMN "id", 77 | ADD COLUMN "id" SERIAL NOT NULL, 78 | DROP COLUMN "userId", 79 | ADD COLUMN "userId" INTEGER NOT NULL, 80 | DROP COLUMN "productId", 81 | ADD COLUMN "productId" INTEGER NOT NULL, 82 | ADD CONSTRAINT "Cart_pkey" PRIMARY KEY ("id"); 83 | 84 | -- AlterTable 85 | ALTER TABLE "Category" DROP CONSTRAINT "Category_pkey", 86 | DROP COLUMN "imagePath", 87 | DROP COLUMN "id", 88 | ADD COLUMN "id" SERIAL NOT NULL, 89 | ADD CONSTRAINT "Category_pkey" PRIMARY KEY ("id"); 90 | 91 | -- AlterTable 92 | ALTER TABLE "Order" DROP CONSTRAINT "Order_pkey", 93 | DROP COLUMN "id", 94 | ADD COLUMN "id" SERIAL NOT NULL, 95 | DROP COLUMN "userId", 96 | ADD COLUMN "userId" INTEGER NOT NULL, 97 | ADD CONSTRAINT "Order_pkey" PRIMARY KEY ("id"); 98 | 99 | -- AlterTable 100 | ALTER TABLE "OrderItem" DROP CONSTRAINT "OrderItem_pkey", 101 | DROP COLUMN "id", 102 | ADD COLUMN "id" SERIAL NOT NULL, 103 | DROP COLUMN "orderId", 104 | ADD COLUMN "orderId" INTEGER NOT NULL, 105 | DROP COLUMN "productId", 106 | ADD COLUMN "productId" INTEGER NOT NULL, 107 | ADD CONSTRAINT "OrderItem_pkey" PRIMARY KEY ("id"); 108 | 109 | -- AlterTable 110 | ALTER TABLE "Product" DROP CONSTRAINT "Product_pkey", 111 | DROP COLUMN "imageUrls", 112 | ADD COLUMN "images" TEXT[], 113 | DROP COLUMN "id", 114 | ADD COLUMN "id" SERIAL NOT NULL, 115 | DROP COLUMN "categoryId", 116 | ADD COLUMN "categoryId" INTEGER NOT NULL, 117 | DROP COLUMN "seasonId", 118 | ADD COLUMN "seasonId" INTEGER, 119 | DROP COLUMN "brandId", 120 | ADD COLUMN "brandId" INTEGER, 121 | ADD CONSTRAINT "Product_pkey" PRIMARY KEY ("id"); 122 | 123 | -- AlterTable 124 | ALTER TABLE "Review" DROP CONSTRAINT "Review_pkey", 125 | DROP COLUMN "id", 126 | ADD COLUMN "id" SERIAL NOT NULL, 127 | DROP COLUMN "userId", 128 | ADD COLUMN "userId" INTEGER NOT NULL, 129 | DROP COLUMN "productId", 130 | ADD COLUMN "productId" INTEGER NOT NULL, 131 | ADD CONSTRAINT "Review_pkey" PRIMARY KEY ("id"); 132 | 133 | -- AlterTable 134 | ALTER TABLE "Season" DROP CONSTRAINT "Season_pkey", 135 | DROP COLUMN "id", 136 | ADD COLUMN "id" SERIAL NOT NULL, 137 | ADD CONSTRAINT "Season_pkey" PRIMARY KEY ("id"); 138 | 139 | -- AlterTable 140 | ALTER TABLE "SocialMedia" DROP CONSTRAINT "SocialMedia_pkey", 141 | DROP COLUMN "id", 142 | ADD COLUMN "id" SERIAL NOT NULL, 143 | ADD CONSTRAINT "SocialMedia_pkey" PRIMARY KEY ("id"); 144 | 145 | -- AlterTable 146 | ALTER TABLE "User" DROP CONSTRAINT "User_pkey", 147 | DROP COLUMN "id", 148 | ADD COLUMN "id" SERIAL NOT NULL, 149 | ADD CONSTRAINT "User_pkey" PRIMARY KEY ("id"); 150 | 151 | -- AddForeignKey 152 | ALTER TABLE "Product" ADD CONSTRAINT "Product_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "Brand"("id") ON DELETE SET NULL ON UPDATE CASCADE; 153 | 154 | -- AddForeignKey 155 | ALTER TABLE "Product" ADD CONSTRAINT "Product_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 156 | 157 | -- AddForeignKey 158 | ALTER TABLE "Product" ADD CONSTRAINT "Product_seasonId_fkey" FOREIGN KEY ("seasonId") REFERENCES "Season"("id") ON DELETE SET NULL ON UPDATE CASCADE; 159 | 160 | -- AddForeignKey 161 | ALTER TABLE "Order" ADD CONSTRAINT "Order_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 162 | 163 | -- AddForeignKey 164 | ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_orderId_fkey" FOREIGN KEY ("orderId") REFERENCES "Order"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 165 | 166 | -- AddForeignKey 167 | ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 168 | 169 | -- AddForeignKey 170 | ALTER TABLE "Review" ADD CONSTRAINT "Review_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 171 | 172 | -- AddForeignKey 173 | ALTER TABLE "Review" ADD CONSTRAINT "Review_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 174 | 175 | -- AddForeignKey 176 | ALTER TABLE "Cart" ADD CONSTRAINT "Cart_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 177 | 178 | -- AddForeignKey 179 | ALTER TABLE "Cart" ADD CONSTRAINT "Cart_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 180 | -------------------------------------------------------------------------------- /prisma/migrations/20250219083658_fix_category_product_ids/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - The primary key for the `Brand` table will be changed. If it partially fails, the table could be left without primary key constraint. 5 | - The primary key for the `Cart` table will be changed. If it partially fails, the table could be left without primary key constraint. 6 | - The primary key for the `Category` table will be changed. If it partially fails, the table could be left without primary key constraint. 7 | - The primary key for the `Order` table will be changed. If it partially fails, the table could be left without primary key constraint. 8 | - The primary key for the `OrderItem` table will be changed. If it partially fails, the table could be left without primary key constraint. 9 | - The primary key for the `Product` table will be changed. If it partially fails, the table could be left without primary key constraint. 10 | - You are about to drop the column `images` on the `Product` table. All the data in the column will be lost. 11 | - The `seasonId` column on the `Product` table would be dropped and recreated. This will lead to data loss if there is data in the column. 12 | - The `brandId` column on the `Product` table would be dropped and recreated. This will lead to data loss if there is data in the column. 13 | - The primary key for the `Review` table will be changed. If it partially fails, the table could be left without primary key constraint. 14 | - The primary key for the `Season` table will be changed. If it partially fails, the table could be left without primary key constraint. 15 | - The primary key for the `SocialMedia` table will be changed. If it partially fails, the table could be left without primary key constraint. 16 | - The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint. 17 | - Changed the type of `id` on the `Brand` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 18 | - Changed the type of `id` on the `Cart` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 19 | - Changed the type of `userId` on the `Cart` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 20 | - Changed the type of `productId` on the `Cart` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 21 | - Changed the type of `id` on the `Category` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 22 | - Changed the type of `id` on the `Order` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 23 | - Changed the type of `userId` on the `Order` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 24 | - Changed the type of `id` on the `OrderItem` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 25 | - Changed the type of `orderId` on the `OrderItem` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 26 | - Changed the type of `productId` on the `OrderItem` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 27 | - Changed the type of `id` on the `Product` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 28 | - Added the required column `categoryId` to the `Product` table without a default value. This is not possible if the table is not empty. 29 | - Changed the type of `id` on the `Review` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 30 | - Changed the type of `userId` on the `Review` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 31 | - Changed the type of `productId` on the `Review` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 32 | - Changed the type of `id` on the `Season` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 33 | - Changed the type of `id` on the `SocialMedia` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 34 | - Changed the type of `id` on the `User` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. 35 | 36 | */ 37 | -- DropForeignKey 38 | ALTER TABLE "Cart" DROP CONSTRAINT "Cart_productId_fkey"; 39 | 40 | -- DropForeignKey 41 | ALTER TABLE "Cart" DROP CONSTRAINT "Cart_userId_fkey"; 42 | 43 | -- DropForeignKey 44 | ALTER TABLE "Order" DROP CONSTRAINT "Order_userId_fkey"; 45 | 46 | -- DropForeignKey 47 | ALTER TABLE "OrderItem" DROP CONSTRAINT "OrderItem_orderId_fkey"; 48 | 49 | -- DropForeignKey 50 | ALTER TABLE "OrderItem" DROP CONSTRAINT "OrderItem_productId_fkey"; 51 | 52 | -- DropForeignKey 53 | ALTER TABLE "Product" DROP CONSTRAINT "Product_brandId_fkey"; 54 | 55 | -- DropForeignKey 56 | ALTER TABLE "Product" DROP CONSTRAINT "Product_categoryId_fkey"; 57 | 58 | -- DropForeignKey 59 | ALTER TABLE "Product" DROP CONSTRAINT "Product_seasonId_fkey"; 60 | 61 | -- DropForeignKey 62 | ALTER TABLE "Review" DROP CONSTRAINT "Review_productId_fkey"; 63 | 64 | -- DropForeignKey 65 | ALTER TABLE "Review" DROP CONSTRAINT "Review_userId_fkey"; 66 | 67 | -- AlterTable 68 | ALTER TABLE "Brand" DROP CONSTRAINT "Brand_pkey", 69 | DROP COLUMN "id", 70 | ADD COLUMN "id" UUID NOT NULL, 71 | ADD CONSTRAINT "Brand_pkey" PRIMARY KEY ("id"); 72 | 73 | -- AlterTable 74 | ALTER TABLE "Cart" DROP CONSTRAINT "Cart_pkey", 75 | DROP COLUMN "id", 76 | ADD COLUMN "id" UUID NOT NULL, 77 | DROP COLUMN "userId", 78 | ADD COLUMN "userId" UUID NOT NULL, 79 | DROP COLUMN "productId", 80 | ADD COLUMN "productId" UUID NOT NULL, 81 | ADD CONSTRAINT "Cart_pkey" PRIMARY KEY ("id"); 82 | 83 | -- AlterTable 84 | ALTER TABLE "Category" DROP CONSTRAINT "Category_pkey", 85 | ADD COLUMN "imagePath" TEXT, 86 | DROP COLUMN "id", 87 | ADD COLUMN "id" UUID NOT NULL, 88 | ADD CONSTRAINT "Category_pkey" PRIMARY KEY ("id"); 89 | 90 | -- AlterTable 91 | ALTER TABLE "Order" DROP CONSTRAINT "Order_pkey", 92 | DROP COLUMN "id", 93 | ADD COLUMN "id" UUID NOT NULL, 94 | DROP COLUMN "userId", 95 | ADD COLUMN "userId" UUID NOT NULL, 96 | ADD CONSTRAINT "Order_pkey" PRIMARY KEY ("id"); 97 | 98 | -- AlterTable 99 | ALTER TABLE "OrderItem" DROP CONSTRAINT "OrderItem_pkey", 100 | DROP COLUMN "id", 101 | ADD COLUMN "id" UUID NOT NULL, 102 | DROP COLUMN "orderId", 103 | ADD COLUMN "orderId" UUID NOT NULL, 104 | DROP COLUMN "productId", 105 | ADD COLUMN "productId" UUID NOT NULL, 106 | ADD CONSTRAINT "OrderItem_pkey" PRIMARY KEY ("id"); 107 | 108 | -- AlterTable 109 | ALTER TABLE "Product" DROP CONSTRAINT "Product_pkey", 110 | DROP COLUMN "images", 111 | ADD COLUMN "imageUrls" TEXT[], 112 | DROP COLUMN "id", 113 | ADD COLUMN "id" UUID NOT NULL, 114 | DROP COLUMN "categoryId", 115 | ADD COLUMN "categoryId" UUID NOT NULL, 116 | DROP COLUMN "seasonId", 117 | ADD COLUMN "seasonId" UUID, 118 | DROP COLUMN "brandId", 119 | ADD COLUMN "brandId" UUID, 120 | ADD CONSTRAINT "Product_pkey" PRIMARY KEY ("id"); 121 | 122 | -- AlterTable 123 | ALTER TABLE "Review" DROP CONSTRAINT "Review_pkey", 124 | DROP COLUMN "id", 125 | ADD COLUMN "id" UUID NOT NULL, 126 | DROP COLUMN "userId", 127 | ADD COLUMN "userId" UUID NOT NULL, 128 | DROP COLUMN "productId", 129 | ADD COLUMN "productId" UUID NOT NULL, 130 | ADD CONSTRAINT "Review_pkey" PRIMARY KEY ("id"); 131 | 132 | -- AlterTable 133 | ALTER TABLE "Season" DROP CONSTRAINT "Season_pkey", 134 | DROP COLUMN "id", 135 | ADD COLUMN "id" UUID NOT NULL, 136 | ADD CONSTRAINT "Season_pkey" PRIMARY KEY ("id"); 137 | 138 | -- AlterTable 139 | ALTER TABLE "SocialMedia" DROP CONSTRAINT "SocialMedia_pkey", 140 | DROP COLUMN "id", 141 | ADD COLUMN "id" UUID NOT NULL, 142 | ADD CONSTRAINT "SocialMedia_pkey" PRIMARY KEY ("id"); 143 | 144 | -- AlterTable 145 | ALTER TABLE "User" DROP CONSTRAINT "User_pkey", 146 | DROP COLUMN "id", 147 | ADD COLUMN "id" UUID NOT NULL, 148 | ADD CONSTRAINT "User_pkey" PRIMARY KEY ("id"); 149 | 150 | -- AddForeignKey 151 | ALTER TABLE "Product" ADD CONSTRAINT "Product_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "Brand"("id") ON DELETE SET NULL ON UPDATE CASCADE; 152 | 153 | -- AddForeignKey 154 | ALTER TABLE "Product" ADD CONSTRAINT "Product_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "Category"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 155 | 156 | -- AddForeignKey 157 | ALTER TABLE "Product" ADD CONSTRAINT "Product_seasonId_fkey" FOREIGN KEY ("seasonId") REFERENCES "Season"("id") ON DELETE SET NULL ON UPDATE CASCADE; 158 | 159 | -- AddForeignKey 160 | ALTER TABLE "Order" ADD CONSTRAINT "Order_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 161 | 162 | -- AddForeignKey 163 | ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_orderId_fkey" FOREIGN KEY ("orderId") REFERENCES "Order"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 164 | 165 | -- AddForeignKey 166 | ALTER TABLE "OrderItem" ADD CONSTRAINT "OrderItem_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 167 | 168 | -- AddForeignKey 169 | ALTER TABLE "Review" ADD CONSTRAINT "Review_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 170 | 171 | -- AddForeignKey 172 | ALTER TABLE "Review" ADD CONSTRAINT "Review_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 173 | 174 | -- AddForeignKey 175 | ALTER TABLE "Cart" ADD CONSTRAINT "Cart_productId_fkey" FOREIGN KEY ("productId") REFERENCES "Product"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 176 | 177 | -- AddForeignKey 178 | ALTER TABLE "Cart" ADD CONSTRAINT "Cart_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; 179 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "commonjs", /* Specify what module code is generated. */ 29 | // "rootDir": "./", /* Specify the root folder within your source files. */ 30 | // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ 31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 38 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ 39 | // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */ 40 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ 41 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ 42 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ 43 | // "noUncheckedSideEffectImports": true, /* Check side effect imports. */ 44 | // "resolveJsonModule": true, /* Enable importing .json files. */ 45 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ 46 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 47 | 48 | /* JavaScript Support */ 49 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 50 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 51 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 52 | 53 | /* Emit */ 54 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 55 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 56 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 57 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 58 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 59 | // "noEmit": true, /* Disable emitting files from a compilation. */ 60 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 61 | // "outDir": "./", /* Specify an output folder for all emitted files. */ 62 | // "removeComments": true, /* Disable emitting comments. */ 63 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 64 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 65 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 66 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 67 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 68 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 69 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 70 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 71 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 72 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 73 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 74 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 75 | 76 | /* Interop Constraints */ 77 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 78 | // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ 79 | // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */ 80 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 81 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 82 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 83 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 84 | 85 | /* Type Checking */ 86 | "strict": true, /* Enable all strict type-checking options. */ 87 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 88 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 89 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 90 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 91 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 92 | // "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */ 93 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 94 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 95 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 96 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 97 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 98 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 99 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 100 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 101 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 102 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 103 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 104 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 105 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 106 | 107 | /* Completeness */ 108 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 109 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 110 | } 111 | } 112 | --------------------------------------------------------------------------------