Both of the following would be correct:
1. "We had fun at the party."
2. "We had a good time at the party."
In this context, the uncountable noun "fun" and the countable noun "a good time" are similar.
Because "fun" is an uncountable noun, it is not correct to say "a good fun" or "a fun."