import { Body, Controller, Get, Param, Put } from '@nestjs/common';
import { DataService } from './data.service';

@Controller('data')
export class DataController {
  constructor(private readonly dataService: DataService) {}

  @Get(':key')
  get(@Param('key') key: string) {
    return this.dataService.get(key);
  }

  @Put(':key')
  put(
    @Param('key') key: string,
    @Body('value') value: unknown,
    @Body('version') version?: string | null,
  ) {
    return this.dataService.put(key, value, version);
  }
}
