Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
onosendi committed Oct 7, 2021
0 parents commit 9305256
Show file tree
Hide file tree
Showing 224 changed files with 17,004 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"airbnb"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"import/prefer-default-export": "off",
"react/jsx-props-no-spreading": "off",
"no-console": [1, { "allow": ["warn", "error"]}],
"react/react-in-jsx-scope": "off",
"global-require": "off",
"jsx-a11y/anchor-is-valid": "off",
"max-len": "off"
}
}
115 changes: 115 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next
out/
.vercel

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

*.map
build/
.env.json
.DS_Store

# product feedback
/product-feedback/public/media/user-images/*
!/product-feedback/public/media/user-images/image-*
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Audiophile

## Installation

### Application

#### Clone Repository

```
git clone https://github.com/onosendi/audiophile.git
cd audiophile
```

#### Environment Variables

Create `.env` file next to `package.json` with the following data:

```
NEXT_PUBLIC_APP_NAME=audiophile
DB_USER=audiophile
DB_PASSWORD=audiophile
DB_NAME=audiophile
DB_DEBUG=false
```

### NPM

```
npm install
```

### PostgreSQL

#### Set Up Database

Enter PostgreSQL shell with administrator privileges:

```
psql postgres
```

Create database, user, and grant privileges:

```sql
create database audiophile;
create user audiophile with encrypted password 'audiophile';
grant all privileges on database audiophile to audiophile;
```

#### Migration And Data

```
npx knex migrate:latest
npx knex seed:run
```

### Run Server

```
npm run dev
```
11 changes: 11 additions & 0 deletions database/migrations/20210520193817_category_initial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports.up = (knex) => knex.schema.createTable('category', (t) => {
t.increments('id');
t.string('name', 200).notNullable();
t.string('slug', 200).notNullable();
t.integer('order').unsigned().notNullable();

t.unique('slug');
t.index(['slug', 'order']);
});

exports.down = (knex) => knex.schema.dropTableIfExists('category');
23 changes: 23 additions & 0 deletions database/migrations/20210520200153_product_initial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
exports.up = (knex) => knex.schema.createTable('product', (t) => {
t.increments();
t.string('name', 200).notNullable();
t.string('shortName', 15).notNullable();
t.string('slug', 200).notNullable();
t.text('shortDescription').notNullable();
t.text('longDescription').notNullable();
t.decimal('price', 10, 2).unsigned().notNullable();
t.boolean('new').defaultTo(false);
t.integer('order').unsigned().notNullable();
t
.integer('categoryId')
.unsigned()
.references('id')
.inTable('category')
.onDelete('CASCADE')
.notNullable();

t.unique('slug');
t.index(['slug', 'order']);
});

exports.down = (knex) => knex.schema.dropTableIfExists('product');
15 changes: 15 additions & 0 deletions database/migrations/20210520204414_productImage_initial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
exports.up = (knex) => knex.schema.createTable('productImage', (t) => {
t.increments();
t.string('mobile').notNullable();
t.string('tablet').notNullable();
t.string('desktop').notNullable();
t
.integer('productId')
.unsigned()
.references('id')
.inTable('product')
.onDelete('CASCADE')
.notNullable();
});

exports.down = (knex) => knex.schema.dropTableIfExists('productImage');
16 changes: 16 additions & 0 deletions database/migrations/20210520204548_productGallery_initial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
exports.up = (knex) => knex.schema.createTable('productGallery', (t) => {
t.string('mobile').notNullable();
t.string('tablet').notNullable();
t.string('desktop').notNullable();
t.text('description').notNullable();
t.integer('order').unsigned().notNullable();
t
.integer('productId')
.unsigned()
.references('id')
.inTable('product')
.onDelete('CASCADE')
.notNullable();
});

exports.down = (knex) => knex.schema.dropTableIfExists('productGallery');
15 changes: 15 additions & 0 deletions database/migrations/20210520204934_productBox_initial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
exports.up = (knex) => knex.schema.createTable('productBox', (t) => {
t.string('item').notNullable();
t.integer('quantity').unsigned().notNullable();
t.integer('order').unsigned().notNullable();
t
.integer('productId')
.unsigned()
.references('id')
.inTable('product')
.onDelete('CASCADE')
.notNullable();
t.index('order');
});

exports.down = (knex) => knex.schema.dropTableIfExists('productBox');
8 changes: 8 additions & 0 deletions database/seeds/20210520205554_categories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
exports.seed = async (knex) => {
await knex('category').del();
return knex('category').insert([
{ name: 'Headphones', slug: 'headphones', order: 1 },
{ name: 'Speakers', slug: 'speakers', order: 2 },
{ name: 'Earphones', slug: 'earphones', order: 3 },
]);
};
74 changes: 74 additions & 0 deletions database/seeds/20210520210832_products.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
exports.seed = async (knex) => {
await knex('product').del();
const categories = await knex('category');
const getId = (slug) => categories.find((category) => category.slug === slug).id;

return knex('product').insert([
{
name: 'XX99 Mark II Headphones',
shortName: 'XX99 Mark II',
slug: 'xx99-mark-ii-headphones',
shortDescription: 'The new XX99 Mark II headphones is the pinnacle of pristine audio. It redefines your premium headphone experience by reproducing the balanced depth and precision of studio-quality sound.',
longDescription: 'Featuring a genuine leather head strap and premium earcups, these headphones deliver superior comfort for those who like to enjoy endless listening. It includes intuitive controls designed for any situation. Whether you’re taking a business call or just in your own personal space, the auto on/off and pause features ensure that you’ll never miss a beat.\n\nThe advanced Active Noise Cancellation with built-in equalizer allow you to experience your audio world on your terms. It lets you enjoy your audio in peace, but quickly interact with your surroundings when you need to. Combined with Bluetooth 5. 0 compliant connectivity and 17 hour battery life, the XX99 Mark II headphones gives you superior sound, cutting-edge technology, and a modern design aesthetic.',
price: 2999.00,
new: true,
order: 1,
categoryId: getId('headphones'),
},
{
name: 'XX99 Mark I Headphones',
shortName: 'XX99 Mark I',
slug: 'xx99-mark-i-headphones',
shortDescription: 'As the gold standard for headphones, the classic XX99 Mark I offers detailed and accurate audio reproduction for audiophiles, mixing engineers, and music aficionados alike in studios and on the go.',
longDescription: 'As the headphones all others are measured against, the XX99 Mark I demonstrates over five decades of audio expertise, redefining the critical listening experience. This pair of closed-back headphones are made of industrial, aerospace-grade materials to emphasize durability at a relatively light weight of 11 oz.\n\nFrom the handcrafted microfiber ear cushions to the robust metal headband with inner damping element, the components work together to deliver comfort and uncompromising sound. Its closed-back design delivers up to 27 dB of passive noise cancellation, reducing resonance by reflecting sound to a dedicated absorber. For connectivity, a specially tuned cable is included with a balanced gold connector.',
price: 1750.00,
new: false,
order: 2,
categoryId: getId('headphones'),
},
{
name: 'XX59 Headphones',
shortName: 'XX59',
slug: 'xx59-headphones',
shortDescription: 'Enjoy your audio almost anywhere and customize it to your specific tastes with the XX59 headphones. The stylish yet durable versatile wireless headset is a brilliant companion at home or on the move.',
longDescription: 'These headphones have been created from durable, high-quality materials tough enough to take anywhere. Its compact folding design fuses comfort and minimalist style making it perfect for travel. Flawless transmission is assured by the latest wireless technology engineered for audio synchronization with videos.\n\nMore than a simple pair of headphones, this headset features a pair of built-in microphones for clear, hands-free calling when paired with a compatible smartphone. Controlling music and calls is also intuitive thanks to easy-access touch buttons on the earcups. Regardless of how you use the XX59 headphones, you can do so all day thanks to an impressive 30-hour battery life that can be rapidly recharged via USB-C.',
price: 899.00,
new: false,
order: 3,
categoryId: getId('headphones'),
},
{
name: 'ZX9 Speaker',
shortName: 'ZX9',
slug: 'zx9-speaker',
shortDescription: 'Upgrade your sound system with the all new ZX9 active speaker. It’s a bookshelf speaker system that offers truly wireless connectivity -- creating new possibilities for more pleasing and practical audio setups.',
longDescription: 'Connect via Bluetooth or nearly any wired source. This speaker features optical, digital coaxial, USB Type-B, stereo RCA, and stereo XLR inputs, allowing you to have up to five wired source devices connected for easy switching. Improved bluetooth technology offers near lossless audio quality at up to 328ft (100m).\n\nDiscover clear, more natural sounding highs than the competition with ZX9’s signature planar diaphragm tweeter. Equally important is its powerful room-shaking bass courtesy of a 6.5” aluminum alloy bass unit. You’ll be able to enjoy equal sound quality whether in a large room or small den. Furthermore, you will experience new sensations from old songs since it can respond to even the subtle waveforms.',
price: 4500.00,
new: true,
order: 1,
categoryId: getId('speakers'),
},
{
name: 'ZX7 Speaker',
shortName: 'ZX7',
slug: 'zx7-speaker',
shortDescription: 'Stream high quality sound wirelessly with minimal to no loss. The ZX7 speaker uses high-end audiophile components that represents the top of the line powered speakers for home or studio use.',
longDescription: 'Reap the advantages of a flat diaphragm tweeter cone. This provides a fast response rate and excellent high frequencies that lower tiered bookshelf speakers cannot provide. The woofers are made from aluminum that produces a unique and clear sound. XLR inputs allow you to connect to a mixer for more advanced usage.\n\nThe ZX7 speaker is the perfect blend of stylish design and high performance. It houses an encased MDF wooden enclosure which minimises acoustic resonance. Dual connectivity allows pairing through bluetooth or traditional optical and RCA input. Switch input sources and control volume at your finger tips with the included wireless remote. This versatile speaker is equipped to deliver an authentic listening experience.',
price: 3500.00,
new: false,
order: 2,
categoryId: getId('speakers'),
},
{
name: 'YX1 Wireless Earphones',
shortName: 'YX1',
slug: 'yx1-wireless-earphones',
shortDescription: 'Tailor your listening experience with bespoke dynamic drivers from the new YX1 Wireless Earphones. Enjoy incredible high-fidelity sound even in noisy environments with its active noise cancellation feature.',
longDescription: 'Experience unrivalled stereo sound thanks to innovative acoustic technology. With improved ergonomics designed for full day wearing, these revolutionary earphones have been finely crafted to provide you with the perfect fit, delivering complete comfort all day long while enjoying exceptional noise isolation and truly immersive sound.\n\nThe YX1 Wireless Earphones features customizable controls for volume, music, calls, and voice assistants built into both earbuds. The new 7-hour battery life can be extended up to 28 hours with the charging case, giving you uninterrupted play time. Exquisite craftsmanship with a splash resistant design now available in an all new white and grey color scheme as well as the popular classic black.',
price: 599.00,
new: true,
order: 1,
categoryId: getId('earphones'),
},
]);
};
Loading

0 comments on commit 9305256

Please sign in to comment.