mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 15:39:11 +00:00
Hotfix/6.0.2 (#94)
* hotfix/6.0.2 fix issue where events could not have an ID * hotfix/6.0.2 version bump * hotfix/6.0.2 testing
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { eventsURL } from '../api/apiConstants';
|
import { eventsURL } from './apiConstants';
|
||||||
|
|
||||||
export const fetchAllEvents = async () => {
|
export const fetchAllEvents = async () => {
|
||||||
const res = await axios.get(eventsURL);
|
const res = await axios.get(eventsURL);
|
||||||
@@ -7,38 +7,31 @@ export const fetchAllEvents = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const requestPost = async (data) => {
|
export const requestPost = async (data) => {
|
||||||
const res = await axios.post(eventsURL, data);
|
return await axios.post(eventsURL, data);
|
||||||
return res;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestPut = async (data) => {
|
export const requestPut = async (data) => {
|
||||||
const res = await axios.put(eventsURL, data);
|
return await axios.put(eventsURL, data);
|
||||||
return res;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestPatch = async (data) => {
|
export const requestPatch = async (data) => {
|
||||||
const res = await axios.patch(eventsURL, data);
|
return await axios.patch(eventsURL, data);
|
||||||
return res;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestReorder = async (data) => {
|
export const requestReorder = async (data) => {
|
||||||
const action = 'reorder';
|
const action = 'reorder';
|
||||||
const res = await axios.patch(eventsURL + '/' + action, data);
|
return await axios.patch(eventsURL + '/' + action, data);
|
||||||
return res;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestApplyDelay = async (eventId) => {
|
export const requestApplyDelay = async (eventId) => {
|
||||||
const action = 'applydelay';
|
const action = 'applydelay';
|
||||||
const res = await axios.patch(eventsURL + '/' + action + '/' + eventId);
|
return await axios.patch(eventsURL + '/' + action + '/' + eventId);
|
||||||
return res;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestDelete = async (eventId) => {
|
export const requestDelete = async (eventId) => {
|
||||||
const res = await axios.delete(eventsURL + '/' + eventId);
|
return await axios.delete(eventsURL + '/' + eventId);
|
||||||
return res;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestDeleteAll = async () => {
|
export const requestDeleteAll = async () => {
|
||||||
const res = await axios.delete(eventsURL + '/all');
|
return await axios.delete(eventsURL + '/all');
|
||||||
return res;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import PropTypes from 'prop-types';
|
|||||||
const ExpandedBlock = (props) => {
|
const ExpandedBlock = (props) => {
|
||||||
const { provided, data, eventIndex, next, delay, delayValue, previousEnd, actionHandler } = props;
|
const { provided, data, eventIndex, next, delay, delayValue, previousEnd, actionHandler } = props;
|
||||||
|
|
||||||
const oscid = data.id.length > 4 ? '...' : data.id;
|
const oscid = data?.id || '...';
|
||||||
|
|
||||||
// if end is before, assume is the day after
|
// if end is before, assume is the day after
|
||||||
const duration =
|
const duration =
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ontime",
|
"name": "ontime",
|
||||||
"version": "0.6.2",
|
"version": "0.6.3",
|
||||||
"author": "Carlos Valente",
|
"author": "Carlos Valente",
|
||||||
"description": "Time keeping for live events",
|
"description": "Time keeping for live events",
|
||||||
"repository": "https://github.com/cpvalente/ontime",
|
"repository": "https://github.com/cpvalente/ontime",
|
||||||
|
|||||||
@@ -94,10 +94,7 @@ export const eventsPost = async (req, res) => {
|
|||||||
|
|
||||||
// ensure structure
|
// ensure structure
|
||||||
let newEvent = {};
|
let newEvent = {};
|
||||||
let id = req.body.id;
|
const id = generateId();
|
||||||
if (data.events.find((e) => e.id === id)) {
|
|
||||||
id = generateId();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (req.body.type) {
|
switch (req.body.type) {
|
||||||
case 'event':
|
case 'event':
|
||||||
|
|||||||
@@ -16,12 +16,22 @@ const testEvent = {
|
|||||||
id: 'superSpecial12',
|
id: 'superSpecial12',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const eventFromDb = {
|
||||||
|
title: 'Welcome to Ontime',
|
||||||
|
subtitle: 'Subtitles are useful',
|
||||||
|
presenter: 'cpvalente',
|
||||||
|
note: 'Maybe a running note for the operator?',
|
||||||
|
timeStart: 28800000,
|
||||||
|
timeEnd: 30600000,
|
||||||
|
isPublic: false,
|
||||||
|
type: 'event',
|
||||||
|
revision: 7,
|
||||||
|
id: '5946',
|
||||||
|
};
|
||||||
|
|
||||||
describe('When a POST request is sent', () => {
|
describe('When a POST request is sent', () => {
|
||||||
test('POST /event should return a 201', async () => {
|
test('POST /event should return a 201', async () => {
|
||||||
await supertest(server)
|
await supertest(server).post('/events').send(testEvent).expect(201);
|
||||||
.post('/events')
|
|
||||||
.send(testEvent)
|
|
||||||
.expect(201)
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -38,20 +48,20 @@ describe('When a GET request request is sent', () => {
|
|||||||
});
|
});
|
||||||
test('GET /events/:eventId returns a valid object', async () => {
|
test('GET /events/:eventId returns a valid object', async () => {
|
||||||
await supertest(server)
|
await supertest(server)
|
||||||
.get(`/events/${testEvent.id}`)
|
.get(`/events/${eventFromDb.id}`)
|
||||||
.expect(200)
|
.expect(200)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
expect(response.text.includes('<!doctype html>')).toBe(false);
|
expect(response.text.includes('<!doctype html>')).toBe(false);
|
||||||
expect(response.body).toBeDefined();
|
expect(response.body).toBeDefined();
|
||||||
expect(response.body.title).toBe(testEvent.title);
|
expect(response.body.title).toBe(eventFromDb.title);
|
||||||
expect(response.body.subtitle).toBe(testEvent.subtitle);
|
expect(response.body.subtitle).toBe(eventFromDb.subtitle);
|
||||||
expect(response.body.presenter).toBe(testEvent.presenter);
|
expect(response.body.presenter).toBe(eventFromDb.presenter);
|
||||||
expect(response.body.note).toBe(testEvent.note);
|
expect(response.body.note).toBe(eventFromDb.note);
|
||||||
expect(response.body.timeStart).toBe(testEvent.timeStart);
|
expect(response.body.timeStart).toBe(eventFromDb.timeStart);
|
||||||
expect(response.body.timeEnd).toBe(testEvent.timeEnd);
|
expect(response.body.timeEnd).toBe(eventFromDb.timeEnd);
|
||||||
expect(response.body.isPublic).toBe(testEvent.isPublic);
|
expect(response.body.isPublic).toBe(eventFromDb.isPublic);
|
||||||
expect(response.body.type).toBe(testEvent.type);
|
expect(response.body.type).toBe(eventFromDb.type);
|
||||||
expect(response.body.id).toBe(testEvent.id);
|
expect(response.body.id).toBe(eventFromDb.id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -489,8 +489,12 @@ describe('test parseExcel function', () => {
|
|||||||
const parsedData = await parseExcel_v1(testdata);
|
const parsedData = await parseExcel_v1(testdata);
|
||||||
|
|
||||||
expect(parsedData.events).toBeDefined();
|
expect(parsedData.events).toBeDefined();
|
||||||
expect(parsedData.events).toStrictEqual(expectedParsedEvents);
|
expect(parsedData.events.title).toBe(expectedParsedEvents.title);
|
||||||
expect(parsedData.events).toStrictEqual(expectedParsedEvents);
|
expect(parsedData.events.presenter).toBe(expectedParsedEvents.presenter);
|
||||||
|
expect(parsedData.events.subtitle).toBe(expectedParsedEvents.subtitle);
|
||||||
|
expect(parsedData.events.isPublic).toBe(expectedParsedEvents.isPublic);
|
||||||
|
expect(parsedData.events.note).toBe(expectedParsedEvents.note);
|
||||||
|
expect(parsedData.events.type).toBe(expectedParsedEvents.type);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user