KEMBAR78
Nikhil Project File | PDF | World Wide Web | Internet & Web
0% found this document useful (0 votes)
19 views43 pages

Nikhil Project File

The document is a project report titled 'Dropship Academy' submitted by Nikhil for the Bachelor of Technology in Computer Science and Engineering at Haryana Engineering College. It includes certificates of completion, acknowledgments, a table of contents, and sections covering web development, literature survey, system design, project details, partial code, results, and future scope. The project aims to design a course-selling website to assist students in starting their own business.

Uploaded by

singlas030
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views43 pages

Nikhil Project File

The document is a project report titled 'Dropship Academy' submitted by Nikhil for the Bachelor of Technology in Computer Science and Engineering at Haryana Engineering College. It includes certificates of completion, acknowledgments, a table of contents, and sections covering web development, literature survey, system design, project details, partial code, results, and future scope. The project aims to design a course-selling website to assist students in starting their own business.

Uploaded by

singlas030
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

‭PROJECT |||‬

‭ON‬
‭“Dropship Academy"‬

‭SUBMITTED IN PARTIAL FULFILLMENT OF THE AWARD OF THE DEGREE‬


‭OF‬
‭BACHELOR OF TECHNOLOGY‬
‭IN‬
‭COMPUTER SCIENCE AND ENGINEERING‬

‭BATCH-2021-2025‬
‭SUBMITTED BY: Nikhil‬
‭(1821322)‬
‭UNDER THE SUPERVISION OF‬
‭ER. PRERNA DHALL‬

‭(‬‭H.O.D. )‬

‭Department of Computer Science and Engineering‬


‭HARYANA ENGINEERING COLLEGE, JAGADHR‬
‭CERTIFICATE‬

‭This is to certify that‬‭Nikhil, Roll no:1821322‬‭a‬‭bonafide student of Bachelor of Technology in‬


‭Computer Science And Engineering being run by Haryana Engineering College, Jagadhri of batch‬
‭2021-2025 has completed his Project-‬‭|||‬ ‭entitled‬‭“ Dropship Academy"‬‭at HEC, Jagadhri under the‬
‭Supervision of Er. Prerna Dhall.‬

‭Er. Prerna Dhall‬


‭H.O.D‬
‭Department of Computer Science‬
‭CERTIFICATE‬
‭This is to certify that‬‭Nikhil, Roll no:1821322‬‭a bonafide student of Bachelor of Technology in‬
‭Computer Science And Engineering being run by Haryana Engineering College, Jagadhri of batch‬
‭2021-2025 has completed his Project -‬‭|||‬ ‭entitled‬‭“ Dropship Academy"‬‭at HEC, Jagadhri under the‬
‭Supervision of Er. Prerna Dhall.‬

‭It is further certified that the work done in this project is a result of the candidate's own efforts . I wish‬
‭him/her all success in life.‬

‭Er. Prerna Dhall‬


‭Department of Computer Science‬
‭CERTIFICATE‬

‭I /We hereby certify that this work which is presented in the project-I entitled‬‭“‬‭Dropship Academy‬‭”‬
‭in fulfilment of requirement for the award of the degree of Bachelor of Technology and submitted to‬
‭the department of Computer Science and Engineering of Haryana Engineering College (HEC) Jagadhri‬
‭affiliated to Kurukshetra University , Kurukshetra is an authentic record of my/our own, carried out‬
‭during period from September 2024 to November 2024 under the Guidance of Er. Anushka Nagpal.‬

‭The matter presented in this report has not been submitted by me/us for the award of any other degree‬
‭of this or any other Institution/University.‬

‭Nikhil (1821322)‬

‭III‬
‭ACKNOWLEGMENT‬

‭We‬‭wish‬‭to‬‭express‬‭our‬‭deep‬‭sense‬‭of‬‭indebtedness‬‭and‬‭sincerest‬‭gratitude‬‭to‬‭our‬
‭guide,‬ ‭Er.‬ ‭Prerna‬ ‭Dhall‬‭,‬ ‭Department‬ ‭of‬ ‭Computer‬ ‭Science‬ ‭&‬ ‭Engineering,‬
‭Haryana‬‭engineering‬‭College,‬‭Jagadhri,‬‭Haryana,‬‭for‬‭his‬‭invaluable‬‭guidance‬‭and‬
‭constructive‬‭criticism‬‭throughout‬‭this‬‭Project.‬‭He‬‭has‬‭displayed‬‭unique‬‭tolerance‬
‭and‬ ‭understanding‬ ‭at‬ ‭every‬ ‭step‬ ‭of‬‭progress‬‭and‬‭encourages‬‭us.‬‭We‬‭deem‬‭it‬‭our‬
‭privilege to have carried out our project work under his able guidance.‬

‭We‬ ‭would‬ ‭especially‬ ‭like‬ ‭to‬ ‭thank‬ ‭Er.‬ ‭Prerna‬ ‭Dhall‬ ‭(HOD)‬ ‭Department‬ ‭of‬
‭Computer‬ ‭Science‬ ‭&‬ ‭Engineering,‬ ‭Haryana‬ ‭Engineering‬ ‭College,‬ ‭Jagadhri,‬
‭Haryana whom, this work would not have been as it is now.‬

‭As‬‭a‬‭Final‬‭Personal‬‭Note,‬‭We‬‭are‬‭grateful‬‭to‬‭our‬‭parents,‬‭who‬‭are‬‭inspirational‬‭to‬
‭us in their understanding, patience and constant encouragement.‬

‭Nikhil (1821322)‬

‭IV‬
‭TABLE OF CONTENT‬

‭HOD’s‬‭Declaration‬‭Certificate‬‭..........................................................................................................‬‭I‬

‭Guide’s‬‭Declaration‬‭Certificate‬‭.........................................................................................................‬‭II‬

‭Candidate’s‬‭Declaration‬‭Certificate‬‭................................................................................................‬‭III‬

‭Acknowledgement‬‭...............................................................................................................................‬‭IV‬

‭List‬‭Of‬‭Figures‬‭...................................................................................................................................‬‭V‬

‭Abstact‬‭................................................................................................................................................‬‭VI‬

‭Chapter 1: INTRODUCTION………….…………………………………………………….‬

‭●‬ ‭Introduction‬‭to‬‭Web‬‭Development‬‭......................................................................................‬‭1‬
‭●‬ ‭HTML,CSS‬‭And‬‭JAVASCRIPT‬‭.........................................................................................‬‭2-3‬

‭Chapter 2: LITERATURE SURVEY…………………………………………………………..‬

‭●‬ ‭HTML‬‭..................................................................................................................................‬‭4‬
‭●‬ ‭CSS‬‭...................................................................................................................................‬‭5-6‬
‭●‬ ‭JAVSCRIPT‬‭.......................................................................................................................‬‭6-7‬

‭Chapter 3: SYSTEM DESIGN…………………………………………………………………‬

‭●‬ ‭System‬‭Design‬‭...................................................................................................................‬‭8-9‬

‭Chapter 4: PROJECT DETAILS WITH REQUIREMENTS…………………………………..‬

‭●‬ ‭Introduction‬‭to‬‭Project‬‭........................................................................................................‬‭10‬
‭●‬ ‭Terminology‬‭used‬‭................................................................................................................‬‭10‬
‭●‬ ‭Requirements‬‭.......................................................................................................................‬‭11‬

‭Chapter 5: PARTIAL CODE…………………………………………………………………….‬

‭●‬ ‭Project‬‭Code‬‭......................................................................................................................‬‭12-20‬

‭Chapter 6: RESULTS…………………………………………………………………………….‬
‭●‬ ‭The result of the above Project are‬ ‭21-23‬

‭Chapter 7: CONCLUSION AND FUTURE SCOPE…………………………………………‬

‭●‬ ‭Conclusion‬ ‭24‬


‭●‬ ‭Future scope‬ ‭24‬

‭REFRENCES……………………………………………………………………………………‬

‭●‬ ‭Refrences‬ ‭VII‬


‭LIST OF FIGURES‬

‭Figure No.‬ ‭Description‬ ‭Page No.‬

‭1.1‬ ‭Web Development Logo‬ ‭1‬

‭1.2‬ ‭HTML Logo‬ ‭2‬

‭1.3‬ ‭CSS Logo‬ ‭2‬

‭1.4‬ ‭JavaScript Logo‬ ‭3‬

‭2.1‬ ‭Structure of Html‬ ‭4‬

‭2.2‬ ‭CSS versions‬ ‭5‬

‭2.3‬ ‭importing JavaScript‬ ‭7‬

‭5.1‬ ‭Dropshipping Course‬ ‭21‬

‭5.2‬ ‭Dropsoping editing‬ ‭21‬

‭5.3‬ ‭Video View‬ ‭22‬

‭5.4‬ ‭Lectures view‬ ‭22‬

‭5.5‬ ‭Lectures edit mode‬ ‭23‬

‭V‬
‭ABSTRACT‬

‭The‬ ‭goal‬ ‭of‬ ‭this‬ ‭project‬ ‭was‬ ‭to‬ ‭design‬ ‭a‬ ‭course‬ ‭selling‬ ‭website‬ ‭for‬ ‭a‬ ‭graduating‬
‭design‬‭student‬‭and‬‭to‬‭report‬‭on‬‭the‬‭process.‬‭This‬‭project‬‭will‬‭be‬‭used‬‭in‬‭the‬‭real‬‭time‬
‭to provide the course to the student who will buy them manually.‬

‭The‬ ‭objective‬ ‭of‬ ‭this‬ ‭work‬ ‭is‬ ‭to‬ ‭create‬ ‭guidelines‬ ‭for‬ ‭a‬ ‭student‬ ‭or‬ ‭a‬ ‭new‬ ‭starter‬ ‭to‬
‭start‬ ‭their‬ ‭own‬ ‭business‬‭when‬‭they‬‭are‬‭new‬‭to‬‭the‬‭business.‬‭We‬‭sell‬‭the‬‭products‬‭to‬
‭them and they buy them.‬

‭V‬
‭CHAPTER 1‬

‭INTRODUCTION‬
‭CHAPTER 1 INTRODUCTION‬

‭Introduction to Web Development :-‬

‭What is Web Development:‬


‭ eb development‬‭is the work involved in developing‬‭a website for‬
W
‭the Internet (World Wide Web) or an intranet (a private network). Web development‬
‭can range from developing a simple single static page of plain text to complex web‬
‭applications, electronic business, and social network services. A more‬
‭comprehensive list of tasks to which Web development commonly refers, may‬
‭include Web engineering, web design, Web content development, client‬
‭liaison, , Web server and network security configuration, and e-‬
‭commerce development.‬
‭ mong Web professionals, "Web development" usually refers to the main non-‬
A
‭design aspects of building Web sites: writing makeup and coding. Web development‬
‭may use a content management system (CMS) to make content changes easier and‬
‭available with basic technical skills.‬

‭Figure:1.1‬

‭1‬
‭●‬‭HTML‬‭: HTML (Hypertext Markup Language) is the code‬‭that is used to‬
s‭ tructure a web page and its content. For example, content could be structured‬
‭within a set of paragraphs, a list of bulleted points, or using images and data tables.‬
‭As the title suggests, this article will give you a basic understanding of HTML and its‬
‭functions.‬

‭Figure: 1.2‬

‭ ‬ ‭CSS‬‭: CSS (Cascading Style Sheets) is used to style‬‭and layout web pages — for‬

‭example, to alter the font, colour, size, and spacing of your content, split it into‬
‭multiple columns, or add animations and other decorative features. This module‬
‭provides a gentle beginning to your path towards CSS mastery with the basics of‬
‭how it works, what the syntax looks like, and how you can start using it to add‬
‭styling to HTML.‬

‭Figure: 1.3‬
‭2‬
‭‬
● ‭Javascript‬‭: JavaScript is a scripting or programming‬‭language that allows‬
‭you to implement complex features on web pages - every time a web page does‬
‭more than just sit there and display static information for you to look at -‬
‭displaying timely content updates, interactive maps, animated 2D/3D graphics,‬
‭scrolling video jukeboxes, etc . In our web page we used javascript for the‬
‭animations on our login.‬

‭Figure:1.4‬

‭3‬
‭CHAPTER 2‬

‭LITERATURE SURVEY‬
‭CHAPTER 2 LITERATURE SURVEY‬

‭2.1‬‭HTML‬
‭ TML stands for Hyper Text Markup Language. It is the standard Markup language used to create‬
H
‭web pages. HTML is a combination of Hypertext and Markup language. Hypertext defines the link‬
‭between web pages. A Markup language is used to define the text document within the tag to define‬
‭the structure of web pages.‬
‭ his language is used to annotate (make notes for the computer) text so that a machine can‬
T
‭understand it and manipulate text accordingly. Most Markup languages (e.g. HTML) are‬
‭human-readable. The language uses tags to define what manipulation has to be done on the text.‬

‭STRUCTURE OF HTML‬
‭ he basic structure of an HTML page is shown below. It contains the essential building-block elements‬
T
‭(i.e. doctype declaration, HTML, head, title, and body elements) upon which all webpages are created.‬

‭Figure:2.1‬

‭USES:‬
‭‬ H
● ‭ TML is used to build websites.‬
‭●‬ ‭It is supported by all browsers.‬
‭●‬ ‭It can be integrated with other languages like CSS, JavaScript, etc.‬

‭4‬
‭2.2‬‭CSS‬
‭ SS (Cascading Style Sheets) is a simply designed language intended to simplify the process of‬
C
‭making web pages presentable. CSS allows you to apply styles to HTML documents. It describes‬
‭how a webpage should look. It prescribes color, fonts, spacing, etc. In short, you can make your‬
‭website look however you want. CSS lets developers and designers define how it behaves, including‬
‭how elements are positioned in the browser.‬

‭Figure:2.2‬

‭ TML uses tags and CSS uses rulesets. CSS styles are applied to the HTML element using selectors.‬
H
‭CSS is easy to learn and understand, but it provides powerful control over the presentation of an‬
‭HTML document.‬

‭2.2.1‬‭CSS AND ITS APPLICATIONS‬


•‭ ‬ ‭Used in animation, As many web pages use animation for more user interactivity so ithelps in‬
‭implementing that features on web browsers.‬

‭•‬‭Used in creating social media. It is highly used in styling the UI of social media.‬
•‭ ‬ ‭Used in dynamic templates. Many CSS frameworks help to create the dynamicelement of the‬
‭web page.‬

‭•‬‭Managing Dynamic Web Templates‬‭.‬


‭ ynamic web templates are HTML-based parent copies of web pages that contain various page‬
D
‭elements and settings, such as styles, page layouts, graphics, and text. The use of CSS frameworks‬
‭and extensions enables the creation of dynamic web templates, which allow developers to seamlessly‬
‭add, edit, and manage the dynamic elements of websites that help style web pages.‬

‭5‬
‭•‬‭e-Commerce‬
‭ ne of the key applications of CSS involves the development and designing of eCommerce‬
O
‭platforms from scratch. From large-scale portals to small sites, every eCommerce platform today‬
‭uses CSS files to heighten the visual appeal and user experience of their websites.‬

‭•‬‭Social Media‬
‭ acebook, Instagram, Twitter, and other major social media networks have all used‬
F
‭Cascading Style Sheets to create dynamic websites that look great on desktop web browsers and‬
‭mobile devices alike. Customizing the user interface and making design changes from an end-user‬
‭perspective are the primary applications of CSS on social media platforms.‬

‭ADVANTAGES OF CSS‬
‭•‬ ‭CSS‬ ‭plays‬ ‭an‬ ‭important‬ ‭role,‬ ‭by‬ ‭using‬ ‭CSS‬ ‭you‬ ‭simply‬ ‭got‬ ‭to‬ ‭specify‬ ‭a‬ ‭repeated‬ ‭style‬ ‭for‬
‭element once & use it multiple times as because CSS will automatically apply the required styles.‬
•‭ ‬ ‭The main advantage of CSS is that style is applied consistently across variety of sites. One‬
‭instruction can control several areas which is advantageous.‬

‭•‬‭Web designers need to use few lines of programming for every page improving site speed.‬
•‭ ‬ ‭Cascading sheet not only simplifies website development, but also simplifies the maintenance as‬
‭a change of one line of code affects the whole web site and maintenance time.‬
‭•‬‭It is less complex therefore the effort is significantly reduced.‬
‭•‬‭It helps to form spontaneous and consistent changes.‬
•‭ ‬ ‭CSS changes are device friendly. With people employing a batch of various range of smart‬
‭devices to access websites over the web, there’s a requirement for responsive web design.‬
‭•‬ ‭It has the power for re-positioning. It helps us to determine the changes within the position of‬
‭web elements who are there on the page.‬

‭2.3‬‭JAVASCRIPT‬
‭JavaScript is a programming language for use in HTML pages‬

‭•‬‭Invented in 1995 at Netscape Corporation (Live Script)‬


‭•‬‭JavaScript has nothing to do with Java‬
•‭ ‬ ‭JavaScript programs are run by an interpreter built into the user's web browser (not on the‬
‭server).‬

‭6‬
‭WHAT CAN JAVASCRIPT DO?‬
‭•‬‭JavaScript can dynamically modify an HTML page.‬

‭•‬‭JavaScript can react to user input.‬

‭•‬‭JavaScript can validate user input.‬


‭•‬‭JavaScript can be used to create cookies (yum!).‬
•‭ ‬ ‭JavaScript is a full-featured programming language • JavaScript user interaction does not‬
‭require any communication with the server.‬

‭PROS AND CONES OF HTML:‬


‭•‬‭Pros: – Allows more dynamic HTML pages, even complete web applications.‬
‭•‬ ‭Cons: – Requires a JavaScript-enabled browser – Requires a client who trusts the server‬
‭enough to run the code the server.‬

‭Figure:2.3‬

‭7‬
‭CHAPTER 3 SYSTEM DESIGN‬
‭CHAPTER 3 SYSTEM DESIGN‬

‭System‬‭design‬‭is‬‭the‬‭process‬‭of‬‭designing‬‭the‬‭elements‬‭of‬‭a‬‭system‬‭such‬‭as‬
‭the‬ ‭architecture,‬ ‭modules‬ ‭and‬ ‭components,‬ ‭the‬ ‭different‬ ‭interfaces‬ ‭of‬ ‭those‬
‭components and the data that goes through that system.‬

‭The‬‭purpose‬‭of‬‭the‬‭System‬‭Design‬‭process‬‭is‬‭to‬‭provide‬‭sufficient‬‭detailed‬
‭data‬ ‭and‬ ‭information‬ ‭about‬ ‭the‬ ‭system‬‭and‬‭its‬‭system‬‭elements‬‭to‬‭enable‬
‭the‬ ‭implementation‬ ‭consistent‬ ‭with‬ ‭architectural‬ ‭entities‬ ‭as‬ ‭defined‬ ‭in‬
‭models and views of the system architecture.‬

‭This‬ ‭Website‬ ‭will‬ ‭provide‬ ‭the‬ ‭work‬ ‭,‬ ‭experience‬ ‭,‬ ‭Achievements‬ ‭and‬ ‭contains‬
‭information of the author.‬
‭●‬ ‭System Interface‬‭:‬
‭The‬‭user‬‭interface‬‭for‬‭the‬‭task‬‭will‬‭have‬‭a‬‭website‬‭that‬‭will‬‭have‬‭the‬‭work‬‭,‬‭experience‬
‭,‬‭Achievements‬‭and‬‭contact‬‭information‬‭about‬‭the‬‭author.‬‭This‬‭site‬‭will‬‭utilize‬‭HTML,‬
‭CSS and JavaScript for portfolio website projects.‬
‭●‬ ‭Product Functions‬‭:‬

‭●‬ ‭It will show the Academic Details about the author.‬
‭●‬ ‭It will show the Technical Specializations about the author.‬
‭8‬
‭●‬ ‭It will also show Achievements , Skills and Contact details about the author.‬

‭●‬ ‭Operating Environment‬‭:‬

‭A‬ ‭website‬ ‭is‬ ‭a‬ ‭web‬ ‭page‬ ‭which‬ ‭you‬ ‭can‬ ‭run‬ ‭using‬ ‭your‬ ‭favourite‬ ‭browser.‬ ‭In‬ ‭the‬
‭website‬ ‭all‬ ‭details‬ ‭are‬ ‭static‬ ‭and‬ ‭can‬ ‭only‬ ‭be‬ ‭updated‬ ‭by‬ ‭the‬ ‭author.‬ ‭It‬ ‭requires‬
‭knowledge of html , CSS and JS, react js , node superbase to update any entry in this‬
‭project.‬
‭CHAPTER 4 PROJECT DETAILS WITH REQUIREMENTS‬

‭Introduction to Project‬

‭A‬ ‭portfolio‬ ‭introduction‬ ‭sets‬ ‭the‬ ‭stage‬ ‭for‬ ‭Dropship,‬ ‭an‬ ‭online‬ ‭learning‬ ‭platform‬
‭designed‬ ‭to‬ ‭deliver‬ ‭a‬ ‭variety‬ ‭of‬ ‭educational‬ ‭courses‬ ‭to‬ ‭users‬ ‭in‬‭a‬‭streamlined‬‭and‬
‭efficient‬ ‭manner.‬ ‭The‬ ‭platform‬ ‭is‬‭structured‬‭to‬‭support‬‭learners‬‭by‬‭offering‬‭digital‬
‭content‬ ‭across‬‭multiple‬‭subjects,‬‭and‬‭the‬‭interaction‬‭process‬‭is‬‭carried‬‭out‬‭through‬
‭a‬ ‭user-friendly‬ ‭interface‬ ‭accessible‬ ‭from‬ ‭any‬ ‭device.‬ ‭These‬ ‭courses‬ ‭cover‬ ‭a‬ ‭wide‬
‭range‬ ‭of‬ ‭topics‬ ‭and‬ ‭are‬ ‭structured‬ ‭for‬ ‭self-paced‬ ‭learning,‬ ‭enabling‬‭individuals‬‭to‬
‭gain‬ ‭skills,‬ ‭certifications,‬ ‭or‬ ‭insights‬ ‭at‬ ‭their‬ ‭convenience.‬ ‭Dropship‬ ‭leverages‬
‭modern‬ ‭web‬ ‭technologies‬ ‭to‬ ‭provide‬ ‭a‬ ‭scalable,‬ ‭secure,‬‭and‬‭engaging‬‭experience,‬
‭with‬ ‭features‬ ‭such‬ ‭as‬ ‭progress‬ ‭tracking,‬ ‭resource‬ ‭downloads,‬ ‭and‬ ‭integrated‬
‭assessments.‬‭The‬‭platform‬‭is‬‭aimed‬‭at‬‭anyone‬‭looking‬‭to‬‭enhance‬‭their‬‭knowledge‬
‭or career through structured, accessible digital education.‬

‭Technology Stack:‬

‭The basic terminologies used in this report are:‬

‭‬
● ‭ TML‬
H
‭●‬ ‭CSS‬
‭●‬ ‭JAVASCRIPT‬
‭●‬ ‭React‬
‭●‬ ‭Node‬
‭●‬ ‭Superbase‬

‭10‬
‭Requirements‬

‭❖‬ ‭Software required:‬


‭‬ V
● ‭ S Code‬
‭●‬ ‭Web Browser‬
‭●‬ ‭database‬
‭❖‬ ‭Hardware required:‬
‭‬ S
● ‭ tandard Computer‬
‭●‬ ‭RAM 8 GB‬
‭●‬ ‭At least 8 GB Memory‬

‭11‬

‭CHAPTER 5 PARTIAL CODE‬


‭CHAPTER 5 PARTIAL CODE‬

const‬‭
‭ config‬‭
=‬‭
{‬

server:‬‭
‭ {‬

mongoHost:‬‭
‭ process‬
.‭
‭ e
‬nv‬
.‬
‭ MONGO_DB_HOST‬‭
‭ ||‬‭
'127.0.0.1'‬
,‬

mongoPort:‬‭
‭ parseInt‬
(‭
‭ p
‬rocess‬
.‬
‭ env‬
‭ .‭
‭M‬ONGO_DB_PORT‬‭
||‬‭
'27017'‬
),‬

mongoDb:‬‭
‭ process‬
.‬
‭ env‬
‭ .‭
‭M‬ONGO_DB‬
,‬

poolSize:‬‭
‭ process‬
.‭
‭ e
‬nv‬
.‭
‭M‬ONGO_POOL_SIZE‬‭
||‬‭
'100'‬
,‬

route:‬‭
‭ process‬
.‭
‭e‬nv‬
.‭
‭ R
‬OUTE‬‭
||‬‭
'api'‬
,‬

port:‬‭
‭ process‬
.‭
‭ e
‬nv‬
.‭
‭ P
‬ORT‬‭
||‬‭
'4000'‬
,‬

nodeEnv:‬‭
‭ process‬
.‬
‭ env‬
‭ .‭
‭N‬ODE_ENV‬‭
||‬‭
'dev'‬
,‬

jwtSecretKey:‬‭
‭ process‬
.‭
‭e‬nv‬
.‭
‭ J
‬WT_SECRET‬
,‬

db:‬‭
‭ process‬
.‬
‭ env‬
‭ .‭
‭M‬ONGO_DB‬‭
||‬‭
'template'‬
,‬

backendLink:‬‭
‭ process‬
.‭
‭e‬nv‬
.‭
‭ B
‬ACKEND_LINK‬‭
||‬‭
''‬
,‬

smtpMail:‬‭
‭ process‬
.‭
‭ e
‬nv‬
.‭
‭S‬MTP_MAIL‬‭
||‬‭
''‬
,‬

smtpPassword:‬‭
‭ process‬
.‭
‭e‬nv‬
.‭
‭ S
‬MTP_PASS‬‭
||‬‭
''‬

}‬

};‬

module‬
‭ .‬
‭ exports‬‭
‭ =‬‭
config‬
;‬

const‬‭
‭ mongoose‬‭
=‬‭
require‬
(‭
‭ '
‬mongoose'‬
);‬

const‬‭
‭ config‬‭
=‬‭
require‬
(‭
‭'‬./config'‬
);‬

const‬‭
‭ cluster‬‭
=‬‭
require‬
(‬
‭ 'cluster'‬
‭ );‬

const‬‭
‭ {‬
server‬
‭ : {‬‭
‭ mongoHost‬
,‬‭
‭ mongoPort‬
,‬‭
‭ db‬
,‬‭
‭ poolSize‬‭
}‬
}‬‭
‭ =‬‭
config‬
;‬

const‬‭
‭ mongoUrl‬‭
=‬‭̀mongodb://‬
${‬
‭ mongoHost‬
‭ }‬
‭ :‭
‭$
‬{‬
mongoPort‬
‭ }‭
‭ /
‬‭
$‬{‬
db‬
‭ }‭
‭?‬maxPoolSize=‬
${‬
‭ poolSize‬
‭ }‬
‭ ‭̀‭
;
‬‬

// Making MongoDB Connection using mongoose‬



exports‬
‭ .‬
‭ connect‬‭
‭ =‬‭
()‬‭
=>‬‭
{‬
mongoose‬
‭ .‭
‭s
‬et‬
(‭
‭ '
‬strictQuery'‬
,‬‭
‭ true‬
);‬

mongoose‬

.‬
‭ connect‬
‭ (‭
‭m
‬ongoUrl‬
)‬

.‬
‭ then‬
‭ (()‬‭
‭ =>‬‭
{‬
if‬‭
‭ (‭
c‬luster‬
.‭
‭i‬sMaster‬
)‬‭
‭ console‬
.‭
‭ l
‬og‬
(‭
‭'‬Successfully‬‭
connected to mongo database'‬
);‬

})‬

.‬
‭ catch‬
‭ ((‬
‭ error‬
‭ )‬‭
‭ =>‬‭
{‬
console‬
‭ .‬
‭ log‬
‭ (‭
‭'‬Mongo connection failed. exiting‬‭
now...'‬
);‬

console‬
‭ .‬
‭ error‬
‭ (‭
‭e‬rror‬
);‬

/* eslint-disable */‬

process‬
‭ .‬
‭ exit‬
‭ (‬
‭ 1‭
‭)‬;‬
/* eslint-disable */‬

});‬

};‬

const‬‭
‭ CoachService‬‭
=‬‭
require‬
(‭
‭'‬../services/coach-services'‬
);‬

const‬‭
‭ {‬‭
ErrorHandler‬‭
}‬‭
=‬‭
require‬
(‭
‭'
‬../utils/error-handler'‬
);‬

const‬‭
‭ {‬‭
sendResponse‬‭
}‬‭
=‬‭
require‬
(‭
‭'
‬../helpers/helpers'‬
);‬

const‬‭
‭ {‬‭
Student‬‭
}‬‭
=‬‭
require‬
(‭
‭'‬../models/user-model'‬
);‬

const‬‭
‭ {‬‭
wrapAsync‬‭
}‬‭
=‬‭
require‬
(‬
‭ '../utils/wrapAsync'‬
‭ );‬

const‬‭
‭ {‬‭
USER_ROLE‬
,‬‭
‭ COACH‬‭
}‬‭
=‬‭
require‬
(‭
‭ '
‬../helpers/constant-enums'‬
);‬

const‬‭
‭ MAIL_HANDLER‬‭
=‬‭
require‬
(‭
‭'‬../mails/mails'‬
);‬

const‬‭
‭ {‬‭
generatePassword‬‭
}‬‭
=‬‭
require‬
(‭
‭ '
‬../utils/utils'‬
);‬

// Create Coach‬

const‬‭
‭ createCoach‬‭
=‬‭
wrapAsync‬
(‬
‭ async‬‭
‭ (‭
r‬eq‬
,‬‭
‭ res‬
)‬‭
‭ =>‬‭
{‬

const‬‭
‭ coachData‬‭
=‬‭
req‬
.‭
‭ b
‬ody‬
;‬

// Check if email already exists‬

const‬‭
‭ emailExists‬‭
=‬‭
await‬‭
CoachService‬
.‭
‭ g
‬etUserByEmail‬
(‭
‭ c
‬oachData‬
.‬
‭ email‬
‭ );‬

if‬‭
‭ (‬emailExists‬
‭ ) {‬

throw‬‭
‭ new‬‭
ErrorHandler‬
(‬
‭ 400‬
‭ ,‬‭
‭ 'Email already‬‭
exists'‬
);‬

}‬

// Validate assigned students if provided‬


const‬‭
‭ studentIds‬‭
=‬‭
coachData‬
.‭
‭ a
‬ssignedStudents‬
;‬

if‬‭
‭ (‬studentIds‬‭
‭ &&‬‭
studentIds‬
.‭
‭l‬ength‬‭
>‬‭
0‭
)‬ {‬

await‬‭
‭ CoachService‬
.‭
‭ c
‬heckAssignedStudents‬
({‬‭
‭ ...‬
coachData‬
‭ ,‬‭
‭ _id:‬‭
emailExists‬
?.‬
‭ _id‬‭
‭ });‬

}‬

const‬‭
‭ newCoach‬‭
=‬‭
await‬‭
CoachService‬
.‭
‭c‬reateCoach‬
({‬‭
‭ ...‬
coachData‬
‭ ,‬‭
‭ role:‬‭
USER_ROLE‬
.‬
‭ COACH‬‭
‭ });‬

// Update many students to add this coach to them.‬


await‬‭
‭ Student‬
.‭
‭u
‬pdateMany‬
({‬‭
‭ _id:‬‭
{‬‭
$in:‬‭
studentIds‬‭
} }, {‬‭
$set:‬‭
{‬‭
assignedCoach:‬‭
newCoach‬
.‭
‭_‬id‬
} });‬

// send random password to coach email‬


const‬‭
‭ randomPassword‬‭
=‬‭
generatePassword‬
(‭
‭8‬‭
)
‬;‬

// Automatically generate salted password‬


newCoach‬
‭ .‬
‭ password‬‭
‭ =‬‭
randomPassword‬
;‬

await‬‭
‭ newCoach‬
.‭
‭s‬ave‬
();‬

MAIL_HANDLER‬
‭ .‭
‭s‬endEmailToUserWithPassword‬
(‭
‭n
‬ewCoach‬
?.‬
‭ email‬
‭ ,‬‭
‭ 'Coach Account Created'‬
,‬‭
‭ 'Your‬
account has been created successfully'‬
‭ ,‬‭
‭ randomPassword‬
);‬

// send coach without password‬


newCoach‬
‭ .‬
‭ password‬‭
‭ =‬‭
undefined‬
;‬

delete‬‭
‭ newCoach‬
.‬
‭ password‬
‭ ;‬

sendResponse‬
‭ (‭
‭r‬es‬
,‬‭
‭ 201‬
,‬‭
‭ newCoach‬
,‬‭
‭ 'Coach created‬‭
successfully'‬
);‬

});‬

// Update Coach‬

const‬‭
‭ updateCoach‬‭
=‬‭
wrapAsync‬
(‬
‭ async‬‭
‭ (‭
r‬eq‬
,‬‭
‭ res‬
)‬‭
‭ =>‬‭
{‬

const‬‭
‭ {‬‭
id‬‭
}‬‭
=‬‭
req‬
.‭
‭ p
‬arams‬
;‬

const‬‭
‭ updateData‬‭
=‬‭
req‬
.‭
‭ b
‬ody‬
;‬

// Validate assigned students if provided‬


const‬‭
‭ studentIds‬‭
=‬‭
updateData‬
.‭
‭a‬ssignedStudents‬
;‬

if‬‭
‭ (‬studentIds‬‭
‭ &&‬‭
studentIds‬
.‭
‭l‬ength‬‭
>‬‭
0‭
)‬ {‬

await‬‭
‭ CoachService‬
.‭
‭ c
‬heckAssignedStudents‬
({‬‭
‭ ...‬
updateData‬
‭ ,‬‭
‭ _id:‬‭
id‬‭
});‬

}‬

// reset the tickets‬


if‬‭
‭ (‬updateData‬
‭ .‭
‭c‬oachType‬‭
===‬‭
COACH‬
.‭
‭C‬OACH_TYPE‬
.‭
‭L‬OW_TICKET‬
)‬‭
‭ {‬

updateData‬
‭ .‭
‭h‬ighTicketStudentSpots‬‭
=‬‭
0‭
;
‬‬

}‬

if‬‭
‭ (‬updateData‬
‭ .‭
‭c‬oachType‬‭
===‬‭
COACH‬
.‭
‭C‬OACH_TYPE‬
.‭
‭H‬IGH_TICKET‬
)‬‭
‭ {‬

updateData‬
‭ .‭
‭l‬owTicketStudentSpots‬‭
=‬‭
0‭
;‬‬

}‬

const‬‭
‭ updatedCoach‬‭
=‬‭
await‬‭
CoachService‬
.‭
‭u‬pdateCoach‬
(‭
‭i‬d‬
,‬‭
‭ updateData‬
);‬

// Update many students to add this coach to them.‬


await‬‭
‭ Student‬
.‭
‭u
‬pdateMany‬
({‬‭
‭ _id:‬‭
{‬‭
$in:‬‭
studentIds‬‭
} }, {‬‭
$set:‬‭
{‬‭
assignedCoach:‬
updatedCoach‬
‭ .‭
‭_‬id‬‭
} });‬

// if coach unassigned from students, remove coach‬‭


‭ from students‬

if‬‭
‭ (‬updateData‬
‭ .‭
‭a‬ssignedStudents‬‭
===‬‭
undefined‬‭
||‬‭
updateData‬
.‭
‭a‬ssignedStudents‬
.‭
‭l‬ength‬‭
===‬‭
0‭
)‬ {‬

await‬‭
‭ Student‬
.‭
‭ u
‬pdateMany‬
({‬‭
‭ assignedCoach:‬‭
id‬‭
}, {‬‭
$unset:‬‭
{‬‭
assignedCoach:‬‭
1‬‭
} });‬

}‬

if‬‭
‭ (‬!‬
‭ updatedCoach‬
‭ )‬‭
‭ throw‬‭
new‬‭
ErrorHandler‬
(‭
‭4‬04‬
,‬‭
‭ 'Coach not found'‬
);‬

sendResponse‬
‭ (‭
‭r‬es‬
,‬‭
‭ 200‬
,‬‭
‭ updatedCoach‬
,‬‭
‭ 'Coach updated‬‭
successfully'‬
);‬

});‬

// Get Coach by ID‬


const‬‭
‭ getCoachById‬‭
=‬‭
wrapAsync‬
(‭
‭ a
‬sync‬‭
(‭
r‬eq‬
,‬‭
‭ res‬
)‬‭
‭ =>‬‭
{‬

const‬‭
‭ {‬‭
id‬‭
}‬‭
=‬‭
req‬
.‭
‭ p
‬arams‬
;‬

const‬‭
‭ coach‬‭
=‬‭
await‬‭
CoachService‬
.‭
‭ g
‬etCoachById‬
(‭
‭i‬d‬
);‬

if‬‭
‭ (‬!‬
‭ coach‬
‭ )‬‭
‭ throw‬‭
new‬‭
ErrorHandler‬
(‭
‭4‬04‬
,‬‭
‭ 'Coach‬‭
not found'‬
);‬

sendResponse‬
‭ (‭
‭r‬es‬
,‬‭
‭ 200‬
,‬‭
‭ coach‬
,‬‭
‭ 'Coach fetched successfully'‬
);‬

});‬

// Get all Coaches‬


const‬‭
‭ getAllCoaches‬‭
=‬‭
wrapAsync‬
(‭
‭ a
‬sync‬‭
(‭
r‬eq‬
,‬‭
‭ res‬
)‬‭
‭ =>‬‭
{‬

const‬‭
‭ {‬‭
page‬‭
=‬‭
1‬,‬‭
‭ limit‬‭
=‬‭
10‬
,‬‭
‭ ...‬
rest‬‭
‭ }‬‭
=‬‭
req‬
.‭
‭ q
‬uery‬
;‬

const‬‭
‭ coaches‬‭
=‬‭
await‬‭
CoachService‬
.‭
‭g‬etAllCoaches‬
(‭
‭ r
‬est‬
,‬‭
‭ page‬
,‬‭
‭ limit‬
);‬

return‬‭
‭ res‬
.‬
‭ status‬
‭ (‭
‭2
‬00‬
).‬
‭ json‬
‭ ({‬

data:‬‭
‭ coaches‬
.‭
‭ c
‬oaches‬
,‬

total:‬‭
‭ coaches‬
.‭
‭t‬otal‬
,‬

page:‬‭
‭ coaches‬
.‭
‭ p
‬age‬
,‬

limit:‬‭
‭ coaches‬
.‭
‭l‬imit‬
,‬

message:‬‭
‭ 'Coaches fetched successfully'‬

});‬

});‬

// Delete Coach‬

const‬‭
‭ deleteCoach‬‭
=‬‭
wrapAsync‬
(‬
‭ async‬‭
‭ (‭
r‬eq‬
,‬‭
‭ res‬
)‬‭
‭ =>‬‭
{‬

const‬‭
‭ {‬‭
id‬‭
}‬‭
=‬‭
req‬
.‭
‭ p
‬arams‬
;‬

const‬‭
‭ coach‬‭
=‬‭
await‬‭
CoachService‬
.‭
‭ g
‬etCoachById‬
(‭
‭i‬d‬
);‬

const‬‭
‭ checkAssignedStudents‬‭
=‬‭
coach‬
.‭
‭a‬ssignedStudents‬
.‬
‭ length‬
‭ ;‬

if‬‭
‭ (‬checkAssignedStudents‬‭
‭ >‬‭
0‭
)
‬ {‬

throw‬‭
‭ new‬‭
ErrorHandler‬
(‬
‭ 400‬
‭ ,‬‭
‭ 'Cannot delete‬‭
coach with assigned students'‬
);‬

}‬

const‬‭
‭ deletedCoach‬‭
=‬‭
await‬‭
CoachService‬
.‭
‭d‬eleteCoach‬
(‭
‭i‬d‬
);‬

if‬‭
‭ (‬!‬
‭ deletedCoach‬
‭ )‬‭
‭ throw‬‭
new‬‭
ErrorHandler‬
(‭
‭4‬04‬
,‬‭
‭ 'Coach not found'‬
);‬

sendResponse‬
‭ (‭
‭r‬es‬
,‬‭
‭ 200‬
,‬‭
‭ null‬
,‬‭
‭ 'Coach deleted successfully'‬
);‬

});‬

// Deactivate Coach‬

const‬‭
‭ deactivateCoach‬‭
=‬‭
wrapAsync‬
(‭
‭a‬sync‬‭
(‭
r‬eq‬
,‬‭
‭ res‬
)‬‭
‭ =>‬‭
{‬

const‬‭
‭ {‬‭
id‬‭
}‬‭
=‬‭
req‬
.‭
‭ p
‬arams‬
;‬

const‬‭
‭ updatedCoach‬‭
=‬‭
await‬‭
CoachService‬
.‭
‭d‬eactivateCoach‬
(‭
‭i‬d‬
);‬

if‬‭
‭ (‬!‬
‭ updatedCoach‬
‭ )‬‭
‭ throw‬‭
new‬‭
ErrorHandler‬
(‭
‭4‬04‬
,‬‭
‭ 'Coach not found'‬
);‬

sendResponse‬
‭ (‭
‭r‬es‬
,‬‭
‭ 200‬
,‬‭
‭ updatedCoach‬
,‬‭
‭ 'Coach deactivated‬‭
successfully'‬
);‬

});‬

// Activate Coach‬

const‬‭
‭ activateCoach‬‭
=‬‭
wrapAsync‬
(‭
‭ a
‬sync‬‭
(‭
r‬eq‬
,‬‭
‭ res‬
)‬‭
‭ =>‬‭
{‬

const‬‭
‭ {‬‭
id‬‭
}‬‭
=‬‭
req‬
.‭
‭ p
‬arams‬
;‬

const‬‭
‭ updatedCoach‬‭
=‬‭
await‬‭
CoachService‬
.‭
‭a‬ctivateCoach‬
(‭
‭ i
‬d‬
);‬

if‬‭
‭ (‬!‬
‭ updatedCoach‬
‭ )‬‭
‭ throw‬‭
new‬‭
ErrorHandler‬
(‭
‭4‬04‬
,‬‭
‭ 'Coach not found'‬
);‬

sendResponse‬
‭ (‭
‭r‬es‬
,‬‭
‭ 200‬
,‬‭
‭ updatedCoach‬
,‬‭
‭ 'Coach activated‬‭
successfully'‬
);‬

});‬

module‬
‭ .‬
‭ exports‬‭
‭ =‬‭
{‬

createCoach‬
‭ ,‬

updateCoach‬
‭ ,‬

getCoachById‬
‭ ,‬

getAllCoaches‬
‭ ,‬

deleteCoach‬
‭ ,‬

deactivateCoach‬
‭ ,‬

activateCoach‬

};‬

{‬

"users"‬
‭ : {‬

"columns"‬
‭ : [‬

{‬

"headerName"‬
‭ :‬‭
‭ "lastVisit"‬
,‬

"field"‬
‭ :‬‭
‭ "lastVisit"‬
,‬

"wrapText"‬
‭ :‬‭
‭ true‬
,‬

"autoHeight"‬
‭ :‬‭
‭ true‬
,‬

"resizable"‬
‭ :‬‭
‭ false‬
,‬

"hide"‬
‭ :‬‭
‭ false‬
},‬

{‬

"headerName"‬
‭ :‬‭
‭ "isVerified"‬
,‬

"field"‬
‭ :‬‭
‭ "isVerified"‬
,‬

"wrapText"‬
‭ :‬‭
‭ true‬
,‬

"autoHeight"‬
‭ :‬‭
‭ true‬
,‬

"resizable"‬
‭ :‬‭
‭ false‬
,‬

"hide"‬
‭ :‬‭
‭ true‬
},‬

{‬

"headerName"‬
‭ :‬‭
‭ "role"‬
,‬

"field"‬
‭ :‬‭
‭ "role"‬
,‬

"wrapText"‬
‭ :‬‭
‭ true‬
,‬

"autoHeight"‬
‭ :‬‭
‭ true‬
,‬

"resizable"‬
‭ :‬‭
‭ false‬
,‬

"hide"‬
‭ :‬‭
‭ true‬
},‬

{‬

"headerName"‬
‭ :‬‭
‭ "createdAt"‬
,‬

"field"‬
‭ :‬‭
‭ "createdAt"‬
,‬

"wrapText"‬
‭ :‬‭
‭ true‬
,‬

"autoHeight"‬
‭ :‬‭
‭ true‬
,‬

"resizable"‬
‭ :‬‭
‭ false‬
,‬

"hide"‬
‭ :‬‭
‭ true‬
},‬

{‬

"headerName"‬
‭ :‬‭
‭ "updatedAt"‬
,‬

"field"‬
‭ :‬‭
‭ "updatedAt"‬
,‬

"wrapText"‬
‭ :‬‭
‭ true‬
,‬

"autoHeight"‬
‭ :‬‭
‭ true‬
,‬

"resizable"‬
‭ :‬‭
‭ false‬
},‬

{‬

"headerName"‬
‭ :‬‭
‭ "password"‬
,‬

"field"‬
‭ :‬‭
‭ "password"‬
,‬

"wrapText"‬
‭ :‬‭
‭ true‬
,‬

"autoHeight"‬
‭ :‬‭
‭ true‬
,‬

"resizable"‬
‭ :‬‭
‭ false‬
,‬

"hide"‬
‭ :‬‭
‭ true‬
}‬

]‬

}‬

}‬

const‬‭
‭ {‬‭
Joi‬
,‬‭
‭ Segments‬‭
}‬‭
=‬‭
require‬
(‭
‭'‬celebrate'‬
);‬

// Helper for ObjectId validation with a custom message‬


const‬‭
‭ objectIdRegex‬‭
=‬‭
/‭
^‬‬
[‭
‭ 0
‬-9a-fA-F‬
]‬
‭ {24}‬
‭ $‬
‭ /‭
‭;‬‬

const‬‭
‭ objectIdMessage‬‭
=‬‭
'Invalid ObjectId format.‬‭
Must be a 24-character hex string.'‬
;‬

const‬‭
‭ createCourse‬‭
=‬‭
{‬

[‬
‭ Segments‬
‭ .‭
‭B‬ODY‬
]:‬‭
‭ Joi‬
.‬
‭ object‬
‭ ().‬
‭ keys‬
‭ ({‬

title:‬‭
‭ Joi‬
.‭
‭s‬tring‬
().‬
‭ required‬
‭ ().‬
‭ messages‬
‭ ({‬

'string.base'‬
‭ :‬‭
‭ 'Course title must be a‬‭
string.'‬
,‬

'any.required'‬
‭ :‬‭
‭ 'Course title is required.'‬

}),‬

subtitle:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ ().‬
‭ allow‬
‭ (‭
‭'‬'‬
,‬‭
‭ null‬
).‬
‭ messages‬
‭ ({‬

'string.base'‬
‭ :‬‭
‭ 'Subtitle must be a string.'‬

}),‬

category:‬

Joi‬
‭ .‬
‭ array‬
‭ ().‬
‭ items‬
‭ (‭
‭J‬oi‬
.‭
‭ s
‬tring‬
().‬
‭ regex‬
‭ (‭
‭o‬bjectIdRegex‬
).‬
‭ message‬
‭ (‭
‭o‬bjectIdMessage‬
)).‬
‭ required‬
‭ ().‬
‭ message‬

s‬
‭ ({‬

'array.base'‬
‭ :‬‭
‭ 'Category must be an array‬‭
of valid ObjectIds.'‬
,‬

'any.required'‬
‭ :‬‭
‭ 'You must provide at least‬‭
one category.'‬
,‬

'string.pattern.base'‬
‭ :‬‭
‭ objectIdMessage‬

}),‬

thumbnail:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ ().‬
‭ messages‬
‭ ({‬

'string.base'‬
‭ :‬‭
‭ 'Thumbnail must be a string.'‬

}),‬

banner:‬‭
‭ Joi‬
.‬
‭ string‬
‭ ()‬

.‬
‭ optional‬
‭ ()‬

.‬
‭ messages‬
‭ ({‬

'string.base'‬
‭ :‬‭
‭ 'Banner must be a string.'‬

})‬

.‬
‭ allow‬
‭ (‭
‭'‬'‬
,‬‭
‭ null‬
),‬

trailer:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ ().‬
‭ allow‬
‭ (‬
‭ ''‬
‭ ,‬‭
‭ null‬
).‬
‭ messages‬
‭ ({‬

'string.base'‬
‭ :‬‭
‭ 'Trailer URL must be a string.'‬

}),‬

description:‬‭
‭ Joi‬
.‬
‭ string‬
‭ ().‬
‭ optional‬
‭ ().‬
‭ messages‬
‭ ({‬

'string.base'‬
‭ :‬‭
‭ 'Description must be a string.'‬

}),‬

enrolledStudents:‬

Joi‬
‭ .‬
‭ array‬
‭ ().‬
‭ items‬
‭ (‭
‭J‬oi‬
.‭
‭ s
‬tring‬
().‬
‭ regex‬
‭ (‭
‭o‬bjectIdRegex‬
).‬
‭ message‬
‭ (‭
‭o‬bjectIdMessage‬
)).‬
‭ optional‬
‭ ().‬
‭ message‬

s‬
‭ ({‬

'array.base'‬
‭ :‬‭
‭ 'Enrolled students must be‬‭
an array of valid ObjectIds.'‬
,‬

'string.pattern.base'‬
‭ :‬‭
‭ objectIdMessage‬

}),‬

vimeoVideoData:‬‭
‭ Joi‬
.‭
‭ a
‬ny‬
().‬
‭ optional‬
‭ ().‬
‭ allow‬
‭ (‭
‭'‬'‬
,‬‭
‭ null‬
)‬

})‬

};‬

const‬‭
‭ updateCourse‬‭
=‬‭
{‬

[Segments.‬
‭ PARAMS‬
‭ ]:‬‭
‭ Joi‬
.‭
‭ o
‬bject‬
().‬
‭ keys‬
‭ ({‬

id:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ regex‬
‭ (‬
‭ objectIdRegex‬
‭ ).‬
‭ required‬
‭ ().‬
‭ messages‬
‭ ({‬

'string.base'‬
‭ :‬‭
‭ 'Course ID must be a string.'‬
,‬

'string.pattern.base'‬
‭ :‬‭
‭ objectIdMessage‬
,‬

'any.required'‬
‭ :‬‭
‭ 'Course ID is required.'‬

})‬

}),‬

[Segments.‬
‭ BODY‬
‭ ]:‬‭
‭ Joi‬
.‬
‭ object‬
‭ ().‬
‭ keys‬
‭ ({‬

title:‬‭
‭ Joi‬
.‭
‭s‬tring‬
().‬
‭ optional‬
‭ ().‬
‭ messages‬
‭ ({‬

'string.base'‬
‭ :‬‭
‭ 'Course title must be a‬‭
string.'‬

}),‬

subtitle:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ ().‬
‭ allow‬
‭ (‭
‭'‬'‬
,‬‭
‭ null‬
).‬
‭ messages‬
‭ ({‬

'string.base'‬
‭ :‬‭
‭ 'Subtitle must be a string.'‬

}),‬

category:‬

Joi‬
‭ .‬
‭ array‬
‭ ().‬
‭ items‬
‭ (‭
‭J‬oi‬
.‭
‭ s
‬tring‬
().‬
‭ regex‬
‭ (‭
‭o‬bjectIdRegex‬
).‬
‭ message‬
‭ (‭
‭o‬bjectIdMessage‬
)).‬
‭ optional‬
‭ ().‬
‭ mess‬

const‬‭
‭ {‬‭
Joi‬
,‬‭
‭ Segments‬‭
}‬‭
=‬‭
require‬
(‭
‭'‬celebrate'‬
);‬

const‬‭
‭ {‬‭
EVENT‬‭
}‬‭
=‬‭
require‬
(‭
‭ '
‬../helpers/constant-enums'‬
);‬

const‬‭
‭ createEvent‬‭
=‬‭
{‬

[‬
‭ Segments‬
‭ .‭
‭B‬ODY‬
]:‬‭
‭ Joi‬
.‬
‭ object‬
‭ ().‬
‭ keys‬
‭ ({‬

topic:‬‭
‭ Joi‬
.‭
‭s‬tring‬
().‬
‭ required‬
‭ ().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Event topic is required'‬

}),‬

dateTime:‬‭
‭ Joi‬
.‭
‭ d
‬ate‬
().‬
‭ required‬
‭ ().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Event date and time are‬‭
required'‬

}),‬

eventHost:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ (),‬

meetingLink:‬‭
‭ Joi‬
.‬
‭ string‬
‭ ().‬
‭ when‬
‭ (‭
‭ '
‬typeOfEvent'‬
,‬‭
‭ {‬

is:‬‭
‭ EVENT‬
.‭
‭E‬VENT_TYPE‬
.‭
‭O‬NLINE‬
,‬

then:‬‭
‭ Joi‬
.‭
‭ r
‬equired‬
().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Meeting link is required‬‭
for online events'‬

}),‬

otherwise:‬‭
‭ Joi‬
.‭
‭ f
‬orbidden‬
()‬

}),‬

location:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ when‬
‭ (‬
‭ 'typeOfEvent'‬
‭ ,‬‭
‭ {‬

is:‬‭
‭ EVENT‬
.‭
‭E‬VENT_TYPE‬
.‭
‭O‬NSITE‬
,‬

then:‬‭
‭ Joi‬
.‭
‭ r
‬equired‬
().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Location is required‬‭
for onsite events'‬

}),‬

otherwise:‬‭
‭ Joi‬
.‭
‭ f
‬orbidden‬
()‬

}),‬

typeOfEvent:‬‭
‭ Joi‬
.‬
‭ string‬
‭ ().‬
‭ valid‬
‭ (‭
‭E‬VENT‬
.‭
‭E‬VENT_TYPE‬
.‬
‭ ONLINE‬
‭ ,‬

EVENT‬
‭ .‬
‭ EVENT_TYPE‬
‭ .‭
‭O
‬NSITE‬
).‬
‭ required‬
‭ ().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Event type is required'‬

}),‬

attendees:‬‭
‭ Joi‬
.‭
‭ a
‬rray‬
()‬

.‬
‭ items‬
‭ (‬

Joi‬
‭ .‬
‭ string‬
‭ ()‬

.‭
‭r‬egex‬
(‭
‭/‬‭
^
‬‭
[‬‭
0
‬-9a-fA-F‬
]‭
‭ {
‬24}‬
$‭
‭ /
‬‭
)‬‬

.‭
‭m‬essages‬
({‬

'string.pattern.base'‬
‭ :‬‭
‭ 'Attendee ID must be a valid 24-character‬
hexadecimal string'‬

})‬

)‬

.‬
‭ optional‬
‭ (),‬

thumbnail:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ ().‬
‭ allow‬
‭ (‭
‭'‬'‬
).‬
‭ allow‬
‭ (‭
‭n‬ull‬
)‬

})‬

};‬

const‬‭
‭ requestMeeting‬‭
=‬‭
{‬

[Segments.‬
‭ BODY‬
‭ ]:‬‭
‭ Joi‬
.‬
‭ object‬
‭ ().‬
‭ keys‬
‭ ({‬

topic:‬‭
‭ Joi‬
.‭
‭s‬tring‬
().‬
‭ required‬
‭ ().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Meeting topic is required'‬

}),‬

dateTime:‬‭
‭ Joi‬
.‭
‭ d
‬ate‬
().‬
‭ required‬
‭ ().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Meeting date and time‬‭
are required'‬

}),‬

eventHost:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ (),‬

meetingLink:‬‭
‭ Joi‬
.‬
‭ string‬
‭ ().‬
‭ when‬
‭ (‭
‭ '
‬typeOfEvent'‬
,‬‭
‭ {‬

is:‬‭
‭ EVENT‬
.‭
‭E‬VENT_TYPE‬
.‭
‭O‬NLINE‬
,‬

then:‬‭
‭ Joi‬
.‭
‭ r
‬equired‬
().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Meeting link is required‬‭
for online events'‬

}),‬

otherwise:‬‭
‭ Joi‬
.‭
‭ f
‬orbidden‬
()‬

}),‬

location:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ when‬
‭ (‬
‭ 'typeOfEvent'‬
‭ ,‬‭
‭ {‬

is:‬‭
‭ EVENT‬
.‭
‭E‬VENT_TYPE‬
.‭
‭O‬NSITE‬
,‬

then:‬‭
‭ Joi‬
.‭
‭ r
‬equired‬
().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Location is required‬‭
for onsite events'‬

}),‬

otherwise:‬‭
‭ Joi‬
.‭
‭ f
‬orbidden‬
()‬

}),‬

typeOfEvent:‬‭
‭ Joi‬
.‬
‭ string‬
‭ ().‬
‭ valid‬
‭ (‭
‭E‬VENT‬
.‭
‭E‬VENT_TYPE‬
.‬
‭ ONLINE‬
‭ ,‬

EVENT‬
‭ .‬
‭ EVENT_TYPE‬
‭ .‭
‭O
‬NSITE‬
).‬
‭ required‬
‭ ().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Event type is required'‬

}),‬

thumbnail:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ ().‬
‭ allow‬
‭ (‭
‭'‬'‬
).‬
‭ allow‬
‭ (‭
‭n‬ull‬
),‬

reason:‬‭
‭ Joi‬
.‬
‭ string‬
‭ ().‬
‭ optional‬
‭ (),‬

attendees:‬‭
‭ Joi‬
.‭
‭ a
‬rray‬
()‬

.‬
‭ items‬
‭ (‬

Joi‬
‭ .‬
‭ string‬
‭ ()‬

.‭
‭r‬egex‬
(‭
‭/‬‭
^
‬‭
[‬‭
0
‬-9a-fA-F‬
]‭
‭ {
‬24}‬
$‭
‭ /
‬‭
)‬‬

.‭
‭m‬essages‬
({‬

'string.pattern.base'‬
‭ :‬‭
‭ 'Attendee‬‭
ID must be a valid 24-character‬
hexadecimal string'‬

})‬

)‬

.‬
‭ optional‬
‭ (),‬

timeZone:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ ()‬

})‬

};‬

const‬‭
‭ updateEvent‬‭
=‬‭
{‬

[Segments.‬
‭ PARAMS‬
‭ ]:‬‭
‭ Joi‬
.‭
‭ o
‬bject‬
().‬
‭ keys‬
‭ ({‬

id:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
()‬

.‬
‭ regex‬
‭ (‭
‭/‬‬
^‭
‭ [
‬‭
0‬-9a-fA-F‬
]‭
‭ {
‬24}‬
$‭
‭ /
‬‭
)‬‬

.‬
‭ required‬
‭ ()‬

.‬
‭ messages‬
‭ ({‬

'string.pattern.base'‬
‭ :‬‭
‭ 'Event ID must‬‭
be a valid 24-character hexadecimal‬
string'‬
‭ ,‬

'any.required'‬
‭ :‬‭
‭ 'Event ID is required'‬

})‬

}),‬

[Segments.‬
‭ BODY‬
‭ ]:‬‭
‭ Joi‬
.‬
‭ object‬
‭ ().‬
‭ keys‬
‭ ({‬

topic:‬‭
‭ Joi‬
.‭
‭s‬tring‬
().‬
‭ optional‬
‭ (),‬

dateTime:‬‭
‭ Joi‬
.‭
‭ d
‬ate‬
().‬
‭ optional‬
‭ (),‬

eventHost:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ (),‬

meetingLink:‬‭
‭ Joi‬
.‬
‭ string‬
‭ ().‬
‭ when‬
‭ (‭
‭ '
‬typeOfEvent'‬
,‬‭
‭ {‬

is:‬‭
‭ EVENT‬
.‭
‭E‬VENT_TYPE‬
.‭
‭O‬NLINE‬
,‬

then:‬‭
‭ Joi‬
.‭
‭ r
‬equired‬
().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Meeting link is required‬‭
for online events'‬

}),‬

otherwise:‬‭
‭ Joi‬
.‭
‭ f
‬orbidden‬
()‬

}),‬

location:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ when‬
‭ (‬
‭ 'typeOfEvent'‬
‭ ,‬‭
‭ {‬

is:‬‭
‭ EVENT‬
.‭
‭E‬VENT_TYPE‬
.‭
‭O‬NSITE‬
,‬

then:‬‭
‭ Joi‬
.‭
‭ r
‬equired‬
().‬
‭ messages‬
‭ ({‬

'any.required'‬
‭ :‬‭
‭ 'Location is required‬‭
for onsite events'‬

}),‬

otherwise:‬‭
‭ Joi‬
.‭
‭ f
‬orbidden‬
()‬

}),‬

typeOfEvent:‬‭
‭ Joi‬
.‬
‭ string‬
‭ ().‬
‭ valid‬
‭ (‭
‭E‬VENT‬
.‭
‭E‬VENT_TYPE‬
.‬
‭ ONLINE‬
‭ ,‬

EVENT‬
‭ .‬
‭ EVENT_TYPE‬
‭ .‭
‭O
‬NSITE‬
).‬
‭ optional‬
‭ (),‬

attendees:‬‭
‭ Joi‬
.‭
‭ a
‬rray‬
()‬

.‬
‭ items‬
‭ (‬

Joi‬
‭ .‬
‭ string‬
‭ ()‬

.‭
‭r‬egex‬
(‭
‭/‬‭
^
‬‭
[‬‭
0
‬-9a-fA-F‬
]‭
‭ {
‬24}‬
$‭
‭ /
‬‭
)‬‬

.‭
‭m‬essages‬
({‬

'string.pattern.base'‬
‭ :‬‭
‭ 'Attendee‬‭
ID must be a valid 24-character‬
hexadecimal string'‬

})‬

)‬

.‬
‭ optional‬
‭ (),‬

thumbnail:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
().‬
‭ optional‬
‭ ().‬
‭ allow‬
‭ (‭
‭n‬ull‬
,‬‭
‭ ''‬
)‬

})‬

};‬

const‬‭
‭ getEventById‬‭
=‬‭
{‬

[Segments.‬
‭ PARAMS‬
‭ ]:‬‭
‭ Joi‬
.‭
‭ o
‬bject‬
().‬
‭ keys‬
‭ ({‬

id:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
()‬

.‬
‭ regex‬
‭ (‭
‭/‬‬
^‭
‭ [
‬‭
0‬-9a-fA-F‬
]‭
‭ {
‬24}‬
$‭
‭ /
‬‭
)‬‬

.‬
‭ required‬
‭ ()‬

.‬
‭ messages‬
‭ ({‬

'string.pattern.base'‬
‭ :‬‭
‭ 'Event ID must‬‭
be a valid 24-character hexadecimal‬
string'‬
‭ ,‬

'any.required'‬
‭ :‬‭
‭ 'Event ID is required'‬

})‬

})‬

};‬

const‬‭
‭ deleteEvent‬‭
=‬‭
{‬

[Segments.‬
‭ PARAMS‬
‭ ]:‬‭
‭ Joi‬
.‭
‭ o
‬bject‬
().‬
‭ keys‬
‭ ({‬

id:‬‭
‭ Joi‬
.‭
‭ s
‬tring‬
()‬

.‬
‭ regex‬
‭ (‭
‭/‬‬
^‭
‭ [
‬‭
0‬-9a-fA-F‬
]‭
‭ {
‬24}‬
$‭
‭ /
‬‭
)‬‬

.‬
‭ required‬
‭ ()‬

.‬
‭ messages‬
‭ ({‬

'string.pattern.base'‬
‭ :‬‭
‭ 'Event ID must‬‭
be a valid 24-character hexadecimal‬
string'‬
‭ ,‬

'any.required'‬
‭ :‬‭
‭ 'Event ID is required'‬

})‬

})‬

};‬

module‬
‭ .‬
‭ exports‬‭
‭ =‬‭
{‬

createEvent‬
‭ ,‬

requestMeeting‬
‭ ,‬

updateEvent‬
‭ ,‬

getEventById‬
‭ ,‬

deleteEvent‬

‭CHAPTER 6 RESULTS‬
‭The results of the above project are:‬

‭Figure: 5.1‬

‭Course layout is here‬


‭Figure:5.3‬

‭Lecture view‬

‭Figure : 5.4‬
‭Video play‬

‭22‬
‭Figure:5.5‬

‭Course edit mode‬


‭CHAPTER 7 CONCLUSION AND FUTURE SCOPE‬

‭Conclusion:‬
‭ ropship serves as a comprehensive digital learning platform focused on delivering quality‬
D
‭educational content to users in an accessible and efficient manner. By offering structured‬
‭courses across various domains, it empowers learners to take control of their personal and‬
‭professional development. With an intuitive interface and scalable architecture, the system‬
‭ensures a seamless experience from enrollment to course completion. Through consistent‬
‭performance and ease of use, Dropship positions itself as a reliable solution for modern‬
‭e-learning needs.‬

🔮 Future Scope‬

‭•‬‭In the future, Dropship aims to expand its course catalog by partnering with industry‬
‭experts and institutions to offer certified programs.‬

‭•‬‭The integration of AI-based personalization will enhance user experience by‬


‭recommending courses based on interests and performance.‬

‭•‬ ‭Additional features like community forums, mobile apps, multilingual support, and‬
‭live instructor sessions are planned to further enrich the learning journey.‬

‭•‬‭Dropship also envisions incorporating blockchain for certificate validation and secure‬
‭credential storage to boost trust and transparency in the education ecosystem.‬

‭24‬
‭REFERENCES‬

‭https://react.dev/‬
‭https://www.npmjs.com/package/html-docx-js‬
‭https://developer.mozilla.org/en-US/docs/Web/HTML‬
‭https://nodejs.org/docs/latest/api/‬
‭https://supabase.com/docs‬

‭VII‬

You might also like