Skip to content

Commit ccecfde

Browse files
author
iamdyt
committed
final commit
1 parent 44ac6fb commit ccecfde

File tree

14 files changed

+479
-94
lines changed

14 files changed

+479
-94
lines changed

controllers/eventsControllerHome.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const knexoption = require('../knexfile');
2+
const knex = require('knex')(knexoption);
3+
module.exports={
4+
index:async(request,response)=>{
5+
events = await knex('events').select('*');
6+
response.render('home/events',{events});
7+
},
8+
};

controllers/sermonsControllerHome.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const knexoption = require('../knexfile');
2+
const knex = require('knex')(knexoption);
3+
module.exports = {
4+
index: async (request,response)=>{
5+
sermons = await knex('sermons')
6+
.join('categories','sermons.category_id','=','categories.id')
7+
.select('sermons.id','sermons.title', 'sermons.created_at as datey','sermons.contents','categories.name as catname');
8+
response.render('home/sermons',{
9+
sermons
10+
});
11+
12+
},
13+
show: async (request,response)=>{
14+
15+
const sermons = await knex('sermons')
16+
.where('sermons.id', request.params.id)
17+
.select('sermons.id','sermons.title','sermons.created_at as datey','sermons.contents','categories.name as catname','categories.id as catid')
18+
.join('categories','sermons.category_id','=','categories.id');
19+
20+
response.render('home/sermonsingle',{sermon:sermons[0]})
21+
22+
},
23+
24+
};

db/chms.sql

+322
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,322 @@
1+
-- phpMyAdmin SQL Dump
2+
-- version 4.8.5
3+
-- https://www.phpmyadmin.net/
4+
--
5+
-- Host: 127.0.0.1
6+
-- Generation Time: Oct 09, 2019 at 11:09 AM
7+
-- Server version: 10.1.38-MariaDB
8+
-- PHP Version: 7.3.3
9+
10+
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11+
SET AUTOCOMMIT = 0;
12+
START TRANSACTION;
13+
SET time_zone = "+00:00";
14+
15+
16+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
17+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
18+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
19+
/*!40101 SET NAMES utf8mb4 */;
20+
21+
--
22+
-- Database: `chms`
23+
--
24+
25+
-- --------------------------------------------------------
26+
27+
--
28+
-- Table structure for table `admins`
29+
--
30+
31+
CREATE TABLE `admins` (
32+
`id` int(11) NOT NULL,
33+
`username` varchar(25) NOT NULL,
34+
`email` varchar(30) NOT NULL,
35+
`password` varchar(30) NOT NULL,
36+
`image` varchar(100) NOT NULL
37+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
38+
39+
--
40+
-- Dumping data for table `admins`
41+
--
42+
43+
INSERT INTO `admins` (`id`, `username`, `email`, `password`, `image`) VALUES
44+
(1, 'admin', '[email protected]', '\0\0.AYz/Oz4xH2', '/assets/images/scam2.jpg');
45+
46+
-- --------------------------------------------------------
47+
48+
--
49+
-- Table structure for table `categories`
50+
--
51+
52+
CREATE TABLE `categories` (
53+
`id` int(11) NOT NULL,
54+
`name` varchar(100) NOT NULL
55+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
56+
57+
--
58+
-- Dumping data for table `categories`
59+
--
60+
61+
INSERT INTO `categories` (`id`, `name`) VALUES
62+
(1, 'Heaven'),
63+
(2, 'Prosperity'),
64+
(3, 'Sin--Hell'),
65+
(4, 'HolyGhost'),
66+
(5, 'Trinity'),
67+
(6, 'Jesus'),
68+
(7, 'Son of God (Son of Man)');
69+
70+
-- --------------------------------------------------------
71+
72+
--
73+
-- Table structure for table `events`
74+
--
75+
76+
CREATE TABLE `events` (
77+
`id` int(11) NOT NULL,
78+
`name` varchar(100) NOT NULL,
79+
`venue` varchar(100) NOT NULL,
80+
`description` text NOT NULL,
81+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
82+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
83+
84+
--
85+
-- Dumping data for table `events`
86+
--
87+
88+
INSERT INTO `events` (`id`, `name`, `venue`, `description`, `created_at`) VALUES
89+
(1, 'Jesus Crusade', 'Church Auditorium', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at', '2019-09-12 07:20:27'),
90+
(2, 'Destiny Helper', 'Prayer Ground', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at', '2019-09-12 07:21:35'),
91+
(3, 'The coming King', 'Church Auditorium', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta atLorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at', '2019-09-12 07:22:06');
92+
93+
-- --------------------------------------------------------
94+
95+
--
96+
-- Table structure for table `members`
97+
--
98+
99+
CREATE TABLE `members` (
100+
`id` int(11) NOT NULL,
101+
`first_name` varchar(100) NOT NULL,
102+
`last_name` varchar(100) NOT NULL,
103+
`dob` varchar(1000) NOT NULL,
104+
`gender` varchar(100) NOT NULL,
105+
`occupation` varchar(100) NOT NULL,
106+
`phone` varchar(100) NOT NULL,
107+
`email` varchar(100) NOT NULL,
108+
`address` text NOT NULL,
109+
`marital_status` varchar(15) NOT NULL,
110+
`pics` varchar(100) NOT NULL,
111+
`unit_id` int(11) NOT NULL
112+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
113+
114+
--
115+
-- Dumping data for table `members`
116+
--
117+
118+
INSERT INTO `members` (`id`, `first_name`, `last_name`, `dob`, `gender`, `occupation`, `phone`, `email`, `address`, `marital_status`, `pics`, `unit_id`) VALUES
119+
(1, 'Tijani', 'Raphael', '2019-09-05', 'Male', 'Realtor', '09089765412', '[email protected]', 'Birthdays:\r\nBishop(48), Truetalk(34), ogbon(40), soladel(39), uchvic(33), slypacino, xstudios(43), babybos(53), Palazo(39), kasmail(36), adeobaoluw, Badro(34), vicholas(40), despam(30), bundur(31), segzysexy, succri(30), nineteen(36), dania02(27), Kriely, Umargarr(51), JojoArmani, segzy14, Mescopaul(25), eudoh940, adeoba2008(37), Donzee02(32), ufelove, hiroz, Mantissa89(30), aywhy93(26), Tosadel(32), Joeguyski(24), Jmacke(31), abiolert(33), Iyabetajos, Martnz, markidoo(31), chudy11(29), danysi(40), rust6(22), ObioraIkenna(31), coatofwealth(28), Olatara, lexychuks, woblow1(35), SUMCIOUZ(27), EaglesT, Asebaba1(37), iamscope(22), shawnfamous, stoyaldeway, frenzyplanet(30), leadknight123(30), sabacity(29), duran2059(28), jonsnow92(45), Intrepidone, parlvyke1(37), mudolak(34), Chumani(18), lavenjcrown, adamyakub(33), larsson442(30), stoneaustin, otuekong1, damolah10(29), olimilove(27), matrix199(38), Holiyo(26), showsax(27), DavSagacity, donk552(40), Hybbee(29), Sheyifunmie(24), DeWorlex45(34), Electroweb(43), ', 'Married', '/assets/images/adminscam.jpg', 0),
120+
(2, 'Abraham', 'Maslow', '1986-03-03', 'Male', 'Teache', '09065432189', '[email protected]', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at', 'Married', '/assets/images/avatar.png', 0),
121+
(3, 'Adelakun', 'Peace', '2005-07-04', 'Female', 'student', '08056432189', '[email protected]', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at', 'Single', '/assets/images/avatar2.png', 0),
122+
(4, 'Ipadeola', 'Abolarinwa', '1980-10-07', 'Female', 'Doctor', '07045678909', '[email protected]', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at', 'Married', '/assets/images/blog-details-author.png', 0);
123+
124+
-- --------------------------------------------------------
125+
126+
--
127+
-- Table structure for table `prayers`
128+
--
129+
130+
CREATE TABLE `prayers` (
131+
`id` int(11) NOT NULL,
132+
`name` varchar(20) NOT NULL,
133+
`request` text NOT NULL,
134+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
135+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
136+
137+
--
138+
-- Dumping data for table `prayers`
139+
--
140+
141+
INSERT INTO `prayers` (`id`, `name`, `request`, `created_at`) VALUES
142+
(1, 'Sin--Hell', 'gggggggg', '2019-09-13 05:49:25'),
143+
(2, 'Sin--Hell', 'uyyag ba', '2019-09-13 05:49:57');
144+
145+
-- --------------------------------------------------------
146+
147+
--
148+
-- Table structure for table `sermons`
149+
--
150+
151+
CREATE TABLE `sermons` (
152+
`id` int(11) NOT NULL,
153+
`title` varchar(100) NOT NULL,
154+
`contents` text NOT NULL,
155+
`category_id` int(11) NOT NULL,
156+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
157+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
158+
159+
--
160+
-- Dumping data for table `sermons`
161+
--
162+
163+
INSERT INTO `sermons` (`id`, `title`, `contents`, `category_id`, `created_at`) VALUES
164+
(1, 'The Destiny Helper', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at', 6, '2019-09-12 07:23:19'),
165+
(2, 'When God Joins your enemy', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta atLorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at', 5, '2019-09-12 07:23:42');
166+
167+
-- --------------------------------------------------------
168+
169+
--
170+
-- Table structure for table `sessions`
171+
--
172+
173+
CREATE TABLE `sessions` (
174+
`session_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
175+
`expires` int(11) UNSIGNED NOT NULL,
176+
`data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
177+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
178+
179+
--
180+
-- Dumping data for table `sessions`
181+
--
182+
183+
INSERT INTO `sessions` (`session_id`, `expires`, `data`) VALUES
184+
('O3YuymAq1Uj6BDFicXpNoRmvA3brf90j', 1570692287, '{\"cookie\":{\"originalMaxAge\":null,\"expires\":null,\"httpOnly\":true,\"path\":\"/\"}}'),
185+
('b3hZqHdmvcV9s9Npe-pzyBalMpr-JlFi', 1570698519, '{\"cookie\":{\"originalMaxAge\":null,\"expires\":null,\"httpOnly\":true,\"path\":\"/\"},\"flash\":{},\"adminname\":\"admin\",\"adminid\":1,\"adminimage\":\"/assets/images/scam2.jpg\"}'),
186+
('m84g-MaatyWQ-0aj-mLdp1aIKyyy_ZIS', 1570622735, '{\"cookie\":{\"originalMaxAge\":null,\"expires\":null,\"httpOnly\":true,\"path\":\"/\"}}'),
187+
('nYVDtBxdOmBkkS244bAehFV3edHmbkvs', 1570622733, '{\"cookie\":{\"originalMaxAge\":null,\"expires\":null,\"httpOnly\":true,\"path\":\"/\"}}');
188+
189+
-- --------------------------------------------------------
190+
191+
--
192+
-- Table structure for table `units`
193+
--
194+
195+
CREATE TABLE `units` (
196+
`id` int(11) NOT NULL,
197+
`name` varchar(100) NOT NULL,
198+
`description` text NOT NULL,
199+
`head` int(11) DEFAULT NULL
200+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
201+
202+
--
203+
-- Dumping data for table `units`
204+
--
205+
206+
INSERT INTO `units` (`id`, `name`, `description`, `head`) VALUES
207+
(1, 'Choir', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at \r\n', 1),
208+
(2, 'Technical', 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugiat ullam ut libero ea deserunt a soluta at', 2);
209+
210+
--
211+
-- Indexes for dumped tables
212+
--
213+
214+
--
215+
-- Indexes for table `admins`
216+
--
217+
ALTER TABLE `admins`
218+
ADD PRIMARY KEY (`id`);
219+
220+
--
221+
-- Indexes for table `categories`
222+
--
223+
ALTER TABLE `categories`
224+
ADD PRIMARY KEY (`id`);
225+
226+
--
227+
-- Indexes for table `events`
228+
--
229+
ALTER TABLE `events`
230+
ADD PRIMARY KEY (`id`);
231+
232+
--
233+
-- Indexes for table `members`
234+
--
235+
ALTER TABLE `members`
236+
ADD PRIMARY KEY (`id`);
237+
238+
--
239+
-- Indexes for table `prayers`
240+
--
241+
ALTER TABLE `prayers`
242+
ADD PRIMARY KEY (`id`);
243+
244+
--
245+
-- Indexes for table `sermons`
246+
--
247+
ALTER TABLE `sermons`
248+
ADD PRIMARY KEY (`id`);
249+
250+
--
251+
-- Indexes for table `sessions`
252+
--
253+
ALTER TABLE `sessions`
254+
ADD PRIMARY KEY (`session_id`);
255+
256+
--
257+
-- Indexes for table `units`
258+
--
259+
ALTER TABLE `units`
260+
ADD PRIMARY KEY (`id`),
261+
ADD KEY `head` (`head`);
262+
263+
--
264+
-- AUTO_INCREMENT for dumped tables
265+
--
266+
267+
--
268+
-- AUTO_INCREMENT for table `admins`
269+
--
270+
ALTER TABLE `admins`
271+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
272+
273+
--
274+
-- AUTO_INCREMENT for table `categories`
275+
--
276+
ALTER TABLE `categories`
277+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
278+
279+
--
280+
-- AUTO_INCREMENT for table `events`
281+
--
282+
ALTER TABLE `events`
283+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
284+
285+
--
286+
-- AUTO_INCREMENT for table `members`
287+
--
288+
ALTER TABLE `members`
289+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
290+
291+
--
292+
-- AUTO_INCREMENT for table `prayers`
293+
--
294+
ALTER TABLE `prayers`
295+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
296+
297+
--
298+
-- AUTO_INCREMENT for table `sermons`
299+
--
300+
ALTER TABLE `sermons`
301+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
302+
303+
--
304+
-- AUTO_INCREMENT for table `units`
305+
--
306+
ALTER TABLE `units`
307+
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
308+
309+
--
310+
-- Constraints for dumped tables
311+
--
312+
313+
--
314+
-- Constraints for table `units`
315+
--
316+
ALTER TABLE `units`
317+
ADD CONSTRAINT `units_ibfk_1` FOREIGN KEY (`head`) REFERENCES `members` (`id`) ON DELETE SET NULL;
318+
COMMIT;
319+
320+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
321+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
322+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

0 commit comments

Comments
 (0)