mirror of
https://github.com/zen-browser/rices.git
synced 2025-07-07 17:05:40 +02:00
fix no name and author in update
This commit is contained in:
parent
121ccadf57
commit
6609122f8a
4 changed files with 6 additions and 15 deletions
|
@ -145,11 +145,9 @@ export class RicesService {
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
// Extract fields from headers
|
// Extract fields from headers
|
||||||
const name = headers['x-zen-rice-name'];
|
|
||||||
const author = headers['x-zen-rice-author'];
|
|
||||||
const userAgent = headers['user-agent'];
|
const userAgent = headers['user-agent'];
|
||||||
|
|
||||||
if (!name || !author || !userAgent) {
|
if (!userAgent) {
|
||||||
throw new BadRequestException(
|
throw new BadRequestException(
|
||||||
'Missing required headers: X-Zen-Rice-Name, X-Zen-Rice-Author, and User-Agent are mandatory.',
|
'Missing required headers: X-Zen-Rice-Name, X-Zen-Rice-Author, and User-Agent are mandatory.',
|
||||||
);
|
);
|
||||||
|
@ -178,13 +176,6 @@ export class RicesService {
|
||||||
throw new UnauthorizedException('Invalid token.');
|
throw new UnauthorizedException('Invalid token.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate name and author match the existing record
|
|
||||||
if (rice.name !== name || rice.author !== author) {
|
|
||||||
throw new UnauthorizedException(
|
|
||||||
'Provided name and author do not match the existing record.',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const updatedMetadata = {
|
const updatedMetadata = {
|
||||||
...rice,
|
...rice,
|
||||||
version,
|
version,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
POST {{baseUrl}}/rices
|
POST {{baseUrl}}/rices
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
X-Zen-Rice-Name: cool-zenrice-aurora
|
X-Zen-Rice-Name: cool-zenrice-aurora2
|
||||||
X-Zen-Rice-Author: jhon@doe.com
|
X-Zen-Rice-Author: jhon@doe.com
|
||||||
User-Agent: ZenBrowser/1.0.0 (EndeavourOS x86_64)
|
User-Agent: ZenBrowser/1.0.0 (EndeavourOS x86_64)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
@baseUrl = http://localhost:3000
|
@baseUrl = http://localhost:3000
|
||||||
@previous_slug = cool-zenrice-aurora-249dd7f2-d669-4d1f-892c-df4caa6fcbfe
|
@previous_slug = cool-zenrice-aurora2-4fe6417d-f901-43d2-92fc-720c6ed3e449
|
||||||
|
|
||||||
|
|
||||||
GET {{baseUrl}}/rices/{{previous_slug}}
|
GET {{baseUrl}}/rices/{{previous_slug}}
|
|
@ -1,11 +1,11 @@
|
||||||
@baseUrl = http://localhost:3000
|
@baseUrl = http://localhost:3000
|
||||||
@previous_slug = cool-zenrice-aurora-249dd7f2-d669-4d1f-892c-df4caa6fcbfe
|
@previous_slug = cool-zenrice-aurora2-4fe6417d-f901-43d2-92fc-720c6ed3e449
|
||||||
@previous_token = 528bb297-274f-4fe1-87f1-956b9b26e0df
|
@previous_token = e3ec0c0f-f455-4a4e-a06d-69d2e3bbf46c
|
||||||
|
|
||||||
PUT {{baseUrl}}/rices/{{previous_slug}}
|
PUT {{baseUrl}}/rices/{{previous_slug}}
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
x-zen-rices-token: {{previous_token}}
|
x-zen-rices-token: {{previous_token}}
|
||||||
X-Zen-Rice-Name: cool-zenrice-aurora
|
X-Zen-Rice-Name: cool-zenrice-aurora2
|
||||||
X-Zen-Rice-Author: jhon@doe.com
|
X-Zen-Rice-Author: jhon@doe.com
|
||||||
User-Agent: ZenBrowser/1.0.0 (EndeavourOS x86_64)
|
User-Agent: ZenBrowser/1.0.0 (EndeavourOS x86_64)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue