2.0.1 • Published 3 years ago
backend_for_noobs v2.0.1
backend_for_noobs
Instructions:
npm install backend_for_noobs
const backend_for_noobs = require('backend_for_noobs')
await getOneUserById(knex, 3)
await noobs.mostRecentlyCreatedProblems(filename, 4)
await noobs.mostRecentlyCreatedTasks(filename, 4)
await noobs.mostRecentlyCreatedTagSnippets(filename, 4)
await noobs.mostRecentlyCreatedCheatsheets(filename, 4)
await noobs.deadlineProblems(filename, 4)
await noobs.deadlineTasks(filename, 4)
await noobs.deadlineTagSnippets(filename, 4)
await noobs.deadlineCheatsheets(filename, 4)
await noobs.difficultProblems(filename, 4)
await noobs.difficultTasks(filename, 4)
await noobs.difficultTagSnippets(filename, 4)
await noobs.difficultCheatsheets(filename, 4)
await noobs.getAllHourglass(filename, 4)
await noobs.getAllProblems(filename, 4)
await noobs.getAllTasks(filename, 4)
await noobs.getAllTagSnippets(filename, 4)
await noobs.getAllCheatsheets(filename, 4)
await noobs.getOneProblemById(filename, 4, 10)
await noobs.getOneCheatsheetById(filename, 4, 3)
await noobs.getOneTaskById(filename, 4, 79)
await noobs.getOneTagSnippetById(filename, 4, 18)
await noobs.importantProblems(filename, 4)
await noobs.importantTasks(filename, 4)
await noobs.importantTagSnippets(filename, 4)
await noobs.importantCheatsheets(filename, 4)
await noobs.addCheatsheetToProblem(filename, 4, 139, 10)
await noobs.addTaskToProblem(filename, 4, 139, 4)
await noobs.addTagSnippetToProblem(filename, 4, 139, 1)
await noobs.getAllProblemTasks(filename, 4, 32)
await noobs.getOneProblemTasks(filename, 4, 32)
await noobs.getProblemCheatsheets(filename, 4)
await noobs.getOneProblemCheatsheets(filename, 4, 139)
await noobs.getProblemTagSnippets(filename, 4)
await noobs.getOneProblemTagSnippets(filename, 4, 139)
await noobs.publicToPrivateProblems(filename, 4)
await noobs.publicToPrivateTasks(filename, 4)
await noobs.publicToPrivateTagSnippets(filename, 4)
await noobs.publicToPrivateCheatsheets(filename, 4)
await noobs.getAllPublicProblems(filename, 4)
await noobs.getAllPublicCheatsheets(filename, 4)
await noobs.getAllPublicTasks(filename, 4)
await noobs.getAllPublicTagSnippets(filename, 4)
await noobs.mostRecentProblems(filename, 4)
await noobs.mostRecentTasks(filename, 4)
await noobs.mostRecentTagSnippets(filename, 4)
await noobs.mostRecentCheatsheets(filename, 4)
await noobs.masterProblems(filename, 4)
await noobs.masterTasks(filename, 4)
await noobs.masterTagSnippets(filename, 4)
await noobs.masterCheatsheets(filename, 4)
let string = "love"
await noobs.searchProblems(filename, 4, string)
await noobs.searchCheatsheets(filename, 4, string)
await noobs.searchTasks(filename, 4, string)
await noobs.searchTagSnippets(filename, 4, string)
await noobs.searchAll(filename, 4, string)
await noobs.statusOfProblems(filename, 4)
await noobs.statusOfTasks(filename, 4)
await noobs.statusOfTagSnippets(filename, 4)
await noobs.statusOfCheatsheets(filename, 4)
await noobs.timeSpentOnProblems(filename, 4)
await noobs.timeSpentOnTasks(filename, 4)
await noobs.timeSpentOnTagSnippets(filename, 4)
await noobs.timeSpentOnCheatsheets(filename, 4)
await noobs.updateProblem(filename, 4, 139, { importance: 3, difficulty: 2 })
await noobs.updateCheatsheet(filename, 4, 13, { importance: 2, difficulty: 2 })
await noobs.updateTask(filename, 4, 177, { importance: 2 })
await noobs.updateTagSnippet(filename, 4, 10, { importance: 1 })
await noobs.usefulProblems(filename, 4)
await noobs.usefulTasks(filename, 4)
await noobs.usefulTagSnippets(filename, 4)
await noobs.usefulCheatsheets(filename, 4)
let sampleUser = {
email: "lesleyc@bu.edu",
password: "testtest"
}
await noobs.postUser(filename, sampleUser)
let followThisUser = { email: "ryan@bu.edu", password: "testtest" }
await noobs.postUser(followThisUser)
let sampleObject = { user_id: 1, problem: "we are scared", whatshouldbe: "we should be less frightened", whatactuallyis: "we get scared all the time", hypothesis: "don't forget who loved you", plan: "Depend on love, rather than validation", difficulty: 2, usefulness: 3, end: "2022-03-27" }
await noobs.postProblem(filename, sampleObject)
let sampleTask = { user_id: 1, name: "KEEP IT SIMPLE STUPID", difficulty: 2, usefulness: 1, importance: 1, end: "2022-03-15" }
await noobs.postTask(filename, sampleTask)
let sampleCheatsheet = { user_id: 1, importance: 2, usefulness: 3, title: "getting things done", key_info: "just do it", description: "be more like water", structure: "think less" }
await noobs.postCheatsheet(filename, sampleCheatsheet)
let sampleTagSnippet = { tag_snippet_id: 18, task_id: 4, hourglass_id: 330, tag: 'quote', snippet: 'be more selfish with your time. this is your life. reach your own goals. be more confident in yourself, you got this. i want cyrus on my team', user_id: 1, importance: 1, difficulty: 2, public: true, status: 'to do', usefulness: 1, }
await noobs.postTagSnippet(filename, sampleTagSnippet)
let sampleFollowSomeone = { user_id: 1, follow_user_id: 2, edit: "2022-03-15" }
await noobs.postFollow(sampleFollowSomeone)
let addTaskToCheatsheet = { cheatsheet_id: 1, task_id: 1 }
await noobs.getAllProblemJoins(filename, 4)
await noobs.getOneProblemJoin(filename, 4, 139)
await noobs.getOneCheatsheetJoin(filename, 4, 10)
await noobs.addCheatsheetToProblem(filename, 4, 139, 10)
await noobs.getProblemCheatsheets(filename, 4)
await noobs.getOneProblemCheatsheets(filename, 4, 139)
await noobs.addTaskToProblem(filename, 4, 139, 4)
await noobs.getAllProblemTasks(filename, 4)
await noobs.getOneProblemTasks(filename, 4, 139)
await noobs.addTagSnippetToProblem(filename, 4, 139, 1)
await noobs.getProblemTagSnippets(filename, 4)
await noobs.getOneProblemTagSnippets(filename, 4, 139)
await noobs.addTaskToCheatsheet(filename, 4, 10, 1)
await noobs.getAllCheatsheetTasks(filename, 4)
await noobs.getOneCheatsheetTask(filename, 4, 10)
await noobs.addTagSnippetToCheatsheet(filename, 4, 10, 1)
await noobs.getAllCheatsheetTagSnippets(filename, 4)
await noobs.getOneCheatsheetTagSnippet(filename, 4, 10)
await noobs.addTagSnippetToTask(filename, 4, 10, 1)
await noobs.getAllTaskTagSnippets(filename, 4)
await noobs.getOneTaskTagSnippets(filename, 4, 10)
await signup(knex, userOne) // name, email, password, timezone
await login(knex, userOne)
await verifyUserRoute(knex, 3) // returns boolean
await getOneUserById(knex, 3)
await getUserTimezone(knex, user_id)
Functions
signup() ⇒ any
Kind: global function
Date: 2022-03-20
Author: zen-out
Example
/**
Example
let sampleObject = {
email: "asdfasdf213@gmdail.com",
password: "asdfasdf",
type: "chrome",
device: "desktop"
}
let sampleObject2 = {
email: "lesle3yc2@gmail.com",
password: "orangeorange"
}
// let firstSignup = await signup(knex, sampleObject)
// see.done("signup", firstSignup)
let firstLogin = await login(knex, sampleObject)
see.done("login", firstLogin)
let verify = await verifyUserRoute(knex, 18, 14)
see.done("verify route" + verify)
login(knex, userObject) ⇒ any
Kind: global function
Date: 2022-03-20
Author: zen-out
Param | Type |
---|---|
knex | any |
userObject | any |
Example
let sampleObject = {
email: "asdfasdf213@gmdail.com",
password: "asdfasdf",
type: "chrome",
device: "desktop"
}
let sampleObject2 = {
email: "lesle3yc2@gmail.com",
password: "orangeorange"
}
// let firstSignup = await signup(knex, sampleObject)
// see.done("signup", firstSignup)
let firstLogin = await login(knex, sampleObject)
see.done("login", firstLogin)
let verify = await verifyUserRoute(knex, 18, 14)
see.done("verify route" + verify)
verifyUserRoute(req, res, next) ⇒ boolean
- Checks if user is logged in
- Checks if the last logged in date is within 14 days
Kind: global function
Date: 2022-03-16
Author: zen-out
Param | Type |
---|---|
req | any |
res | any |
next | any |
Example
// let verify = await verifyUserRoute(sampleRequest, knex)
logout(knex, number) ⇒ boolean
Kind: global function
Date: 2022-03-20
Author: zen-out
Param | Type |
---|---|
knex | any |
number | any |
Example
// let test_logout = await logout(knex, 18)
mostRecentlyCreatedProblems(knex, user_id) ⇒ any
mostRecentlyCreatedProblems(knex, user_id)
Kind: global function
Date: 2022-03-22
Author: zen-out
Param | Type |
---|---|
knex | any |
user_id | any |
getUserTimezone()
Kind: global function
Author: github.com/zen-out
Example
await getUserTimezone(knex, user_id)
2.0.1
3 years ago
2.0.0
3 years ago
1.5.5
3 years ago
1.5.4
3 years ago
1.5.2
3 years ago
1.5.1
3 years ago
1.2.14
3 years ago
1.2.13
3 years ago
1.2.10
3 years ago
1.2.9
3 years ago
1.2.8
3 years ago
1.2.7
3 years ago
1.2.6
3 years ago
1.2.5
3 years ago
1.2.4
3 years ago
1.2.3
3 years ago
1.2.2
3 years ago
1.2.1
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago