Frontend getReleaseNotes

This commit is contained in:
shamoon committed 2026-11-17 23:03:13 -08:00
1 parent ffe042e5ba
commit c091766a86
2 files changed
+42 -1

No files matched your search

@@ -40,4 +40,21 @@ describe('RemoteVersionService', () => {
)
expect(req.request.method).toEqual('GET')
})
it('should call release notes endpoint without since', () => {
subscription = service.getReleaseNotes().subscribe()
const req = httpTestingController.expectOne(
`${environment.apiBaseUrl}release_notes/`
)
expect(req.request.method).toEqual('GET')
expect(req.request.params.has('since')).toBe(false)
})
it('should pass since to release notes endpoint', () => {
subscription = service.getReleaseNotes('3.4.2').subscribe()
const req = httpTestingController.expectOne(
`${environment.apiBaseUrl}release_notes/?since=3.4.2`
)
expect(req.request.method).toEqual('GET')
})
})
@@ -1,4 +1,4 @@
import { HttpClient } from '@angular/common/http'
import { HttpClient, HttpParams } from '@angular/common/http'
import { Injectable, inject } from '@angular/core'
import { Observable } from 'rxjs'
import { environment } from 'src/environments/environment'
@@ -8,6 +8,19 @@ export interface AppRemoteVersion {
update_available: boolean
}
export interface AppRelease {
version: string
name: string
body: string
html_url: string
published_at: string
}
export interface AppReleaseNotes {
version: string
releases: AppRelease[]
}
@Injectable({
providedIn: 'root',
})
@@ -19,4 +32,15 @@ export class RemoteVersionService {
`${environment.apiBaseUrl}remote_version/`
)
}
public getReleaseNotes(since?: string): Observable<AppReleaseNotes> {
let params = new HttpParams()
if (since) {
params = params.set('since', since)
}
return this.http.get<AppReleaseNotes>(
`${environment.apiBaseUrl}release_notes/`,
{ params }
)
}
}