Init project
This commit is contained in:
parent
050fdb4f64
commit
e5d6c890a8
46 changed files with 7856 additions and 0 deletions
13
cms/src/lib/data/info.json
Normal file
13
cms/src/lib/data/info.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"contact":{
|
||||
"company_name": "กองสรรหาบุคคล",
|
||||
"description":
|
||||
"มีหน้าที่รับผิดชอบเกี่ยวกับการสรรหาและเลือกสรรบุคคลเข้ารับราบการเป็นข้าราขการกรุงเทพมหานคร สามัญและข้าราชการครูกรุงเทพมหานครเฉพาะสังกัดสำนักพัฒนาชุมชน ....",
|
||||
"contact_email_address": "sale@frappet.com",
|
||||
"phone": "(662) xxx xxx",
|
||||
"address": "123 Example Street, xxx, 9876, yyy",
|
||||
"zip": "10510",
|
||||
"Country": "Thailand"
|
||||
}
|
||||
|
||||
}
|
||||
8
cms/src/lib/data/info.test.ts
Normal file
8
cms/src/lib/data/info.test.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
//TDD
|
||||
import {it,expect } from 'vitest'
|
||||
import {getContact} from './info'
|
||||
it('test getContact() ',async ()=>{
|
||||
const result = await getContact()
|
||||
expect(result.company_name).toBe("กองสรรหาบุคคล")
|
||||
expect(result.Country).toBe("Thailand")
|
||||
})
|
||||
4
cms/src/lib/data/info.ts
Normal file
4
cms/src/lib/data/info.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import info from "./info.json"
|
||||
export async function getContact(){
|
||||
return info.contact
|
||||
}
|
||||
72
cms/src/lib/data/users.json
Normal file
72
cms/src/lib/data/users.json
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Leanne Graham",
|
||||
"username": "Bret",
|
||||
"email": "Sincere@april.biz",
|
||||
"phone": "1-770-736-8031 x56442"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Ervin Howell",
|
||||
"username": "Antonette",
|
||||
"email": "Shanna@melissa.tv",
|
||||
"phone": "010-692-6593 x09125"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "Clementine Bauch",
|
||||
"username": "Samantha",
|
||||
"email": "Nathan@yesenia.net",
|
||||
"phone": "1-463-123-4447"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"name": "Patricia Lebsack",
|
||||
"username": "Karianne",
|
||||
"email": "Julianne.OConner@kory.org",
|
||||
"phone": "493-170-9623 x156"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "Chelsey Dietrich",
|
||||
"username": "Kamren",
|
||||
"email": "Lucio_Hettinger@annie.ca",
|
||||
"phone": "(254)954-1289"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "Mrs. Dennis Schulist",
|
||||
"username": "Leopoldo_Corkery",
|
||||
"email": "Karley_Dach@jasper.info",
|
||||
"phone": "1-477-935-8478 x6430"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"name": "Kurtis Weissnat",
|
||||
"username": "Elwyn.Skiles",
|
||||
"email": "Telly.Hoeger@billy.biz",
|
||||
"phone": "210.067.6132"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"name": "Nicholas Runolfsdottir V",
|
||||
"username": "Maxime_Nienow",
|
||||
"email": "Sherwood@rosamond.me",
|
||||
"phone": "586.493.6943 x140"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"name": "Glenna Reichert",
|
||||
"username": "Delphine",
|
||||
"email": "Chaim_McDermott@dana.io",
|
||||
"phone": "(775)976-6794 x41206"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"name": "Clementina DuBuque",
|
||||
"username": "Moriah.Stanton",
|
||||
"email": "Rey.Padberg@karina.biz",
|
||||
"phone": "024-648-3804"
|
||||
}
|
||||
]
|
||||
28
cms/src/lib/data/users.ts
Normal file
28
cms/src/lib/data/users.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import users from "./users.json"
|
||||
let userid =100
|
||||
|
||||
export interface User {
|
||||
id: number;
|
||||
email: string;
|
||||
username: string;
|
||||
name:string;
|
||||
last_name: string;
|
||||
phone:string
|
||||
}
|
||||
export async function getUser(id:number){
|
||||
return users.find(u=>u.id===id)
|
||||
}
|
||||
export async function getUsers(){
|
||||
return users
|
||||
}
|
||||
export async function createUser(u:User){
|
||||
u.id= userid++
|
||||
return users.push(u)
|
||||
}
|
||||
export async function updateUser(u:User){
|
||||
const user = await getUser(u.id)
|
||||
if(!user)
|
||||
return user
|
||||
user.phone = u.phone
|
||||
return user
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue