You want a Fourier series for the single periodic function
f(x)= x for
f(x)= 1 for
and "extended by periodicity": f(x+ 2)= f(x).
Use the usual formulas for the Fourier coefficients. You will need to break the integral into two parts, from 0 to 1 and from 1 to 2.