mirror of
https://github.com/immich-app/immich.git
synced 2026-01-25 19:04:42 -08:00
feat: endpoint versioning (#23858)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Post, Query, Res } from '@nestjs/common';
|
||||
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { Response } from 'express';
|
||||
import { Endpoint, HistoryBuilder } from 'src/decorators';
|
||||
import {
|
||||
ActivityCreateDto,
|
||||
ActivityDto,
|
||||
@@ -21,10 +22,11 @@ export class ActivityController {
|
||||
|
||||
@Get()
|
||||
@Authenticated({ permission: Permission.ActivityRead })
|
||||
@ApiOperation({
|
||||
@Endpoint({
|
||||
summary: 'List all activities',
|
||||
description:
|
||||
'Returns a list of activities for the selected asset or album. The activities are returned in sorted order, with the oldest activities appearing first.',
|
||||
history: new HistoryBuilder().added('v1').beta('v1').stable('v2'),
|
||||
})
|
||||
getActivities(@Auth() auth: AuthDto, @Query() dto: ActivitySearchDto): Promise<ActivityResponseDto[]> {
|
||||
return this.service.getAll(auth, dto);
|
||||
@@ -32,9 +34,10 @@ export class ActivityController {
|
||||
|
||||
@Post()
|
||||
@Authenticated({ permission: Permission.ActivityCreate })
|
||||
@ApiOperation({
|
||||
@Endpoint({
|
||||
summary: 'Create an activity',
|
||||
description: 'Create a like or a comment for an album, or an asset in an album.',
|
||||
history: new HistoryBuilder().added('v1').beta('v1').stable('v2'),
|
||||
})
|
||||
async createActivity(
|
||||
@Auth() auth: AuthDto,
|
||||
@@ -50,9 +53,10 @@ export class ActivityController {
|
||||
|
||||
@Get('statistics')
|
||||
@Authenticated({ permission: Permission.ActivityStatistics })
|
||||
@ApiOperation({
|
||||
@Endpoint({
|
||||
summary: 'Retrieve activity statistics',
|
||||
description: 'Returns the number of likes and comments for a given album or asset in an album.',
|
||||
history: new HistoryBuilder().added('v1').beta('v1').stable('v2'),
|
||||
})
|
||||
getActivityStatistics(@Auth() auth: AuthDto, @Query() dto: ActivityDto): Promise<ActivityStatisticsResponseDto> {
|
||||
return this.service.getStatistics(auth, dto);
|
||||
@@ -61,9 +65,10 @@ export class ActivityController {
|
||||
@Delete(':id')
|
||||
@Authenticated({ permission: Permission.ActivityDelete })
|
||||
@HttpCode(HttpStatus.NO_CONTENT)
|
||||
@ApiOperation({
|
||||
@Endpoint({
|
||||
summary: 'Delete an activity',
|
||||
description: 'Removes a like or comment from a given album or asset in an album.',
|
||||
history: new HistoryBuilder().added('v1').beta('v1').stable('v2'),
|
||||
})
|
||||
deleteActivity(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto): Promise<void> {
|
||||
return this.service.delete(auth, id);
|
||||
|
||||
Reference in New Issue
Block a user