Clean data and update mockup api spec
This commit is contained in:
parent
aaff6c92b8
commit
9012d03515
13 changed files with 171 additions and 77 deletions
|
|
@ -1,14 +1,18 @@
|
|||
export interface Exam {
|
||||
id:string;
|
||||
title:string;
|
||||
date:string;
|
||||
start?:Date|string;
|
||||
end?:Date|string;
|
||||
exam_date?:Date|string;
|
||||
announcement_date?:Date|string;
|
||||
detail?:string;
|
||||
date?:string;
|
||||
start?:string;
|
||||
end?:string;
|
||||
exam_date?:string;
|
||||
announcement_date?:string;
|
||||
category_id?:string
|
||||
category?:string
|
||||
img?:string;
|
||||
image?:string;
|
||||
images?:{title:string,url:string}[];
|
||||
files?:{title:string,url:string}[];
|
||||
|
||||
}
|
||||
export interface CalendarEvent {
|
||||
id:string;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
[
|
||||
{
|
||||
"id":"20",
|
||||
"date":"24 เม.ย. 2566 ",
|
||||
"start":"2023-04-24",
|
||||
"detail":"<p><b>ประกาศรายชื่อผู้ผ่านภาค</b> ข. และมีสิทธิสอบภาค ค. ในการคัดเลือกคนพิการ ครั้งที่ 1/2565</p> <p> <img src='https://webportal.bangkok.go.th/public/user_files_editor/305/%E0%B8%9B%E0%B8%8F%E0%B8%B4%E0%B8%97%E0%B8%B4%E0%B8%99%E0%B8%A7%E0%B8%B1%E0%B8%99%E0%B8%A0%E0%B8%B2%E0%B8%84%E0%B8%84.%E0%B8%84%E0%B8%99%E0%B8%9E%E0%B8%B4%E0%B8%81%E0%B8%B2%E0%B8%A3.jpg'> </p>",
|
||||
"title":"ประกาศรายชื่อผู้ผ่านภาค ข. และมีสิทธิสอบภาค ค. ในการคัดเลือกคนพิการ ครั้งที่ 1/2565",
|
||||
"img":"/images/c1.jpg",
|
||||
"images":[
|
||||
{
|
||||
"title":"ภาพ1",
|
||||
"url":"https://bma-qualifying.frappet.synology.me/images/c1.jpg"
|
||||
"title":"topic",
|
||||
"url":"/images/c1.jpg"
|
||||
}
|
||||
],
|
||||
"files":[
|
||||
|
|
@ -49,34 +47,50 @@
|
|||
},
|
||||
{
|
||||
"id":"19",
|
||||
"date":"13 เม.ย. 2566",
|
||||
"start":"2023-04-20T09:00:00",
|
||||
"detail":"ใครลืมส่งเอกสาร !! สำหรับการคัดเลือกคนพิการฯ ครั้งที่ 1/2565 ส่งเอกสารเพิ่มได้",
|
||||
"title":"ใครลืมส่งเอกสาร !! สำหรับการคัดเลือกคนพิการฯ ครั้งที่ 1/2565 ส่งเอกสารเพิ่มได้",
|
||||
"img":"/images/c2.jpg"
|
||||
"images":[
|
||||
{
|
||||
"title":"topic",
|
||||
"url":"/images/c2.jpg"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"18",
|
||||
"date":"9 เม.ย. 2566",
|
||||
"start":"2023-03-28T09:00:00",
|
||||
"detail":"แผนที่การเดินทางมาสนามสอบคนพิการฯ ครั้งที่ 1/2565",
|
||||
"title":"แผนที่การเดินทางมาสนามสอบคนพิการฯ ครั้งที่ 1/2565",
|
||||
"img":"/images/c3.jpg"
|
||||
"images":[
|
||||
{
|
||||
"title":"topic",
|
||||
"url":"/images/c3.jpg"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"17",
|
||||
"date":"28 มี.ย. 2566",
|
||||
"start":"2023-03-28T09:00:00",
|
||||
"detail":"การสอบแข่งขันเพื่อรรจุและแต่งตั้งบุคคลเข้ารับราชการเป็นข้าราชการกรุงเทพมหานครสามัญ ครั้งที่ 2/2566",
|
||||
"title":"การสอบแข่งขันเพื่อรรจุและแต่งตั้งบุคคลเข้ารับราชการเป็นข้าราชการกรุงเทพมหานครสามัญ ครั้งที่ 2/2566",
|
||||
"img":"/images/c1.jpg"
|
||||
"images":[
|
||||
{
|
||||
"title":"topic",
|
||||
"url":"/images/c1.jpg"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"16",
|
||||
"date":"10 มี.ค. 2556",
|
||||
"start":"2023-03-10T09:00:00",
|
||||
"detail":"การสอบแข่งขันเพื่อรรจุและแต่งตั้งบุคคลเข้ารับราชการเป็นข้าราชการกรุงเทพมหานครสามัญ ครั้งที่ 1/2565",
|
||||
"title":"การสอบแข่งขันเพื่อรรจุและแต่งตั้งบุคคลเข้ารับราชการเป็นข้าราชการกรุงเทพมหานครสามัญ ครั้งที่ 1/2565",
|
||||
"img":"/images/c2.jpg"
|
||||
"images":[
|
||||
{
|
||||
"title":"topic",
|
||||
"url":"/images/c2.jpg"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -1,14 +1,23 @@
|
|||
[
|
||||
{
|
||||
"id":"21",
|
||||
"date":"24 เม.ย. 2566","institute":"สำนักงาน ก.ก.","institute_id":1,
|
||||
"catetory":"สำนักงาน ก.ก.","catetory_id":1,
|
||||
"start":"2023-04-24",
|
||||
"title":"ด่วน !! ประกาศวัน เวลา สถานที่ และระเบียบการคัดเลือกลูกจ้างกทม.",
|
||||
"detail":"<p><center><img src='https://webportal.bangkok.go.th/public/user_files_editor/305/bkkgovjob202303_12.jpg'></center></p><br/><center><h2>สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร ประกาศกำหนดวัน เวลา สถานที่คัดเลือก และระเบียบ เกี่ยวกับการคัดเลือกบุคลากรกรุงเทพมหานครหรือผู้ปฏิบัติงานอื่นในกรุงเทพมหานครเพื่อบรรจุและแต่งตั้ง เป็นข้าราชการกรุงเทพมหานครสามัญ ครั้งที่ 1 / 2565</h2></center>",
|
||||
"img":"/images/sel1.png",
|
||||
"images":[
|
||||
{
|
||||
"title":"topic",
|
||||
"url":"/images/sel1.png"
|
||||
},
|
||||
{
|
||||
"title":"การแต่งกาย",
|
||||
"url":"https://webportal.bangkok.go.th/public/user_files_editor/305/bkkgovjob202303_12.jpg"
|
||||
}
|
||||
],
|
||||
"files":[
|
||||
{
|
||||
"title":"รายละเอียดประกาศฯ",
|
||||
"title":"รายละเอียดประกาศ",
|
||||
"url":"https://webportal.bangkok.go.th/public/user_files_editor/305/%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%81%E0%B8%B2%E0%B8%A8%E0%B8%A7%E0%B8%B1%E0%B8%99%20%E0%B9%80%E0%B8%A7%E0%B8%A5%E0%B8%B2%20%E0%B8%AA%E0%B8%96%E0%B8%B2%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%84%E0%B8%B1%E0%B8%94%E0%B9%80%E0%B8%A5%E0%B8%B7%E0%B8%AD%E0%B8%81%E0%B8%A5%E0%B8%B9%E0%B8%81%E0%B8%88%E0%B9%89%E0%B8%B2%E0%B8%87%E0%B8%AF.pdf"
|
||||
},
|
||||
{
|
||||
|
|
@ -26,50 +35,63 @@
|
|||
{
|
||||
"title":"แผนผังสนามสอบ",
|
||||
"url":"https://file.thaijobjob.com/prakad/bkkgovjob202303/bkkgovjob202303_14"
|
||||
},
|
||||
{
|
||||
"title":"การแต่งกาย",
|
||||
"url":"https://webportal.bangkok.go.th/public/user_files_editor/305/bkkgovjob202303_12.jpg"
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
},
|
||||
{
|
||||
"id":"20",
|
||||
"date":"3 เม.ย. 2566","institute":"สำนักงาน ก.ก.","institute_id":1,
|
||||
"catetory":"สำนักงาน ก.ก.","catetory_id":1,
|
||||
"start":"2023-04-03",
|
||||
"title":"วัน เวลา สถานที่ และระเบียบการคัดเลือกลูกจ้างกทม.",
|
||||
"detail":"ด่วน !! ประกาศวัน เวลา สถานที่ และระเบียบการคัดเลือกลูกจ้างกทม.",
|
||||
"img":"/images/sel2.png",
|
||||
"docUrl":"https://webportal.bangkok.go.th/public/user_files_editor/305/%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%81%E0%B8%B2%E0%B8%A8%E0%B8%A7%E0%B8%B1%E0%B8%99%20%E0%B9%80%E0%B8%A7%E0%B8%A5%E0%B8%B2%20%E0%B8%AA%E0%B8%96%E0%B8%B2%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%84%E0%B8%B1%E0%B8%94%E0%B9%80%E0%B8%A5%E0%B8%B7%E0%B8%AD%E0%B8%81%E0%B8%A5%E0%B8%B9%E0%B8%81%E0%B8%88%E0%B9%89%E0%B8%B2%E0%B8%87%E0%B8%AF.pdf"
|
||||
"images":[
|
||||
{
|
||||
"title":"topic",
|
||||
"url":"/images/sel2.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"19",
|
||||
"date":"20 ธันวาคม 2566","institute":"สำนักการแพทย์","institute_id":3,
|
||||
"catetory":"สำนักการแพทย์","catetory_id":3,
|
||||
"start":"2003-12-20",
|
||||
"title":"ประกาศรับสมัครคัดเลือกบุคลากรกทม. !!",
|
||||
"img":"/images/sel3.png",
|
||||
"detail":"ประกาศรับสมัครคัดเลือกบุคลากรกทม. !!"
|
||||
"detail":"ประกาศรับสมัครคัดเลือกบุคลากรกทม. !!",
|
||||
"images":[
|
||||
{
|
||||
"title":"topic",
|
||||
"url":"/images/sel3.png"
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
{
|
||||
"id":"18",
|
||||
"date":"50 พ.ย. 2566","institute":"สำนักอนามัย","institute_id":2,
|
||||
"catetory":"สำนักอนามัย","catetory_id":2,
|
||||
"start":"2023-11-05T09:00:00",
|
||||
"title":"สอบครั้งที่ 1/2565",
|
||||
"detail":"สอบเป็นลูกจ้างและผู้ปฎิบัติงานในกรุงเทพมหานคร เป็นข้าราชการกรุงเทพมหานคร",
|
||||
"img":"/images/sel1.png",
|
||||
"docUrl":"https://webportal.bangkok.go.th/public/user_files_editor/305/%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%81%E0%B8%B2%E0%B8%A8%E0%B8%84%E0%B8%B1%E0%B8%94%E0%B9%80%E0%B8%A5%E0%B8%B7%E0%B8%AD%E0%B8%81%E0%B8%A5%E0%B8%B9%E0%B8%81%E0%B8%88%E0%B9%89%E0%B8%B2%E0%B8%87.pdf"
|
||||
"images":[
|
||||
{
|
||||
"title":"topic",
|
||||
"url":"/images/sel1.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"17",
|
||||
"date":"1 พ.ย. 2566","institute":"สำนักงาน ก.ก.","institute_id":1,
|
||||
"catetory":"สำนักงาน ก.ก.","catetory_id":1,
|
||||
"start":"2023-11-01",
|
||||
"title":"รับสมัครสอบตำแหน่งลูกจ้างและผู้ปฎิบัติงาน 1/2565",
|
||||
"detail":"รับสมัครสอบตำแหน่ง ลูกจ้างและผู้ปฎิบัติงานในกรุงเทพมหานคร เป็นข้าราชการกรุงเทพมหานคร",
|
||||
"img":"/images/sel2.png",
|
||||
"docUrl":"https://webportal.bangkok.go.th/public/user_files_editor/305/%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%81%E0%B8%B2%E0%B8%A8%E0%B8%84%E0%B8%B1%E0%B8%94%E0%B9%80%E0%B8%A5%E0%B8%B7%E0%B8%AD%E0%B8%81%E0%B8%A5%E0%B8%B9%E0%B8%81%E0%B8%88%E0%B9%89%E0%B8%B2%E0%B8%87.pdf"
|
||||
"images":[
|
||||
{
|
||||
"title":"topic",
|
||||
"url":"/images/sel2.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
|
|
@ -9,7 +9,6 @@
|
|||
dayjs.extend(buddhistEra)
|
||||
import type { LayoutData } from './$types';
|
||||
export let data: LayoutData;
|
||||
console.log(data)
|
||||
let {logo_url,supervised,divisions,institutes,address,organization} = data
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -18,14 +18,17 @@ export const load: PageServerLoad = async ({fetch}) => {
|
|||
if(res.ok){
|
||||
qualify_exams = await res.json()
|
||||
qualify_exams.forEach((e)=>{
|
||||
e.start? dayjs(e.start).format("DD MMM BBBB"):""
|
||||
e.date = e.start? dayjs(e.start).format("DD MMM BBBB"):""
|
||||
})
|
||||
for(let i=qualify_exams.length;i<3;i++){
|
||||
qualify_exams.push({id:"0",title:"",date:"",image:""})
|
||||
}
|
||||
}
|
||||
res = await fetch("/api/competitive")
|
||||
if(res.ok){
|
||||
competitive_exams = await res.json()
|
||||
competitive_exams.forEach((e)=>{
|
||||
e.start? dayjs(e.start).format("DD MMM BBBB"):""
|
||||
e.date = e.start? dayjs(e.start).format("DD MMM BBBB"):""
|
||||
})
|
||||
}
|
||||
return { content,image, qualify_exams,competitive_exams };
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
>
|
||||
<div class="card bg-white shadow-xl w-full ">
|
||||
<figure style="height: 250px;" class="img-hover-zoom--brightness">
|
||||
<img src={qualify_exams[0].img} alt="1" />
|
||||
<img src={qualify_exams[0].image} alt="1" />
|
||||
</figure>
|
||||
<div class="card-body">
|
||||
<div class="text-sm font-medium text-gray-500">
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
<div class="flex flex-col w-full">
|
||||
<div class="card card-side bg-white shadow-xl w-full">
|
||||
<figure class="w-full lg:w-5/12 imgCard">
|
||||
<img src={qualify_exams[1].img} alt="1" class="h-full" />
|
||||
<img src={qualify_exams[1].image} alt="1" class="h-full" />
|
||||
</figure>
|
||||
<div class="card-body w-full lg:w-7/12">
|
||||
<h2 class="text-sm font-medium text-gray-500">
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
<div class=" flex flex-col w-full">
|
||||
<div class="card card-side bg-white shadow-xl w-full">
|
||||
<figure class="w-full lg:w-5/12 imgCard">
|
||||
<img src={qualify_exams[2].img} alt="1" class="h-full"/>
|
||||
<img src={qualify_exams[2].image} alt="1" class="h-full"/>
|
||||
</figure>
|
||||
<div class="card-body w-full lg:w-7/12">
|
||||
<div class="text-sm font-medium text-gray-500">
|
||||
|
|
@ -212,7 +212,7 @@
|
|||
<div class="w-full lg:w-6/12 cardxl">
|
||||
<div class="card bg-white shadow-xl w-full ">
|
||||
<figure style="height: 250px;" class="img-hover-zoom--brightness">
|
||||
<img src={competitive_exams[0].img} alt="1" />
|
||||
<img src={competitive_exams[0].image} alt="1" />
|
||||
</figure>
|
||||
<div class="card-body">
|
||||
<div class="text-sm font-medium text-gray-500">
|
||||
|
|
@ -251,7 +251,7 @@
|
|||
<div class="flex flex-col w-full">
|
||||
<div class="card card-side bg-white shadow-xl w-full">
|
||||
<figure class="w-full lg:w-5/12 imgCard">
|
||||
<img src={competitive_exams[1].img} alt="1" class="h-full" />
|
||||
<img src={competitive_exams[1].image} alt="1" class="h-full" />
|
||||
</figure>
|
||||
<div class="card-body w-full lg:w-7/12">
|
||||
<h2 class="text-sm font-medium text-gray-500">
|
||||
|
|
@ -286,7 +286,7 @@
|
|||
<div class=" flex flex-col w-full">
|
||||
<div class="card card-side bg-white shadow-xl w-full">
|
||||
<figure class="w-full lg:w-5/12 imgCard">
|
||||
<img src={competitive_exams[2].img} alt="1" class="h-full"/>
|
||||
<img src={competitive_exams[2].image} alt="1" class="h-full"/>
|
||||
</figure>
|
||||
<div class="card-body w-full lg:w-7/12">
|
||||
<div class="text-sm font-medium text-gray-500">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,19 @@
|
|||
import type {RequestHandler } from './$types'
|
||||
import {json} from '@sveltejs/kit'
|
||||
import type {Exam} from '$lib/data/CMSDataType'
|
||||
import exams from "$lib/data/competitive-exam.json"
|
||||
export const GET: RequestHandler = async () => {
|
||||
return json(exams)
|
||||
import type { RequestEvent,RequestHandler } from './$types'
|
||||
export const GET: RequestHandler = async ({url}: RequestEvent) => {
|
||||
const limit= Number(url.searchParams.get("limit"))
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let ex:Exam[] = exams.map(({files,images,detail,...minimal})=>{
|
||||
if(images && images[0]){
|
||||
const image = images[0].url
|
||||
return {...minimal,image}
|
||||
}
|
||||
return minimal
|
||||
})
|
||||
if(limit>0){
|
||||
ex = exams.slice(0,limit)
|
||||
}
|
||||
return json(ex)
|
||||
}
|
||||
8
cms/src/routes/api/dev/+server.ts
Normal file
8
cms/src/routes/api/dev/+server.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import ver from "$lib/ver.json"
|
||||
import {json} from '@sveltejs/kit'
|
||||
import type { RequestHandler } from './$types'
|
||||
export const GET: RequestHandler = async () => {
|
||||
const version = ver.version
|
||||
const builddate = ver.builddate
|
||||
return json({version,builddate})
|
||||
}
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
import ver from "$lib/ver.json"
|
||||
import {json} from '@sveltejs/kit'
|
||||
import info from "$lib/data/info.json"
|
||||
import type { RequestHandler } from './$types'
|
||||
export const GET: RequestHandler = async () => {
|
||||
const version = ver.version
|
||||
const builddate = ver.builddate
|
||||
return json({...info,version,builddate})
|
||||
return json(info)
|
||||
}
|
||||
|
|
@ -1,6 +1,19 @@
|
|||
import type { RequestHandler } from './$types'
|
||||
import {json} from '@sveltejs/kit'
|
||||
import type {Exam} from '$lib/data/CMSDataType'
|
||||
import exams from "$lib/data/qualify-exam.json"
|
||||
export const GET: RequestHandler = async () => {
|
||||
return json(exams)
|
||||
import type { RequestEvent,RequestHandler } from './$types'
|
||||
export const GET: RequestHandler = async ({url}: RequestEvent) => {
|
||||
const limit= Number(url.searchParams.get("limit"))
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let ex:Exam[] = exams.map(({files,images,detail,...minimal})=>{
|
||||
if(images && images[0]){
|
||||
const image = images[0].url
|
||||
return {...minimal,image}
|
||||
}
|
||||
return minimal
|
||||
})
|
||||
if(limit>0){
|
||||
ex = exams.slice(0,limit)
|
||||
}
|
||||
return json(ex)
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import type { PageServerLoad } from './$types'
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type {CalendarEvent,Exam} from '$lib/data/CMSDataType'
|
||||
import dayjs from 'dayjs'
|
||||
import type { PageServerLoad } from './$types'
|
||||
export const load: PageServerLoad = async ({fetch}) => {
|
||||
let content = ""
|
||||
let exams:Exam[] = []
|
||||
|
|
@ -10,9 +11,10 @@ export const load: PageServerLoad = async ({fetch}) => {
|
|||
}
|
||||
|
||||
res = await fetch("/api/competitive")
|
||||
if(res.ok){
|
||||
exams = await res.json()
|
||||
if(!res.ok){
|
||||
throw error(res.status, 'ไม่สามารถอ่านข้อมูลการสอบได้');
|
||||
}
|
||||
exams = await res.json()
|
||||
|
||||
const events:CalendarEvent[]=[]
|
||||
exams.forEach((e)=>{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type {CalendarEvent,Exam} from '$lib/data/CMSDataType'
|
||||
import dayjs from 'dayjs'
|
||||
import type { PageServerLoad } from './$types'
|
||||
|
|
@ -10,16 +11,18 @@ export const load: PageServerLoad = async ({fetch}) => {
|
|||
content = (await res.json()).content
|
||||
}
|
||||
res = await fetch("/api/qualifying")
|
||||
if(res.ok){
|
||||
exams = await res.json()
|
||||
if(!res.ok){
|
||||
throw error(res.status, 'ไม่สามารถอ่านข้อมูลการสอบได้');
|
||||
}
|
||||
exams = await res.json()
|
||||
|
||||
const events:CalendarEvent[]=[]
|
||||
exams.forEach((e)=>{
|
||||
if(!e.start){
|
||||
e.date=""
|
||||
return
|
||||
}
|
||||
e.date= dayjs(e.start).format("DD MMM BBBB")
|
||||
e.date = e.start? dayjs(e.start).format("DD MMM BBBB"):""
|
||||
const {id,title,start,end,category_id} = e
|
||||
let backgroundColor =""
|
||||
switch (category_id) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue