-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Nauxscript/feature/progress-fe
Feature/progress fe
- Loading branch information
Showing
15 changed files
with
257 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { ToolService } from './tool.service'; | ||
|
||
@Controller('tool') | ||
export class ToolController { | ||
constructor(private readonly toolService: ToolService) {} | ||
|
||
@Get('dailySentence') | ||
dailySentence() { | ||
return this.toolService.dailySentence(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { ToolService } from './tool.service'; | ||
import { ToolController } from './tool.controller'; | ||
|
||
@Module({ | ||
controllers: [ToolController], | ||
providers: [ToolService], | ||
}) | ||
export class ToolModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import * as superagent from 'superagent'; | ||
|
||
@Injectable() | ||
export class ToolService { | ||
async dailySentence() { | ||
const { text } = await superagent.get( | ||
'https://open.iciba.com/dsapi/?date=2023-05-03', | ||
); | ||
const data = JSON.parse(text); | ||
const res = { | ||
zh: data.note, | ||
en: data.content, | ||
}; | ||
return res; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { http } from "./http"; | ||
|
||
interface DailySentenceVo { | ||
zh: string | ||
en: string | ||
} | ||
|
||
export async function fetchDailySentence() { | ||
return await http.get<DailySentenceVo, DailySentenceVo>("/tool/dailySentence"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { http } from "./http"; | ||
|
||
interface UserProgressVo { | ||
courseId: number | ||
} | ||
|
||
interface UserProgressDto { | ||
courseId: number | ||
} | ||
|
||
export async function fetchUserProgress() { | ||
return await http.get<UserProgressVo, UserProgressVo>("/user-progress"); | ||
} | ||
|
||
export async function fetchUpdateProgress(dto: UserProgressDto) { | ||
return await http.put<UserProgressVo, UserProgressVo>("/user-progress", dto); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.