Merge commit '48c011e3e5984f2cea1b2b3102508d2fcae8ae8c' into production
This commit is contained in:
9
.env
9
.env
@ -24,10 +24,13 @@ AZURE_AD_CLIENT_SECRET=5ic8Q~GQmW-IUhuxzVGx3BE-i30GXDSpjfMHcb~z #client secret v
|
|||||||
AZURE_AD_TENANT_ID=f69d1a93-bfba-498a-9b60-e87c1bc26276
|
AZURE_AD_TENANT_ID=f69d1a93-bfba-498a-9b60-e87c1bc26276
|
||||||
|
|
||||||
|
|
||||||
APPLE_ID=
|
APPLE_ID=com.mwhitnessing.sofia
|
||||||
APPLE_TEAM_ID=
|
APPLE_SECRET=eyJhbGciOiJFUzI1NiIsImtpZCI6IlRCM1YzNTVHNVkifQ.eyJhdWQiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiaXNzIjoiWEM1N1A5U1hESyIsImlhdCI6MTcxMjE3ODM0MiwiZXhwIjoxNzI3NzMwMzQzLCJzdWIiOiJjb20ubXdoaXRuZXNzaW5nLnNvZmlhIn0.XceA0qUQi0tXg0GM_LkJkpNU5AqXLiSB2JlEVbHCB_nINbQTWkjtoWxfqmvdOkIzwKtvdQ8FFb-crK9no9Bbbw
|
||||||
|
# to generate
|
||||||
|
APPLE_TEAM_ID=XC57P9SXDK
|
||||||
|
APPLE_KEY_ID=TB3V355G5Y
|
||||||
APPLE_PRIVATE_KEY=
|
APPLE_PRIVATE_KEY=
|
||||||
APPLE_KEY_ID=
|
|
||||||
|
|
||||||
AUTH0_ID=Aa9f3HJowauUrmBVY4iQzQJ7fYsaZDbK
|
AUTH0_ID=Aa9f3HJowauUrmBVY4iQzQJ7fYsaZDbK
|
||||||
AUTH0_SECRET=_c0O9GkyRXkoWMQW7jNExnl6UoXN6O4oD3mg7NZ_uHVeAinCUtcTAkeQmcKXpZ4x
|
AUTH0_SECRET=_c0O9GkyRXkoWMQW7jNExnl6UoXN6O4oD3mg7NZ_uHVeAinCUtcTAkeQmcKXpZ4x
|
||||||
|
6
_deploy/appleKey.p8
Normal file
6
_deploy/appleKey.p8
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgL3WoWMr7zzqtZdF/
|
||||||
|
wNEJ9+yMP2qNJV305gTdF+++hLOgCgYIKoZIzj0DAQehRANCAATqlUN+GE7/r8UQ
|
||||||
|
c93hRG9UxCtBcJEcgSGwYVPtZvA5igUBxY/6+RO/Tcnq9xT/6PZD0A82vMNSjoJ6
|
||||||
|
/KyhaFLl
|
||||||
|
-----END PRIVATE KEY-----
|
@ -11,8 +11,17 @@ if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
node apple.mjs [--kid] [--iss] [--private_key] [--sub] [--expires_in] [--exp]
|
node apple.mjs [--kid] [--iss] [--private_key] [--sub] [--expires_in] [--exp]
|
||||||
|
APPLE_ID=com.mwhitnessing.sofia
|
||||||
node setupAppleId.mjs --kid YOUR_KEY_ID --iss YOUR_TEAM_ID --private_key "$(cat key.p8)" --sub YOUR_CLIENT_ID --expires_in 15778800
|
APPLE_TEAM_ID=XC57P9SXDK
|
||||||
|
APPLE_KEY_ID=TB3V355G5Y
|
||||||
|
APPLE_KEY
|
||||||
|
|
||||||
|
node setupAppleId.mjs --kid YOUR_KEY_ID --iss YOUR_TEAM_ID --private_key "$(cat key.p8)" --sub YOUR_CLIENT_ID --expires_in 15778800
|
||||||
|
node setupAppleId.mjs --kid TB3V355G5Y --iss XC57P9SXDK --sub com.mwhitnessing.sofia --private_key "$(cat appleKey.p8)"
|
||||||
|
|
||||||
|
>>Apple client secret generated. Valid until: Tue Oct 01 2024 00:05:43 GMT+0300 (Eastern European Summer Time)
|
||||||
|
|
||||||
|
eyJhbGciOiJFUzI1NiIsImtpZCI6IlRCM1YzNTVHNVkifQ.eyJhdWQiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiaXNzIjoiWEM1N1A5U1hESyIsImlhdCI6MTcxMjE3ODM0MiwiZXhwIjoxNzI3NzMwMzQzLCJzdWIiOiJjb20ubXdoaXRuZXNzaW5nLnNvZmlhIn0.XceA0qUQi0tXg0GM_LkJkpNU5AqXLiSB2JlEVbHCB_nINbQTWkjtoWxfqmvdOkIzwKtvdQ8FFb-crK9no9Bbbw
|
||||||
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
@ -87,27 +87,29 @@ export default function AvailabilityForm({ publisherId, existingItems, inline, o
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
try {
|
try {
|
||||||
const groupedTimeSlots = mergeCheckedTimeSlots(timeSlots);
|
const groupedTimeSlots = mergeCheckedTimeSlots(timeSlots);
|
||||||
|
let avs = availabilities.filter(av => av.type !== "assignment");
|
||||||
// Determine if we need to delete and recreate, or just update
|
// Determine if we need to delete and recreate, or just update
|
||||||
const shouldRecreate = availabilities.length !== groupedTimeSlots.length || availabilities.some(av => !av.id);
|
let shouldRecreate = avs.length > 0 && avs.length !== groupedTimeSlots.length || avs.some(av => !av.id);
|
||||||
|
shouldRecreate = shouldRecreate || ( avs.length == 0 && availabilities.length > 0);
|
||||||
|
//create availability if we open a form with assignment without availability
|
||||||
|
|
||||||
if (shouldRecreate) {
|
if (shouldRecreate) {
|
||||||
// Delete existing availabilities if they have an ID
|
// Delete existing availabilities if they have an ID
|
||||||
console.log("Recreating availabilities");
|
console.log("Recreating availabilities");
|
||||||
await Promise.all(availabilities.filter(av => av.id).map(av => axiosInstance.delete(`${urls.apiUrl}${av.id}`)));
|
await Promise.all(avs.filter(av => av.id).map(av => axiosInstance.delete(`${urls.apiUrl}${av.id}`)));
|
||||||
|
|
||||||
// Create new availabilities
|
// Create new availabilities
|
||||||
const createdAvailabilities = await Promise.all(groupedTimeSlots.map(async group => {
|
avs = await Promise.all(groupedTimeSlots.map(async group => {
|
||||||
const newAvailability = createAvailabilityFromGroup(group, publisher.id);
|
const newAvailability = createAvailabilityFromGroup(group, publisher.id);
|
||||||
const response = await axiosInstance.post(urls.apiUrl, newAvailability);
|
const response = await axiosInstance.post(urls.apiUrl, newAvailability);
|
||||||
return response.data; // Assuming the new availability is returned
|
return response.data; // Assuming the new availability is returned
|
||||||
}));
|
}));
|
||||||
|
|
||||||
setAvailabilities(createdAvailabilities);
|
setAvailabilities(avs);
|
||||||
} else {
|
} else {
|
||||||
// Update existing availabilities
|
// Update existing availabilities
|
||||||
console.log("Updating existing availabilities");
|
console.log("Updating existing availabilities");
|
||||||
const updatedAvailabilities = await Promise.all(availabilities.map(async (availability, index) => {
|
avs = await Promise.all(avs.map(async (availability, index) => {
|
||||||
const group = groupedTimeSlots[index];
|
const group = groupedTimeSlots[index];
|
||||||
const id = availability.id;
|
const id = availability.id;
|
||||||
const updatedAvailability = updateAvailabilityFromGroup(availability, group);
|
const updatedAvailability = updateAvailabilityFromGroup(availability, group);
|
||||||
@ -121,7 +123,7 @@ export default function AvailabilityForm({ publisherId, existingItems, inline, o
|
|||||||
return updatedAvailability;
|
return updatedAvailability;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
setAvailabilities(updatedAvailabilities);
|
setAvailabilities(avs);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCompletion({ updated: true });
|
handleCompletion({ updated: true });
|
||||||
@ -228,7 +230,8 @@ export default function AvailabilityForm({ publisherId, existingItems, inline, o
|
|||||||
const handleDelete = async (e) => {
|
const handleDelete = async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
try {
|
try {
|
||||||
const deletePromises = availabilities.map(async (availability) => {
|
let avs = availabilities.filter(av => av.type !== "assignment");
|
||||||
|
const deletePromises = avs.map(async (availability) => {
|
||||||
if (availability.id) {
|
if (availability.id) {
|
||||||
// console.log("deleting publisher id = ", router.query.id, "; url=" + urls.apiUrl + router.query.id);
|
// console.log("deleting publisher id = ", router.query.id, "; url=" + urls.apiUrl + router.query.id);
|
||||||
await axiosInstance.delete(urls.apiUrl + availability.id);
|
await axiosInstance.delete(urls.apiUrl + availability.id);
|
||||||
|
@ -56,7 +56,14 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
|
|||||||
|
|
||||||
// Update internal state when `events` prop changes
|
// Update internal state when `events` prop changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const updatedEvents = events.map(event => ({
|
//if we have isBySystem - set type to assignment
|
||||||
|
let updatedEvents = events.map(event => {
|
||||||
|
if (event.isBySystem) {
|
||||||
|
event.type = "assignment";
|
||||||
|
}
|
||||||
|
return event;
|
||||||
|
});
|
||||||
|
updatedEvents = events.map(event => ({
|
||||||
...event,
|
...event,
|
||||||
date: new Date(event.startTime).setHours(0, 0, 0, 0),
|
date: new Date(event.startTime).setHours(0, 0, 0, 0),
|
||||||
startTime: new Date(event.startTime),
|
startTime: new Date(event.startTime),
|
||||||
|
@ -109,4 +109,4 @@
|
|||||||
"depcheck": "^1.4.7",
|
"depcheck": "^1.4.7",
|
||||||
"prisma": "^5.11.0"
|
"prisma": "^5.11.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export default function App({
|
|||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
/>
|
/>
|
||||||
</Head>
|
</Head>
|
||||||
<SessionProvider session={session}>
|
<SessionProvider session={session} >
|
||||||
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
</LocalizationProvider>
|
</LocalizationProvider>
|
||||||
|
@ -41,11 +41,15 @@ export const authOptions: NextAuthOptions = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
AzureADProvider({
|
AppleProvider({
|
||||||
clientId: process.env.AZURE_AD_CLIENT_ID,
|
clientId: process.env.APPLE_ID,
|
||||||
clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
|
clientSecret: process.env.APPLE_SECRET
|
||||||
tenantId: process.env.AZURE_AD_TENANT_ID,
|
|
||||||
}),
|
}),
|
||||||
|
// AzureADProvider({
|
||||||
|
// clientId: process.env.AZURE_AD_CLIENT_ID,
|
||||||
|
// clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
|
||||||
|
// tenantId: process.env.AZURE_AD_TENANT_ID,
|
||||||
|
// }),
|
||||||
CredentialsProvider({
|
CredentialsProvider({
|
||||||
// The name to display on the sign in form (e.g. 'Sign in with...')
|
// The name to display on the sign in form (e.g. 'Sign in with...')
|
||||||
name: 'Credentials',
|
name: 'Credentials',
|
||||||
@ -87,11 +91,7 @@ export const authOptions: NextAuthOptions = {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
// AppleProvider({
|
|
||||||
// clientId: process.env.APPLE_ID,
|
|
||||||
// clientSecret: process.env.APPLE_SECRET
|
|
||||||
// })
|
|
||||||
/*
|
/*
|
||||||
EmailProvider({
|
EmailProvider({
|
||||||
server: {
|
server: {
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
-- AlterTable
|
-- AlterTable
|
||||||
ALTER TABLE `publisher` ADD COLUMN `isSubscribedToCoverMe` BOOLEAN NOT NULL DEFAULT false,
|
ALTER TABLE `Publisher` ADD COLUMN `isSubscribedToCoverMe` BOOLEAN NOT NULL DEFAULT false,
|
||||||
ADD COLUMN `isSubscribedToReminders` BOOLEAN NOT NULL DEFAULT false;
|
ADD COLUMN `isSubscribedToReminders` BOOLEAN NOT NULL DEFAULT false;
|
||||||
|
Reference in New Issue
Block a user