GithubHelp home page GithubHelp logo

wafflestudio / snutt-timetable Goto Github PK

View Code? Open in Web Editor NEW
13.0 6.0 0.0 824 KB

SNUTT timetable service

Kotlin 99.95% Dockerfile 0.05%
kotlin mongodb spring-webflux snu timetable spring-batch spring-boot spring-boot-3 spring-data-mongodb redis

snutt-timetable's Introduction

snutt-timetable

SNUTT 시간표 서비스

Related Repositories

  • snutt-ev : 강의평 서비스 서버
  • snutt : snutt-timetable 의 전신인 Node.js 로 구현된 서버 (migration 진행 중)

snutt-timetable's People

Contributors

asp345 avatar davin111 avatar hank-choi avatar jhvictor4 avatar pfcjeong avatar subeenpark-io avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

snutt-timetable's Issues

snutt 전체 마이그레이션

course book

  • GET /course_books
  • GET /course_books/recent
  • GET /course_books/official

colors

  • GET /colors
  • GET /colors/:colorName

lecture

  • POST /search_query

tags

  • GET /tags/:year/:semester/update_time
  • GET /tags/:year/:semester

auth

  • POST /auth/request_temp
  • POST /auth/login_local
  • POST /auth/register_local
  • POST /auth/login_apple
  • POST /auth/login_fb
  • POST /auth/logout
  • POST /auth/password/reset/email/check
  • POST /auth/password/reset/email/send
  • POST /auth/password/reset/verification/code
  • POST /auth/password/reset
  • POST /auth/id/find

users

  • GET /user/info
  • DELETE /user/email/verification
  • POST /user/email/verification
  • POST /user/email/verification/code
  • GET /user/email/verification
  • POST /user/password
  • PUT /user/password
  • POST /user/facebook
  • DELETE /user/facebook
  • GET /user/facebook
  • POST /user/device/:registration_id
  • DELETE /user/device/:registration_id
  • DELETE /user/account

timetables

  • GET /tables/
  • GET /tables/recent
  • GET /tables/:id
  • GET /tables/:year/:semester
  • POST /tables
  • POST /tables/:timetable_id/lecture/:lecture_id
  • POST /tables/:id/lecture
  • PUT /tables/:table_id/lecture/:lecture_id
  • PUT /tables/:table_id/lecture/:lecture_id/reset
  • DELETE /tables/:table_id/lecture/:lecture_id
  • DELETE /tables/:id
  • POST /tables/:id/copy
  • PUT /tables/:id
  • PUT /tables/:id/theme

notificiation

  • GET /notification
  • GET /notification/count

admin

  • POST /admin/insert_noti
  • POST /admin/change_pw
  • GET /admin/recent_fcm_log
  • GET /admin/coursebooks
  • GET /admin/statistics

ev-service (얘네는 어짜지)

  • GET /ev-service/v1/users/me/lectures/latest
  • GET /ev-service/*

etc

  • POST /feedback
  • GET /popups

class_time_mask 삭제

db.bookmarks.updateMany({}, {$unset: {"lectures.class_time_mask":1}})
db.lectures.updateMany({}, {$unset: {"class_time_mask":1}})
db.timetables.updateMany({}, { $unset : { "lecture_list.class_time_mask" : 1} })

세 쿼리로 삭제

dev에 적용 완료

대표시간표 자동지정

#176

연도별로 끊어서 수행

  • 2014 (2612)
  • #178
  • 2016 (5755)
  • 2017 (17938)
  • 2018 (95593)
  • 2019 (106205)
  • 2020 (99698)
  • 2021 (98436)
  • 2022 (97788)
  • 2023 (60091)

start_time, end_time, start, len DB에서 삭제

start_time, end_time 이용해 startMinute, endMinute 생성 후
unset으로 다 삭제

let cursor = db.lectures.find({"class_time_json.startMinute" : {$exists: 0}, "class_time_json.start_time" : {$exists: 1}});
while (cursor.hasNext()) {
  let document = cursor.next()
  const class_time_json = document["class_time_json"].map((json, idx) => {
    const startHourMinute = json["start_time"].split(":")
      .map((hourOrMinute) => parseInt(hourOrMinute, 10));
    const endHourMinute = json["end_time"].split(":")
      .map((hourOrMinute) => parseInt(hourOrMinute, 10));
    const [startHour, startMinute] = startHourMinute;
    const [endHour, endMinute] = endHourMinute;
    const startTotalMinute = startHour * 60 + startMinute;
    const endTotalMinute = endHour * 60 + endMinute;
    return {
      ...json,
      startMinute: startTotalMinute,
      endMinute: endTotalMinute
    }
  })
  db.lectures.updateOne({_id: document["_id"]}, {
    $set: {
      class_time_json: class_time_json,
    }
  })
}



let cursor2 = db.timetables.find( {lecture_list: {$elemMatch: {"class_time_json.startMinute" : {$exists: 0}, "class_time_json.start_time" : {$exists: 1}}}})
while (cursor2.hasNext()) {
  let documentTT = cursor2.next()
  let change = documentTT["lecture_list"].map((document, idx) => {
    if (document["class_time_json"] !== null && document["class_time_json"].length !== 0) {
      const class_time_json = document["class_time_json"].map((json, idx) => {
        const startHourMinute = json["start_time"].split(":")
          .map((hourOrMinute) => parseInt(hourOrMinute, 10));
        const endHourMinute = json["end_time"].split(":")
          .map((hourOrMinute) => parseInt(hourOrMinute, 10));
        const [startHour, startMinute] = startHourMinute;
        const [endHour, endMinute] = endHourMinute;
        const startTotalMinute = startHour * 60 + startMinute;
        const endTotalMinute = endHour * 60 + endMinute;
        return {
          ...json,
          startMinute: startTotalMinute,
          endMinute: endTotalMinute
        }
      })
      return {
        ...document,
        class_time_json: class_time_json,
      }
    } else return document
  })
  db.timetables.updateOne({_id: documentTT["_id"]}, {
    $set: {
      lecture_list: change,
    }
  })
}

let cursor3 = db.bookmarks.find({lecture_list: {$elemMatch: {"class_time_json.startMinute" : {$exists: 0}, "class_time_json.start_time" : {$exists: 1}}}})
while (cursor3.hasNext()) {
  let documentTT = cursor3.next()
  let change = documentTT["lectures"].map((document, idx) => {
    if (document["class_time_json"] !== null && document["class_time_json"].length !== 0) {
      const class_time_json = document["class_time_json"].map((json, idx) => {
        const startHourMinute = json["start_time"].split(":")
          .map((hourOrMinute) => parseInt(hourOrMinute, 10));
        const endHourMinute = json["end_time"].split(":")
          .map((hourOrMinute) => parseInt(hourOrMinute, 10));
        const [startHour, startMinute] = startHourMinute;
        const [endHour, endMinute] = endHourMinute;
        const startTotalMinute = startHour * 60 + startMinute;
        const endTotalMinute = endHour * 60 + endMinute;
        return {
          ...json,
          startMinute: startTotalMinute,
          endMinute: endTotalMinute
        }
      })
      return {
        ...document,
        class_time_json: class_time_json,
      }
    } else return document
  })
  db.bookmarks.updateOne({_id: documentTT["_id"]}, {
    $set: {
      lectures: change,
    }
  })
}

db.lectures.updateMany(
    {},
    { $unset: { "class_time_json.$[].start": true, "class_time_json.$[].start_time": true, "class_time_json.$[].end_time": true, "class_time_json.$[].len": true }},
)

db.timetables.updateMany(
    {},
    { $unset: { "lecture_list.$[].class_time_json.$[].start": true, "lecture_list.$[].class_time_json.$[].start_time": true, "lecture_list.$[].class_time_json.$[].end_time": true, "lecture_list.$[].class_time_json.$[].len": true }},
)

db.bookmarks.updateMany(
    {},
    { $unset: { "lectures.$[].class_time_json.$[].start": true, "lectures.$[].class_time_json.$[].start_time": true, "lectures.$[].class_time_json.$[].end_time": true, "lectures.$[].class_time_json.$[].len": true }},
)

리팩토링

코드가 점점 섞여서 벌써 스타일이 뒤죽박죽 시작한 느낌

한번 다같이 코드리뷰하는거 어떤가요
PR에서 다 얘기했어야 하는데 못보고 막상 클론받고 보니까 마음에 안드는 부분들이 좀 있는듯?

한번 회의 잡았으면 함

@Jhvictor4
@subeenpark-io
@davin111

유저 중복 삭제

db.users.aggregate( [
   { $group: { _id:{uid:"$credential.localId",active: "$active"}, users: {$push :{id:"$_id", ll: "$lastLoginTimestamp"}}, myCount: { $sum: 1 } } },
//   { $group: { _id:{uid:"$credential.fbId",active: "$active"}, users: {$push :{id:"$_id", ll: "$lastLoginTimestamp"}}, myCount: { $sum: 1 } } },
//   { $group: { _id:{uid:"$credential.appleEmail",active: "$active"}, users: {$push :{id:"$_id", ll: "$lastLoginTimestamp"}}, myCount: { $sum: 1 } } },
   { $match: { myCount:{ $gt: 1 }, "_id.active": true, "_id.uid": {$exists :1, $ne: null} } },
   { $unwind: "$users"},
   { $group: { _id:"$_id.uid", users: {$push :"$users"}, maxll: { $max: "$users.ll" } } },
   { $unwind: "$users"},
   { $match: {$expr: {
        $ne: [ "$maxll", "$users.ll" ]
      } }},
   { $replaceRoot: {newRoot: "$users"}}
]).forEach(it => db.users.deleteOne({_id: it.id})))

빈자리 알림 api 추가

collection 생성 및 index 추가

db.vacancy_notifications.createIndex(
     {
       "userId": 1,
       "lectureId": 1
     },
     {
     unique: true,
   })
db.vacancy_notifications.createIndex(
     {
       "userId": 1,
     },
   )
db.vacancy_notifications.createIndex(
     {
       "lectureId": 1
     },
   )

db.vacancy_notifications.createIndex(
     {
       "coursebookId": 1
     },
   )

시간대 검색 api 버그

현재 쿼리 오류로 인해 stackoverflow 에러 발생

쿼리 수정 -> 모든 list에서 true 인 쿼리 몽고에서 날리는 것 불가능 하므로 not elematch로 조금 복잡하게 해결

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.