First prototypes
This commit is contained in:
parent
58b5ddb660
commit
639383b008
|
|
@ -7,7 +7,7 @@ Application.use(
|
||||||
express.static(
|
express.static(
|
||||||
resolve("./public"),{
|
resolve("./public"),{
|
||||||
etag: true,
|
etag: true,
|
||||||
lastModified: false
|
lastModified: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -4,6 +4,7 @@ const {ConnectSessionKnexStore} = require('connect-session-knex');
|
||||||
const {Application} = require("../core/server");
|
const {Application} = require("../core/server");
|
||||||
|
|
||||||
Application.set('trust proxy', 1);
|
Application.set('trust proxy', 1);
|
||||||
|
Application.enable('trust proxy');
|
||||||
|
|
||||||
const store = new ConnectSessionKnexStore({
|
const store = new ConnectSessionKnexStore({
|
||||||
knex: DB,
|
knex: DB,
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,33 @@ async function createEvent(owner_id, studentid, catalogid)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function countEvents()
|
async function countEvents(owner_id, searchTerm)
|
||||||
{
|
{
|
||||||
return 0
|
return (
|
||||||
|
await DB
|
||||||
|
.select([
|
||||||
|
"student_events.id as id",
|
||||||
|
"students.name as studentname",
|
||||||
|
"students.surname as studentsurname",
|
||||||
|
"student_events.score",
|
||||||
|
"events.name as catalog",
|
||||||
|
"student_events.created_at",
|
||||||
|
])
|
||||||
|
.table("student_events")
|
||||||
|
.innerJoin("students","students.id","=","student_id")
|
||||||
|
.innerJoin("events","events.id","=","event_id")
|
||||||
|
.where("student_events.owner_id",owner_id)
|
||||||
|
.where(function(q){
|
||||||
|
q.where("students.name","like",`%${searchTerm ?? ""}%`)
|
||||||
|
q.orWhere("events.name","like",`%${searchTerm ?? ""}%`)
|
||||||
|
})
|
||||||
|
.orderBy("student_events.created_at","desc")
|
||||||
|
.whereNull("student_events.deleted_at")
|
||||||
|
.whereNull("students.deleted_at")
|
||||||
|
.whereNull("events.deleted_at")
|
||||||
|
.count("student_events.id as total")
|
||||||
|
.first()
|
||||||
|
).total;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getEvents(owner_id,start,length,searchTerm)
|
async function getEvents(owner_id,start,length,searchTerm)
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@
|
||||||
dataTable = $("#eventslist").DataTable({
|
dataTable = $("#eventslist").DataTable({
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
processing: true,
|
processing: true,
|
||||||
autoWidth: false,
|
responsive: true,
|
||||||
ajax: {
|
ajax: {
|
||||||
url: "/events/list",
|
url: "/events/list",
|
||||||
method:"post"
|
method:"post"
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
<ul class="main-nav p-0 mt-2">
|
<ul class="main-nav p-0 mt-2">
|
||||||
<li class="menu-title no-sub">
|
<li class="menu-title no-sub">
|
||||||
<a href="/">
|
<a href="/">
|
||||||
Anasayfa
|
Öğrenci Skor Tablosu
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="menu-title">
|
<li class="menu-title">
|
||||||
|
|
@ -66,13 +66,13 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="menu-title"><span>Hesap</span></li>
|
<li class="menu-title"><span>Hesap</span></li>
|
||||||
<li class="no-sub">
|
<!--li class="no-sub">
|
||||||
<a href="/profile">
|
<a href="/profile">
|
||||||
<svg stroke="currentColor" stroke-width="1.5">
|
<svg stroke="currentColor" stroke-width="1.5">
|
||||||
</svg>
|
</svg>
|
||||||
Hesap Ayarları
|
Hesap Ayarları
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li-->
|
||||||
<li class="no-sub text-danger">
|
<li class="no-sub text-danger">
|
||||||
<a href="/logout" class=" text-danger">
|
<a href="/logout" class=" text-danger">
|
||||||
<svg stroke="currentColor" stroke-width="1.5">
|
<svg stroke="currentColor" stroke-width="1.5">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue