Skip to content

Commit

Permalink
for secure before commit is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
bluejoyq committed Oct 30, 2020
0 parents commit 2274690
Show file tree
Hide file tree
Showing 125 changed files with 34,103 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
src/config/*
/src/config

/backend/config
backend/config
Binary file added INTRO_VIDEO/introduce.mp4
Binary file not shown.
Binary file added PPT/PPT.pdf
Binary file not shown.
Binary file added PPT/PPT.pptx
Binary file not shown.
377 changes: 377 additions & 0 deletions README.md

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions ask.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
1. 귀하의 계급 유형은 어떻게 되십니까?
****병사 ****간부

2. 오산기지에서 사용하는 HelpDesk 체계를 사용해 보셨습니까?
********아니요

**2번에서 예를 대답하셨다면 3~6번을 대답해 주십시오.**
3. 사용해 보셨다면 위 체계를 주로 어느 입장에서 사용하셨습니까?
****작업을 신청함 ****작업을 신청받음

4. 위 체계 사용시 불편함을 겪으신 적이 있으십니까?
********아니요

5. 불편함을 겪으셨다면 그 이유가 무엇입니까? (여러개 선택 가능)
****신청된 작업을 한눈에 알아보기 힘듬. ****작업 신청 방법이 어려움.
****모든 작업이 같은 정보를 받아, 필요한 정보를 전달받지 못함.
****기타

6. 위 체계에서 개선하고 싶은 점을 자유롭게 적어주십시오.

7. 사용자 지원 센터에서 작업을 접수받거나 접수한적이 있으십니까?
********아니요

**7번에서 예를 대답하셨다면 8~9번을 대답해주십시오.**
8. 작업 접수 과정이나 접수를 전달받는 과정에서 불편을 겪으신 적이 있으십니까?
********아니요

9. 불편함을 겪으셨다면 그 이유가 무엇입니까? (여러개 선택 가능)
****전화로 해야해 불편함 ****간단한 작업도 복잡한 절차로 신청됨
****원하는 정보를 신청자에게서 받을 수 없음(양식이 정해짐).
****간단한 안내여서 굳이 전화할 필요가 없었음(단순 전화번호 안내)
****기타

10. 위 부서에서 작업을 직접 접수, 분류하는 대신 사용자가 원하는 작업을 웹으로 선택해 신청하면 분류와 알림까지 진행해주는 체계에 대해 어떻게 생각하십니까?
****매우 긍정적 ****긍정적 ****보통 ****부정적 ****매우 부정적

11. 챗봇이 간단한 전화 안내나 작업 접수를 대신하는 것에 대해서 어떻게 생각하십니까?
****매우 긍정적 ****긍정적 ****보통 ****부정적 ****매우 부정적
144 changes: 144 additions & 0 deletions backend/db/account.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import mysql from 'mysql2/promise';
import sqlSetting from '../config/sqlSetting.js';

const pool = mysql.createPool(sqlSetting);

export const getConnection = async () => {
try{
const connection = await pool.getConnection(async conn => conn);

return connection;
} catch(err){
throw({...err, type:"db not connect", where:"getConnection", responseCode: 500});
}

};

export const isIdExists = async (userId)=>{
const connection = await getConnection();
try{
let query= `SELECT EXISTS (SELECT * FROM account WHERE userId='${userId}') AS success;`

let [results] = await connection.query(query);
if(results.success)
return({success:true, data:true})
else
return({success:true, data:false})
} catch(err){
throw {...err, type: "id exist",where:"isIdExists",responseCode: 400};
} finally {
connection.release();
}
}

export const getSaltInfo = async (userId) => {
const connection = await getConnection();
try{
let query= `SELECT userPWSalt FROM account WHERE userId='${userId}';`
let [salts] = await connection.query(query);
if(salts.length)
return({success:true, data:salts[0]['userPWSalt']});
else {
throw {type:"no id", where:"getSaltInfo"};
}
} catch(err){
throw {...err, type: err.type, where:"getSaltInfo", responseCode: 400};
} finally {
connection.release();
}
}

export const login = async ({userId, userPWHash, userPWSalt}) => {
const connection = await getConnection();
try{
let query= `SELECT userId, userRank, userName, isWorker, userType FROM account WHERE userId='${userId}' AND userPWHash='${userPWHash}' AND userPWSalt='${userPWSalt}';`
let [results] = await connection.query(query);
if(results.length)
return({success:true, data:results[0]});
else {
throw {type:"no id or wrong pw", where:"login"};
}
} catch(err){
throw {...err, type: err.type, where:"login",responseCode: 400};
} finally {
connection.release();
}
}

const userTypeInfo = {
유선장비정비과: "ce",
무선음향정비과: "ws",
라인PC정비과: "lp",
회의FAX지원과: "cf",
체계관제과: "sc",
네트워크관리과: "nm",
정보보안과: "is",
개발과: "de",
체계관리과: "sm",
}
function getUserType (userUnit) {
let userType = userTypeInfo[userUnit];
if(userType === undefined) return "xx";
return userType;
}

/*
*/
export const signUp = async ({userId, userName, userTel, userUnit, userRank, userPWHash, userPWSalt, isWorker, userType})=> {
const connection = await getConnection();
try{
let tf, userType;
if(isWorker){
userType = getUserType(userUnit);
tf = 1;
}
else {
userType="xx";
tf = 0;
}
let values = `values('${userId}','${userName}','${userTel}','${userUnit}','${userRank}','${userPWHash}','${userPWSalt}','${tf}', '${userType}')`
let query= `INSERT INTO account ${values};`

await connection.query(query);
return {success:true}
} catch(err){
throw {...err, type: "alreay have same user", where: "signUp",responseCode: 400};
} finally {
connection.release();
}
}


export const getUserInfo = async (id) => {
const connection = await getConnection();
try{
let query= `SELECT userId,userName,userTel,userUnit,userRank,userType,isWorker FROM account WHERE userId='${id}';`
let [results] = await connection.query(query);
if(results.length)
return {success:true,data:results[0]};
else
throw {type:"no that user"};
} catch(err){
throw {...err, type:err.type, whrere:"getUserInfo",responseCode: 400};
} finally {
connection.release();
}
}


export const getAllUserInfo = async ()=> {
const connection = await getConnection();
try{
let query= `SELECT * FROM account;`
let [results] = await connection.query(query);
if(!results.length)
throw {type:"no user"};
else
return {success:true,data:results}
} catch(err){
throw {...err, type: err.type, where: 'getAllUserInfo',responseCode: 400};
} finally {
connection.release();
}
}
158 changes: 158 additions & 0 deletions backend/db/works.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import mysql from 'mysql2/promise';
import sqlSetting from '../config/sqlSetting.js';

const pool = mysql.createPool(sqlSetting);



export const getConnection = async () => {
try{
const connection = await pool.getConnection(async conn => conn);

return connection;
} catch(err){
throw({...err, type:"db not connect", where:"getConnection", responseCode: 500});
}

};

export const getWorksLength = async () => {
const connection = await getConnection();
try{
let query = `select ;`

} catch(err){
throw {...err, type: "no workId",where:"getWorkUserType",responseCode: 400};
} finally {
connection.release();
}
};

export const getWorkInfoByNum = async ({start,end, my, userId, userType})=>{
const connection = await getConnection();
try{

let cond = (my === 'true' ? ("userId='" + userId + "'") :("workUserType='" + userType + "'"));
let query= `SELECT * FROM works WHERE ${cond};` // LIMIT ${start}, ${end}
let [results] = await connection.query(query);
if(results.length)
return({success:true, data:results})
else {
return({success:false})
}

} catch(err){
throw {...err, type: "wrong index",where:"getWorkInfoByNum",responseCode: 400};
} finally {
connection.release();
}
};

export const getWorkInfoById = async (workId)=>{
const connection = await getConnection();
try{
let query= `SELECT * FROM works WHERE workId='${workId}';`

let [results] = await connection.query(query);
if(results.length)
return({success:true, data:results[0]})
else
return({success:false})
} catch(err){
throw {...err, type: "no workId",where:"getWorkUserType",responseCode: 400};
} finally {
connection.release();
}
};

export const changeWorkStatus = async ({workId, userType,workStatus, workComment})=>{
const connection = await getConnection();
try{
let query= `UPDATE works SET workStatus='${workStatus}',workComment='${workComment}', workEndTime=NOW() WHERE workId=${workId} AND workUserType='${userType}';`
await connection.query(query);
return({success:true})
} catch(err){
throw {...err, type: "someting wrong",where:"changeWorkStatus",responseCode: 400};
} finally {
connection.release();
}
};

export const addWork = async ({workUserName, workUserTel, workUserUnit, workUserRank, workOtherInfo, userId, workUserType})=>{
const connection = await getConnection();
try{
let values = `('${workUserName}', '${workUserTel}', '${workUserUnit}', '${workUserRank}', '${workOtherInfo}', '${userId}', '${workUserType}', NOW())`;
let query= `INSERT INTO works (workUserName, workUserTel, workUserUnit, workUserRank, workOtherInfo, userId, workUserType, workRegisterTime) VALUES ${values};`
await connection.query(query);
return({success:true})
} catch(err){
throw {...err, type: "data error",where:"addWork",responseCode: 400};
} finally {
connection.release();
}
};

export const updateWork = async ({userId, workOtherInfo, workId})=>{
const connection = await getConnection();
try{

let query= `UPDATE works SET workOtherInfo = '${workOtherInfo}',workStatus='w',workEndTime=NULL WHERE userId='${userId}' AND workId=${workId};`
await connection.query(query);

return({success:true})
} catch(err){
throw {...err, type: "data error",where:"updateWork",responseCode: 400};
} finally {
connection.release();
}
};

export const deleteWork = async ({userId, workId})=>{
const connection = await getConnection();
try{

let query= `DELETE FROM works WHERE userId='${userId}' AND workId=${workId};`
await connection.query(query);

return({success:true})
} catch(err){
throw {...err, type: "data error",where:"deleteWork",responseCode: 400};
} finally {
connection.release();
}
};


export const getWorkCount = async ({userId, userType})=>{
const connection = await getConnection();
try{
let query= `SELECT COUNT(CASE WHEN userId='${userId}' AND workStatus='w' THEN 1 END) as applyCount,COUNT(CASE WHEN workUserType='${userType}'AND workStatus='w' THEN 1 END) as getCount FROM works;`
let [results] = await connection.query(query);
if(results.length)
return({success:true, data:results[0]})
else
return({success:false})
} catch(err){
throw {...err, type: "data error",where:"getWorkCount",responseCode: 400};
} finally {
connection.release();
}
};

export const workCheck = async ({userId, userType})=>{
const connection = await getConnection();
try{
let applyQuery= `SELECT workId, workStatus FROM works WHERE userId='${userId}';`
let getQuery= `SELECT workId, workStatus FROM works WHERE workUserType='${userType}';`
let [getResults] = await connection.query(getQuery);
let [applyResults] = await connection.query(applyQuery);
if(getResults.length ||applyResults.length )
return({success:true, data:{get: getResults, apply: applyResults}});
else
return({success:false})
} catch(err){
throw {...err, type: "data error",where:"getWorkCount",responseCode: 400};
} finally {
connection.release();
}
};
Loading

0 comments on commit 2274690

Please sign in to comment.