Skip to content

Commit

Permalink
fix: 🐛 Get all notifications. Add modified date to notifications (#150)
Browse files Browse the repository at this point in the history
* fix: 🐛 Get all notifications. Add modified date

* test: 💍 fix test for added personnummer in fake data
  • Loading branch information
kajetan-kazimierczak authored Sep 30, 2021
1 parent f977143 commit 4a0841a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/__tests__/__snapshots__/routes.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exports[`handles route news 1`] = `"https://etjanst.stockholm.se/vardnadshavare/

exports[`handles route newsDetails 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/News/GetNewsArticle?newsItemId=321&childId=123"`;

exports[`handles route notifications 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/Overview/GetNotification?childId=123"`;
exports[`handles route notifications 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/notifications/getnotifications?childId=123"`;

exports[`handles route schedule 1`] = `"https://etjanst.stockholm.se/vardnadshavare/inloggad2/Calender/GetSchema?childId=123&startDate=2021-01-01&endDate=2021-01-01"`;

Expand Down
3 changes: 2 additions & 1 deletion lib/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ describe('api', () => {
expect(user).toEqual({
firstName: 'Namn',
lastName: 'Namnsson',
isAuthenticated: true
isAuthenticated: true,
personalNumber: "195001182046",
})

const children = await api.getChildren()
Expand Down
1 change: 1 addition & 0 deletions lib/parse/__tests__/notifications.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ it(' notifications correctly', () => {
sender: 'Elevdokumentation',
url: 'https://elevdokumentation.stockholm.se/loa3/gradesStudent.do',
dateCreated: '2020-12-18T14:59:46.340Z',
dateModified: "2020-12-18T15:59:46.340Z",
category: null,
type: 'webnotify',
},
Expand Down
3 changes: 2 additions & 1 deletion lib/parse/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { parseDate } from '../utils/dateHandling'
import { Notification } from '../types'

export const notification = ({
notification: { messageid, dateCreated },
notification: { messageid, dateCreated, dateModified },
notificationMessage: {
messages: {
message: {
Expand All @@ -21,6 +21,7 @@ export const notification = ({
sender: name,
url: linkbackurl,
dateCreated: parseDate(dateCreated) || '',
dateModified: parseDate(dateModified) || '',
category,
type,
})
Expand Down
2 changes: 1 addition & 1 deletion lib/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const newsDetails = (childId: string, newsId: string) =>
export const image = (url: string) => `${urlLoggedIn}/NewsBanner?url=${url}`

export const notifications = (childId: string) =>
`${urlLoggedIn}/Overview/GetNotification?childId=${childId}`
`${urlLoggedIn}/notifications/getnotifications?childId=${childId}`

export const menuRss = (childId: string) =>
`${urlLoggedIn}/Matsedel/GetMatsedelRSS?childId=${childId}`
Expand Down
1 change: 1 addition & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export interface Notification {
id: string
sender: string
dateCreated: string
dateModified: string
message: string
url: string
category: string | null
Expand Down

0 comments on commit 4a0841a

Please sign in to comment.