Skip to content

Commit

Permalink
Merge pull request #100 from GDSC-PKNU-21-22/dev
Browse files Browse the repository at this point in the history
부리미 0.18v 배포
  • Loading branch information
pp449 authored Sep 11, 2023
2 parents 8069ac0 + 4b23259 commit a6e33a9
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 39 deletions.
130 changes: 130 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<div align=center>
<h3 align=center style="text-align: center; font-size: 3em border:none">부림이(BURIMI)</h2>
<img src='https://www.pknu.ac.kr/upload/raonkeditordata/2022/08/18/20220818_102123489_18337.png' width=200px height=200px />
</div>

<div align=center>
<h2 align=center style="text-align: center; font-size: 1.5em">부림이의 탄생배경</h2>

<p><b style='font-size:28px'>📣More Information, More Convenience🔎</b></p>
<p><b>부림이는 부경대학교 학생들이 대학 생활을 더 알차게 할 수 있는 정보들을 모아서 보여주고, 새로운 공지사항이나 정보가 생길 경우 알림을 제공해 주는 서비스에요</b></p>
</div>

<br />
<br />

# 주요기능

### 📢 공지사항 알림받기

`그런 공지사항이 올라왔었어?!`

- 본인 학과에 대한 공지사항을 바로 확인할 수 있어요
- 원한다면 공지사항 업로드 시 push 알림을 받을 수 있어요
<div style="display: flex">

<img width="400" alt="image" src="https://github.com/GDSC-PKNU-21-22/pknu-notice-front/assets/71641127/66975050-bf13-44a2-b124-ae08a569e03a">
</div>

### 🗺️ 학교 건물 파악하기

`C23, A15 건물이 어디야?`

- 수업을 들으러 가야하는데 학교 건물 위치가 헷갈리는 경우가 있어요
- 이럴땐 부림이를 통해 건물을 쉽게 찾아봐요 (길찾기 기능도 있어요!)

<img width="400" alt="image" src="https://github.com/hwinkr/algorithm/assets/68489467/b24fb19e-5609-436d-b3c7-80dbec2c548e">

### 🎓 졸업요건 확인하기

`우리 졸업하려면 무슨 수업 들어야돼?`

- 부림이가 각 학과별로 졸업요건을 미리 알아왔어요
- 여러분은 클릭 한 번으로 졸업요건을 볼 수 있어요

<img width="400" alt="image" src="https://github.com/GDSC-PKNU-21-22/pknu-notice-front/assets/68489467/8d9d90ba-45db-48bd-af8d-06b6a7547c3e">

<br />
<br />

# 기술 스택

<div align=center>
<div style="display: flex; flex-direction:column ;">
<h3 align=center style="text-align: center; font-size: 3em border:none">FE</h2>
<div>
<img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=ffffff">
<img src="https://img.shields.io/badge/React-61DAFB?logo=React&logoColor=ffffff">
<img src="https://img.shields.io/badge/Vite-d75adb?logo=Vite&logoColor=ffffff">
<img src="https://img.shields.io/badge/Jest-b82840?logo=jest&locoColor=000000">
<img src="https://img.shields.io/badge/Emotion-c888e3?logo=styled-components&locoColor=000000">
</div>
</div>
<div style="display: flex; flex-direction:column ;">
<h3 align=center style="text-align: center; font-size: 3em border:none">BE</h2>
<div>
<img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=ffffff">
<img src="https://img.shields.io/badge/NodeJS-6ad147?logo=node.js&locoColor=000000">
<img src="https://img.shields.io/badge/Express-080808?logo=express&locoColor=000000">
<img src="https://img.shields.io/badge/Mysql-ffffff?logo=mysql">
</div>
</div>
<div style="display: flex; flex-direction:column ;">
<h3 align=center style="text-align: center; font-size: 3em border:none">HOSTING</h2>
<div>
<img src="https://img.shields.io/badge/Amplify-f2be8a?&logo=awsamplify&locoColor=ffffff">
<img src="https://img.shields.io/badge/EC2-f2be8a?&logo=amazonec2&locoColor=ffffff">
<img src="https://img.shields.io/badge/RDS-f2be8a?&logo=amazonrds&locoColor=000000">
</div>
</div>
<div style="display: flex; flex-direction:column ;">
<h3 align=center style="text-align: center; font-size: 3em border:none">CI/CD</h2>
<div>
<img src="https://img.shields.io/badge/Docker-ffffff?logo=docker">
<img src="https://img.shields.io/badge/Github Actions-ffffff?logo=githubactions">
</div>
</div>
</div>

<br />
<br />

# 아키텍쳐

### 서버 통신

<img width="1139" alt="image" src="https://github.com/GDSC-PKNU-21-22/pknu-notice-front/assets/71641127/23471f0e-c2a1-4824-a7c9-4d3e1d499eae">

### 서버 배포

<img width="853" alt="image" src="https://github.com/GDSC-PKNU-21-22/pknu-notice-back/assets/71641127/a2390f58-4f40-407c-ba17-7125a551cfc5">

<br />
<br />

# 부림이 팀 소개

<a href="https://sheer-beak-f00.notion.site/555aff1481a04dc2a09937c32610e785?pvs=4" style="font-size: 16px; font-weight: bold">부림이 개발 과정 (노션 주소)</a>

<table align=center>
<thead>
<tr >
<th style="text-align:center;" >최현웅</th>
<th style="text-align:center;" >이상엽</th>
</tr>
</thead>
<tbody>
<tr>
<td><img width="200" src="https://github.com/GDSC-PKNU-21-22/pknu-notice-front/assets/68489467/278ee942-bd1f-45dd-bb1a-3a388ee5e554" /> </td>
<td><img width="200" src="https://github.com/GDSC-PKNU-21-22/pknu-notice-front/assets/71641127/6f33bdbb-8989-4c33-b915-7196e3902fc5" /></td>
</tr>
<tr>
<td>상엽씨..뭘 보고 있는거죠???</td>
<td>앞이 보이지가 않아요..</td>
</tr>
<tr>
<td><a href="https://github.com/hwinkr">@hwinkr</a></td>
<td><a href="https://github.com/pp449">@pp449</a></td>
</tr>
</tbody>
</table>
26 changes: 11 additions & 15 deletions src/apis/subscribe/controller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
subscribeMajor,
pushNotification,
unsubscribeMajor,
} from '@apis/subscribe/service';
import { subscribeMajor, unsubscribeMajor } from '@apis/subscribe/service';
import express, { Request, Response } from 'express';

const router = express.Router();
Expand All @@ -28,15 +24,15 @@ router.delete('/major', async (req: Request, res: Response) => {
}
});

router.post('/push', async (req: Request, res: Response) => {
try {
const { major } = req.body.data;
pushNotification(major);
} catch (error) {
console.error(error);
} finally {
res.status(200).json();
}
});
// router.post('/push', async (req: Request, res: Response) => {
// try {
// const { major } = req.body.data;
// pushNotification(major);
// } catch (error) {
// console.error(error);
// } finally {
// res.status(200).json();
// }
// });

export default router;
39 changes: 21 additions & 18 deletions src/apis/subscribe/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,30 @@ export const unsubscribeMajor = async (
});
};

export const pushNotification = (major: string) => {
export const pushNotification = (major: string): Promise<number> => {
const query = `SELECT user FROM ${major}구독`;
db.query(query, (err: Error, res: SubscribeUser[]) => {
if (err) console.error(err);
return new Promise<number>((resolve) => {
db.query(query, async (err: Error, res: SubscribeUser[]) => {
if (err) console.error(err);

try {
const message: PushMessage = {
title: `${major} 알림`,
body: '새로운 공지가 추가됐어요',
icon: './icons/icon-192x192.png',
};
try {
const message: PushMessage = {
title: `${major} 알림`,
body: '새로운 공지가 추가됐어요',
icon: './icons/icon-192x192.png',
};

for (const userInfo of res) {
webpush.sendNotification(
JSON.parse(userInfo.user),
JSON.stringify(message),
);
for (const userInfo of res) {
await webpush.sendNotification(
JSON.parse(userInfo.user),
JSON.stringify(message),
);
}
resolve(res.length);
} catch (error) {
notificationToSlack(error);
resolve(0);
}
notificationToSlack(`${major} ${res.length}명 알림 완료`);
} catch (error) {
console.error(error);
}
});
});
};
13 changes: 7 additions & 6 deletions src/hooks/cronNoticeCrawling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import cron from 'node-cron';
import notificationToSlack from 'src/hooks/notificateToSlack';

const pushToUsers = async (majors: string[]) => {
return new Promise<void>((resolve) => {
for (const major of majors) {
pushNotification(major);
}
});
let pushedUserCount = ``;
for (const major of majors) {
const count = await pushNotification(major);
pushedUserCount += `${major} ${count}명 알림 완료\n`;
}
notificationToSlack(pushedUserCount);
};

cron.schedule('0 10 * * *', async () => {
cron.schedule('0 3 * * *', async () => {
const majors = await saveNoticeToDB();
await saveNoticeToDB();
await saveSchoolNoticeToDB();
Expand Down

0 comments on commit a6e33a9

Please sign in to comment.