Leke
Leke
Explore posts from servers
KPCKevin Powell - Community
Created by Leke on 7/18/2023 in #back-end
AutoIncrement using mongoose
Please Guys what is the best way to implement AutoIncrement using mongoose, i tried the best two option and it wasnt working mongoose-sequence mongoose-auto-increment
const AutoIncrement = require('mongoose-sequence')(mongoose)

interface userTracks extends IUserTrack, mongoose.Document {}

const userModel = new mongoose.Schema(
{
fullName: {
type: String,
unique: false,
lowercase: true
},
email: {
type: String,
unique: true,
lowercase: true
},
phone: {
type: String
},
country: {
type: String,
unique: false,
lowercase: true
}
},
{ timestamps: true }
)

userModel.plugin(AutoIncrement, { inc_field: 'ticketNo', start_seq: 1000 })

export default mongoose.model<userTracks>('users', userModel)
const AutoIncrement = require('mongoose-sequence')(mongoose)

interface userTracks extends IUserTrack, mongoose.Document {}

const userModel = new mongoose.Schema(
{
fullName: {
type: String,
unique: false,
lowercase: true
},
email: {
type: String,
unique: true,
lowercase: true
},
phone: {
type: String
},
country: {
type: String,
unique: false,
lowercase: true
}
},
{ timestamps: true }
)

userModel.plugin(AutoIncrement, { inc_field: 'ticketNo', start_seq: 1000 })

export default mongoose.model<userTracks>('users', userModel)
6 replies
TTCTheo's Typesafe Cult
Created by Leke on 7/18/2023 in #questions
AutoIncrement using mongoose
Please Guys what is the best way to implement AutoIncrement using mongoose, i tried the best two option and it wasnt working mongoose-sequence mongoose-auto-increment
const AutoIncrement = require('mongoose-sequence')(mongoose)

interface userTracks extends IUserTrack, mongoose.Document {}

const userModel = new mongoose.Schema(
{
fullName: {
type: String,
unique: false,
lowercase: true
},
email: {
type: String,
unique: true,
lowercase: true
},
phone: {
type: String
},
country: {
type: String,
unique: false,
lowercase: true
}
},
{ timestamps: true }
)

userModel.plugin(AutoIncrement, { inc_field: 'ticketNo', start_seq: 1000 })

export default mongoose.model<userTracks>('users', userModel)
const AutoIncrement = require('mongoose-sequence')(mongoose)

interface userTracks extends IUserTrack, mongoose.Document {}

const userModel = new mongoose.Schema(
{
fullName: {
type: String,
unique: false,
lowercase: true
},
email: {
type: String,
unique: true,
lowercase: true
},
phone: {
type: String
},
country: {
type: String,
unique: false,
lowercase: true
}
},
{ timestamps: true }
)

userModel.plugin(AutoIncrement, { inc_field: 'ticketNo', start_seq: 1000 })

export default mongoose.model<userTracks>('users', userModel)
3 replies
KPCKevin Powell - Community
Created by Leke on 6/13/2023 in #front-end
Attempted to load @next/swc-darwin-x64
I just created a new nextjs project and the first time i run the dev server i am seeing some errors in the console but the app running and i dont know if this will affect my project, please how do i resolve this issue?
> next dev

- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- info Using wasm build of next-swc
- warn Attempted to load @next/swc-darwin-x64, but an error occurred:
> next dev

- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- info Using wasm build of next-swc
- warn Attempted to load @next/swc-darwin-x64, but an error occurred:
1 replies
TTCTheo's Typesafe Cult
Created by Leke on 6/12/2023 in #questions
Attempted to load @next/swc-darwin-x64
I just created a new nextjs project and the first time i run the dev server i am seeing some errors in the console but the app running and i dont know if this will affect my project, please how do i resolve this issue?
> next dev

- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- info Using wasm build of next-swc
- warn Attempted to load @next/swc-darwin-x64, but an error occurred:
> next dev

- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- info Using wasm build of next-swc
- warn Attempted to load @next/swc-darwin-x64, but an error occurred:
1 replies
TTCTheo's Typesafe Cult
Created by Leke on 5/29/2023 in #questions
[vite-plugin-sass] Unexpected token u in JSON at position 0 error
I just migrated my react sass application from webpack to Vite but I haven’t been able to build since the migration took place. The error below is what I encounter
> vite build

vite v4.3.9 building for production...
125 modules transformed.
✓ built in 3.60s
[vite-plugin-sass] Unexpected token u in JSON at position 0
file: /Users/project/src/assets/css/sass/main.scss
error during build:
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object.transformReducer (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23567:81)
at file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:24590:140
at async transform (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23576:16)
at async ModuleLoader.addModuleSource (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23782:30)
> vite build

vite v4.3.9 building for production...
125 modules transformed.
✓ built in 3.60s
[vite-plugin-sass] Unexpected token u in JSON at position 0
file: /Users/project/src/assets/css/sass/main.scss
error during build:
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object.transformReducer (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23567:81)
at file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:24590:140
at async transform (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23576:16)
at async ModuleLoader.addModuleSource (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23782:30)
main.scss
@use "./_01_mixins.scss" as *;
@use "./_02_variables" as *;
@use "./_03_core.scss" as *;
@use "./_04_plugins.scss" as *;
@use "./_05_views.scss" as *;
@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap");

/** your custom css code **/
#root {
min-width: 320px;
}
.container-fluid {
max-width: 2000px;
}
.btn-link,
.btn-link:hover {
font-weight: 500 !important;
}
a.white:hover,
a.white:active {
color: $theme-color-1 !important;
}
label {
font-weight: 600 !important;
font-size: 90% !important;
}
a,
button,
input,
.sidebar .main-menu ul li a {
transition: color 0.5s, border 0.5s, background 0.5s, opacity 0.5s,
height 0.5s;
}
.sidebar .main-menu ul li a {
padding: 0 10px;
line-height: 1.2;
text-align: center;
}
.btn-primary {
color: #fff !important;
}
.has-float-label label {
z-index: 10000;
}
@use "./_01_mixins.scss" as *;
@use "./_02_variables" as *;
@use "./_03_core.scss" as *;
@use "./_04_plugins.scss" as *;
@use "./_05_views.scss" as *;
@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap");

/** your custom css code **/
#root {
min-width: 320px;
}
.container-fluid {
max-width: 2000px;
}
.btn-link,
.btn-link:hover {
font-weight: 500 !important;
}
a.white:hover,
a.white:active {
color: $theme-color-1 !important;
}
label {
font-weight: 600 !important;
font-size: 90% !important;
}
a,
button,
input,
.sidebar .main-menu ul li a {
transition: color 0.5s, border 0.5s, background 0.5s, opacity 0.5s,
height 0.5s;
}
.sidebar .main-menu ul li a {
padding: 0 10px;
line-height: 1.2;
text-align: center;
}
.btn-primary {
color: #fff !important;
}
.has-float-label label {
z-index: 10000;
}
3 replies
KPCKevin Powell - Community
Created by Leke on 5/29/2023 in #front-end
[vite-plugin-sass] Unexpected token u in JSON at position 0
I just migrated my react sass application from webpack to Vite but I haven’t been able to build since the migration took place. The error below is what I encounter
> vite build

vite v4.3.9 building for production...
125 modules transformed.
✓ built in 3.60s
[vite-plugin-sass] Unexpected token u in JSON at position 0
file: /Users/project/src/assets/css/sass/main.scss
error during build:
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object.transformReducer (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23567:81)
at file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:24590:140
at async transform (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23576:16)
at async ModuleLoader.addModuleSource (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23782:30)
> vite build

vite v4.3.9 building for production...
125 modules transformed.
✓ built in 3.60s
[vite-plugin-sass] Unexpected token u in JSON at position 0
file: /Users/project/src/assets/css/sass/main.scss
error during build:
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at Object.transformReducer (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23567:81)
at file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:24590:140
at async transform (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23576:16)
at async ModuleLoader.addModuleSource (file:///Users//node_modules/rollup/dist/es/shared/node-entry.js:23782:30)
main.scss
@use "./_01_mixins.scss" as *;
@use "./_02_variables" as *;
@use "./_03_core.scss" as *;
@use "./_04_plugins.scss" as *;
@use "./_05_views.scss" as *;
@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap");

/** your custom css code **/
#root {
min-width: 320px;
}
.container-fluid {
max-width: 2000px;
}
.btn-link,
.btn-link:hover {
font-weight: 500 !important;
}
a.white:hover,
a.white:active {
color: $theme-color-1 !important;
}
label {
font-weight: 600 !important;
font-size: 90% !important;
}
a,
button,
input,
.sidebar .main-menu ul li a {
transition: color 0.5s, border 0.5s, background 0.5s, opacity 0.5s,
height 0.5s;
}
.sidebar .main-menu ul li a {
padding: 0 10px;
line-height: 1.2;
text-align: center;
}
.btn-primary {
color: #fff !important;
}
.has-float-label label {
z-index: 10000;
}
@use "./_01_mixins.scss" as *;
@use "./_02_variables" as *;
@use "./_03_core.scss" as *;
@use "./_04_plugins.scss" as *;
@use "./_05_views.scss" as *;
@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap");

/** your custom css code **/
#root {
min-width: 320px;
}
.container-fluid {
max-width: 2000px;
}
.btn-link,
.btn-link:hover {
font-weight: 500 !important;
}
a.white:hover,
a.white:active {
color: $theme-color-1 !important;
}
label {
font-weight: 600 !important;
font-size: 90% !important;
}
a,
button,
input,
.sidebar .main-menu ul li a {
transition: color 0.5s, border 0.5s, background 0.5s, opacity 0.5s,
height 0.5s;
}
.sidebar .main-menu ul li a {
padding: 0 10px;
line-height: 1.2;
text-align: center;
}
.btn-primary {
color: #fff !important;
}
.has-float-label label {
z-index: 10000;
}
1 replies
KPCKevin Powell - Community
Created by Leke on 3/6/2023 in #front-end
React Query state management
Can other states management tools be ignored over React Query being used for state management in a react application?
8 replies
TTCTheo's Typesafe Cult
Created by Leke on 3/1/2023 in #questions
node-canvas error
node-canvas error
Is there any other library I can use since `node-canvas` seems to be an issue, please recommend.
Is there any other library I can use since `node-canvas` seems to be an issue, please recommend.
I tried using node-canvas with jsbarcode to process barcode from a node application but node-canvas seems to be an issue ever since I tried implementing using it.I have tried rebuilding from source yet the error still a blocker.
node:internal/modules/cjs/loader:1302
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: dlopen(/Users/mac/node_modules/canvas/build/Release/canvas.node, 1): Library not loaded: @loader_path/libpixman-1.0.42.2.dylib
Referenced from: /Users/mac/node_modules/canvas/build/Release/canvas.node
Reason: no suitable image found. Did find:
/Users/mac/node_modules/canvas/build/Release/libpixman-1.0.42.2.dylib: cannot load 'libpixman-1.0.42.2.dylib' (load command 0x80000034 is unknown)
/Users/mac/node_modules/canvas/build/Release/libpixman-1.0.42.2.dylib: cannot load 'libpixman-1.0.42.2.dylib' (load command 0x80000034 is unknown)

Node.js v18.13.0
[nodemon] app crashed - waiting for file changes before starting…
node:internal/modules/cjs/loader:1302
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: dlopen(/Users/mac/node_modules/canvas/build/Release/canvas.node, 1): Library not loaded: @loader_path/libpixman-1.0.42.2.dylib
Referenced from: /Users/mac/node_modules/canvas/build/Release/canvas.node
Reason: no suitable image found. Did find:
/Users/mac/node_modules/canvas/build/Release/libpixman-1.0.42.2.dylib: cannot load 'libpixman-1.0.42.2.dylib' (load command 0x80000034 is unknown)
/Users/mac/node_modules/canvas/build/Release/libpixman-1.0.42.2.dylib: cannot load 'libpixman-1.0.42.2.dylib' (load command 0x80000034 is unknown)

Node.js v18.13.0
[nodemon] app crashed - waiting for file changes before starting…
6 replies
KPCKevin Powell - Community
Created by Leke on 3/1/2023 in #back-end
node-canvas error
node-canvas error
Is there any other library I can use since `node-canvas` seems to be an issue, please recommend.
Is there any other library I can use since `node-canvas` seems to be an issue, please recommend.
I tried using node-canvas with jsbarcode to process barcode from a node application but node-canvas seems to be an issue ever since I tried implementing using it.I have tried rebuilding from source yet the error still a blocker.
node:internal/modules/cjs/loader:1302
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: dlopen(/Users/mac/node_modules/canvas/build/Release/canvas.node, 1): Library not loaded: @loader_path/libpixman-1.0.42.2.dylib
Referenced from: /Users/mac/node_modules/canvas/build/Release/canvas.node
Reason: no suitable image found. Did find:
/Users/mac/node_modules/canvas/build/Release/libpixman-1.0.42.2.dylib: cannot load 'libpixman-1.0.42.2.dylib' (load command 0x80000034 is unknown)
/Users/mac/node_modules/canvas/build/Release/libpixman-1.0.42.2.dylib: cannot load 'libpixman-1.0.42.2.dylib' (load command 0x80000034 is unknown)

Node.js v18.13.0
[nodemon] app crashed - waiting for file changes before starting…
node:internal/modules/cjs/loader:1302
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: dlopen(/Users/mac/node_modules/canvas/build/Release/canvas.node, 1): Library not loaded: @loader_path/libpixman-1.0.42.2.dylib
Referenced from: /Users/mac/node_modules/canvas/build/Release/canvas.node
Reason: no suitable image found. Did find:
/Users/mac/node_modules/canvas/build/Release/libpixman-1.0.42.2.dylib: cannot load 'libpixman-1.0.42.2.dylib' (load command 0x80000034 is unknown)
/Users/mac/node_modules/canvas/build/Release/libpixman-1.0.42.2.dylib: cannot load 'libpixman-1.0.42.2.dylib' (load command 0x80000034 is unknown)

Node.js v18.13.0
[nodemon] app crashed - waiting for file changes before starting…
4 replies
TTCTheo's Typesafe Cult
Created by Leke on 2/22/2023 in #questions
Build failed due to import error
Build failed due to import error After running the build command for my react app the build failed and the below is the response I get.
Creating an optimized production build...
Failed to compile.

Attempted import error: 'LowPriority' is not exported from 'scheduler' (imported as 'LowPriority’).
Creating an optimized production build...
Failed to compile.

Attempted import error: 'LowPriority' is not exported from 'scheduler' (imported as 'LowPriority’).
package.json
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test"
},
An ideal on how to resolve this issue will be much appreciated.
2 replies
KPCKevin Powell - Community
Created by Leke on 2/22/2023 in #front-end
Build failed due to import error
Build failed due to import error After running the build command for my react app the build failed and the below is the response I get.
Creating an optimized production build...
Failed to compile.

Attempted import error: 'LowPriority' is not exported from 'scheduler' (imported as 'LowPriority’).
Creating an optimized production build...
Failed to compile.

Attempted import error: 'LowPriority' is not exported from 'scheduler' (imported as 'LowPriority’).
package.json
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test"
},
An ideal on how to resolve this issue will be much appreciated.
4 replies
TTCTheo's Typesafe Cult
Created by Leke on 2/21/2023 in #questions
Auto select country flag when country code is provided
I am building a React project and it is required I implement a functionality that allow users to provide their phone number in an input tag with the country code and immediately the country code is provided then the flag of the country appears respectively. Is there a library I can use to achieve this or an API?
3 replies
KPCKevin Powell - Community
Created by Leke on 2/21/2023 in #front-end
Auto select country flag when country code is provided
I am working on a project and it is required I implement a functionality that allow users to provide their phone number in an input tag with the country code and immediately the country code is provided then the flag of the country appears respectively. Is there a library I can use to achieve this or an API?
5 replies
TTCTheo's Typesafe Cult
Created by Leke on 2/8/2023 in #questions
SCSS Error: can not read files in public path
I have an assets folder that contain some other files with images and svgs in it in the public file of my project so... => navbar.scss ...I declared a variable with path below
$logo-path: "/assets/logos/black.svg”;
$logo-path: "/assets/logos/black.svg”;
Error: Module not found: Error: Can't resolve '../../../logos/mobile.jpg’
Failed to compile.

Module not found: Error: Can't resolve '../../../logos/mobile.jpg' in '/src/assets/css/sass/themes'
ERROR in ./src/assets/css/sass/themes/navbar.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[0].oneOf[7].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[4]!./src/assets/css/sass/themes/navbar.scss) 5:36-100
Module not found: Error: Can't resolve '../../../logos/mobile.jpg' in '/src/assets/css/sass/themes’
Failed to compile.

Module not found: Error: Can't resolve '../../../logos/mobile.jpg' in '/src/assets/css/sass/themes'
ERROR in ./src/assets/css/sass/themes/navbar.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[0].oneOf[7].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[4]!./src/assets/css/sass/themes/navbar.scss) 5:36-100
Module not found: Error: Can't resolve '../../../logos/mobile.jpg' in '/src/assets/css/sass/themes’
1 replies
KPCKevin Powell - Community
Created by Leke on 2/8/2023 in #front-end
SCSS Error: can not read files in public path
I have an assets folder that contain some other files with images and svgs in it in the public file of my project so... => navbar.scss ...I declared a variable with path below
$logo-path: "/assets/logos/black.svg”;
$logo-path: "/assets/logos/black.svg”;
Error: Module not found: Error: Can't resolve '../../../logos/mobile.jpg’
Failed to compile.

Module not found: Error: Can't resolve '../../../logos/mobile.jpg' in '/src/assets/css/sass/themes'
ERROR in ./src/assets/css/sass/themes/navbar.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[0].oneOf[7].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[4]!./src/assets/css/sass/themes/navbar.scss) 5:36-100
Module not found: Error: Can't resolve '../../../logos/mobile.jpg' in '/src/assets/css/sass/themes’
Failed to compile.

Module not found: Error: Can't resolve '../../../logos/mobile.jpg' in '/src/assets/css/sass/themes'
ERROR in ./src/assets/css/sass/themes/navbar.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[0].oneOf[7].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[0].oneOf[7].use[4]!./src/assets/css/sass/themes/navbar.scss) 5:36-100
Module not found: Error: Can't resolve '../../../logos/mobile.jpg' in '/src/assets/css/sass/themes’
17 replies
TTCTheo's Typesafe Cult
Created by Leke on 2/8/2023 in #questions
`Cant install mongodb on mac`
28 replies
KPCKevin Powell - Community
Created by Leke on 2/8/2023 in #back-end
`Cant install mongodb on mac`
4 replies
KPCKevin Powell - Community
Created by Leke on 2/6/2023 in #os-and-tools
0ver a 1000 accounts created per minute
I just discovered in the database that some accounts are being created with random emails, over 30,000 account have being created so far and i really don't know how to stop this, please who's got a better ideal on how to put a stop to this whole mess.
3 replies
TTCTheo's Typesafe Cult
Created by Leke on 1/31/2023 in #questions
`window.scrollY` error `typescript`
3 replies
KPCKevin Powell - Community
Created by Leke on 1/24/2023 in #back-end
How to make SQL Table Column data UNIQUE
I created this Clubs table in my SQL database but I want to make name row unique such that two rows will not have the same name.
CREATE TABLE clubs (
`id` integer PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`league` VARCHAR(45) NOT NULL,
`isActive` BOOLEAN,
created TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE TABLE clubs (
`id` integer PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`league` VARCHAR(45) NOT NULL,
`isActive` BOOLEAN,
created TIMESTAMP NOT NULL DEFAULT NOW()
);
5 replies